There is no one right answer.
I didn't tell anyone until I knew (or thought I knew) the extent and possible prognosis, and I had taught myself enough about the disease that I would be able to answer their questions. I couldn't see any point in telling them I had cancer but I didn't yet know if it was going to kill me - I needed time first to do my own research on the disease and wait for the results of the diagnostic tests which indicated the path forwards. I could cope with that myself for a while, but would not have been able to cope with people around me bursting into tears or continually asking me how I was.
When I'd got enough test results to indicate treatment was with a curative intent, then I told my family, because I could give them a lot more info at that point. Actually, I told my brother first, and that enabled me to talk with him about how to tell my parents. I'd spent weeks reading about PC, treatments, side effects, etc, so I was also well armed to answer any questions. As it happened, there were almost no questions at that point - the shock is probably more overwhelming, and I later realised they were not able to take in everything, so I did run through it again over the following days, and was then able to answer questions they had. I continue to make it clear I'm happy to talk more about it with them and we do, but also I quickly realised each of them has a limit to what they want to know, and I'm careful to respect that too.
I'm a software engineer who does contracting for clients, and I did tell my main client at the time, because I was having to take days out at short notice for tests and appointments. They had no problem with that, and I wanted them to know there was a good reason I had to keep ducking out of work. (I decided to stop the contract later to give me a clear head to handle the diagnosis.)
After telling close family, I don't feel I need to hide it, but I don't advertise it either. I have talked with some friends I know have had cancer (or at least a scare of cancer), and it is really good to be able to do this. A neighbour was a salesman for the pharma company that first brought brachtherapy pellets into the UK, and he was useful to talk with (although he works somewhere else now). If it comes up randomly in conversation with friends, I will mention it, but I haven't brought it up myself as yet. Maybe at some point I will mention it on facebook so all my friends know, but I'm not ready to do that yet. That can probably wait until after treatment. I can imagine I will become an evangelist for having PSA test and highlighting the (very few) early symptoms that should cause a visit to the GP, but I'm not quite ready for that myself yet.
This was right for me, but it won't be for anyone else - each person has to work out their own strategy. I think things to weigh up are that you will cause worry to those near and dearest to you, but that's ultimately unavoidable. I chose to wait until I could support them in that worry with more knowledge and diagnostic results, but for many other people, you will want the support of these people during those early stages of appointments and tests, so you will need to tell them earlier. There may be friends who can't handle the information, and you might then lose contact with them. You may feel you can't tell your employer because it could harm your career (I would hope there are no such employers around, but there probably are).
It turned out that after I thought I had a full diagnosis and told my family, the consultants became less sure and sent me for more tests. I then had my family wanting to know the new test results the moment I got them and that didn't suit me - it didn't give me time to think about what I'd been told and do the necessary research to answer their questions. However, it confirmed that my original decision to wait until I had the diagnosis had been the right one for me.
I did have a chat with my MacMillan nurse about telling people before I'd told anyone, and that was very useful.