I thought about this, and even had a chat with a Macmillan nurse about it.
I didn't want to lose friends which I'd heard happen with some people, so I needed to work out how to do it such that I didn't make anyone uncomfortable. That meant I had to be comfortable with it, so it wasn't something I was going to do at the outset. Both my parents were still alive too, and I was a carer for mum. In some ways, I preferred not to have to tell them, but I had no choice as I might be unavailable for periods during treatment. I knew that eventually I wanted to be open about it, but I wasn't ready to do that just yet.
So initially, I told no one. My diagnosis took 6 months (I knew I had cancer quite quickly, but not the staging or if I was eligible for a curative treatment for some time). I didn't need (or want) the support of anyone else during that period, and I couldn't see the point of saying "I've got cancer and I don't know if it will kill me or not". So I waited until I had a full diagnosis and prognosis before telling my parents, and a small number of friends. This probably isn't the case for most people, particularly if you have a partner when you'll want the support of each other.
I found I need to have some emotional reserve when I told someone, because it's even more of a sudden shock to them than it probably was for you, and you need to be able to support them. In the early days, I had just about enough emotional reserve to keep myself in one piece, but not to support someone else too. By the time I was starting to tell other people, I was more comfortable with it and had the emotional reserve to support them. Also by then, I'd learned more about the disease and my situation, which meant I could answer most questions they might have.
I decided to wait until after my radiotherapy to tell all my friends and put it on facebook. I figured it was likely to be easier to handle if people knew I'd already been treated. As far as I know, I haven't lost any friends through this, although I did suspect a couple might have struggled with what to say. On the other hand, I've picked up loads of friends I wouldn't have had otherwise.