As I'm writing my text about C# I'm finding more and more situations where I'm saying "Leave your worries about performance until the end of development".
Now doing some stuff on string interning in C#. For some reason I have this picture of a program that gets young people in to work as strings and pays them nothing. However this is not actually how it works.....
Writing about string stuff. Needed a few lines for an example. Remembered this:
"A rocket explorer named Wright
Once travelled much faster than light.
He set out one day,
In a relative way,
And returned on the previous night."
One of the nice things about writing a book is that you become an expert on a subject (albeit in my case, just for a very short time). At the moment I know exactly how to make different parts of a Parallel Language Integrated Query (PLINQ) expression sequential so that the order of the output set is the one that you want.
Not many people can say this. (Oh, and PLINQ is a very neat technology by the way).
Back at work today. The thing that is keeping me busy over the summer is book writing. I've signed up to write a new book to teach programming. The content is loosely based on the World Famous C# Yellow book, but with a heavily practical approach. The aim is to teach people how to write programs that they could use to impress their friend. And their mum.
The book is going to be in colour, with pictures and everything. I'll post some sample pages as soon as I can.
The latest version of the C# Yellow Book is now available for free download. You can get it here, or you can press the spiffy new short cut on this page.
There are a few changes. I’ve fixed all the mistakes that have been sent in (and probably added a few more). The section on Graphical User Interfaces now covers XAML rather than Windows Forms. And the text now mentions “The Wizard of Oz”
Sometimes you just want a good book to read. Not one that has won awards, just a good narrative and some strong characters. Michael Connelly writes crime novels which are just a great way to pass the time. One of his heroes, Harry Bosch, is a hard bitten and hard boiled detective, just the kind of guy you’d want to investigate your murder (although perhaps you’d be past caring by then). Harry works the mean streets of Los Angeles and has seen a lot of life. There are a number of books which chronicle his ups and downs, you can read them in order or how you like, as each is completely free standing. If courtroom drama is more your style there are also some books staring Mickey Haller, the attorney with a heart of gold and an interesting past. All good reads.
As an exercise, while I was washing the car today I had a go at putting together a Harry Bosch style narrative. There’s actually a serious point here – from a writing point of view it is often useful to have a go at using a particular style – do a blog post from a private eye, or a president, or a poet and see how you get on. Anyhoo, with apologies to Michael Connelly, and a note that his prose is definitely not played for laughs, here’s my attempt at a Harry Bosch story:
The Axe In The Head Affair
Bosch hit the man full in the face as hard as he could. The man went straight down onto the ground, as Bosch knew he would. Bosch stood over him, waiting for the man to get up so he could hit him again. The man looked up at him, with pain in his eyes.
‘Why did you do that Harry?’ he asked
‘This is a murder investigation, not a popularity contest’ Bosch rasped, breathing heavily.
‘But I’m your partner’ the man on the ground managed to say.
‘Listen’, Bosch replied, hoping the voice of experience would get through before anything else bad happened. ‘I get through partners the way some people get through underwear. And I often leave them in pretty much the same state. The sooner you learn that, the better. Next time, remember that it is black with no sugar, not any kind of fancy coffee pourings’. His partner looked at over at the frappachino with chocolate frosting on the top resting on the hood of the squad car and nodded. ‘I just thought you might fancy a change.’ he said, getting to his feet with difficultly.
‘Now to business’ said Bosh, walking towards the other car. He could tell at once there had been a murder there. The un-natural stillness around the vehicle, the faint, lingering, smell of fresh death, and the axe sticking out of the head of the man in the driver’s seat all pointed to homicide. He paused to open his briefcase and take out a fresh pair of blue crime scene gloves from the bulk pack he carried with him everywhere. “I really must stop wearing these around the house” he thought as he put them on and carefully opened the car door.
Somebody had wanted Harvey Putz to be very dead indeed. Only a small part of the axe blade was still visible, the rest was embedded in his temple. From the angle of the blow Bosh decided that it had been wielded by a left handed female with a club foot. Or perhaps that’s what they wanted him to think, he thought grimly, remembering that this was Los Angeles, where nothing was ever as it seemed, except perhaps the weather, and even that was sometimes changeable.
‘Send the car down to the lab’ he said eventually. ‘Let’s go and see Mrs. Putz and break the bad news to her’ If she didn’t already know he thought to himself grimly.
Mrs. Putz lived in a neighbourhood of fancy cars and even fancier houses. As they drove to her address Bosch looked at the neat suburban lawns, some with children playing in the warm spring sunshine. He wondered what dark secrets each house held, and speculated on the unhappiness that undoubtedly lurked behind each brightly painted door. Mrs. Putz took her time to answer the doorbell. When she did Bosch saw that she had once been truly beautiful. Before the city of Angels did its dirty work and brought her down to its level, before her dreams were crushed and buried by time. And before she painted herself bright blue.
‘Sorry about this’ she said, in lieu of introduction. ‘Smurf convention. How can I help’.
‘I’m afraid I have some bad news’ said Bosch, ‘Your husband has just been murdered’.
‘Have I?’ boomed a male voice from behind the woman. ‘I feel fine at the moment.’
Bosch looked at the address in his notebook. ‘Is this number 82?’ he asked finally.
‘Nope’ said the man, who was also painted the same disturbing shade of blue. ‘They’re next door’.
Bosch apologised and headed back to the car, wondering if he should punch his partner in the face again.
The real Mrs. Putz was much quicker to get to the door. Almost as if she had been expecting them to call by. Bosh told her that her he had some bad news about her husband and she instantly said something that aroused his suspicions. ‘Which one?’ she asked.
That was all it took as far as the investigation was concerned. Time to move things downtown to police headquarters and transfer the conversation an interview room. Bosh used all his experience to get the suspect in the mood to talk. He left her there for half an hour to give her time to stew, gave her a cup of triple strength coffee to loosen her tongue and then turned his chair the other way round when he sat down, like he had seen in the movies.
‘So what do you think happened?’ he asked eventually, trying to get comfortable on the seat.
She wrinkled as much as much of her brow as she could. She was definitely one of the Botox generation. ‘I don’t know’ she said finally. ‘I’ve had a tragic life. My first husband died of eating poisoned mushroom soup and then my second husband died, also from eating poisoned mushroom soup.’
‘Why do you think that your third husband was hit in the head with an axe?’ Bosh asked, moving in for the kill.
‘Well’ she said thoughtfully, ‘For one thing, he wouldn’t eat his soup.’
Bosh sighed, and started on the paperwork. When would people learn that crime doesn’t pay? Unless you write good books about it.
There was a thing in the paper last week about writing really, really, short stories. I thought I’d have a go. With apologies to Arthur C. Clark…..
I asked “How do you manage to avoid being found out?”. The wizard smiled and said “Any sufficiently advanced magic is indistinguishable from technology".
Micro-Mart, a weekly UK magazine about computing has a really good item about XNA and Indie game development in it this week. Starts at page 92. Well worth a read (as is the whole magazine actually).
Of course I’m only really telling you about it it because I’m actually mentioned (and even quoted) in the article.
I’ve been busy with some XNA stuff for the last forever or so. But when I’ve done with the current crop of courseware I’m definitely going to rescue Trip Hazard from his present predicament.
A man from UPS dropped of a big box today. In it were 10 copies of my latest book. One of the many nice things about writing for Microsoft Press is that they give you 10 free ones.
I’ve been through the text and not found any mistakes so far, which is rather nice.
Oh, and for the student who won the Super Geek Word search at the Summer Bash, your prize has now arrived……
If you can’t solve a problem, just go to bed. I should have done that yesterday (although it would have meant I was in bed at 11:30 in the morning I suppose).
Anyhoo, I got up, had breakfast, and then made XNA networking work perfectly.
It turns out that there is something in the WiFi configuration at my house that stops network gameplay from working. I had connected all the devices by wires, but had left the WiFi turned on, which seemed to confuse matters. Replace wireless connections with wires everywhere and everything works.
I now have a working lobby system, proper host and client gameplay, sample programs and a completed Chapter 16. And, since that is the last chapter in the book, I guess that means that I can return to real life and start doing other things that have been piling up a bit. But I think I’ll have some time off the computer for a bit.
The smartest thing I did last year was to give something away. The result of putting the "Famous Yellow C# book" up on the blog has been a huge increase in traffic and thousands of downloads over the last few months.
Loads of people have been in touch saying how useful it has been to them. A number of courses are using it as one of their texts and it has even made its way onto the digital bookshelf of some leading software manufacturers. And of course quite a few new typos have been discovered....
I got a query today from someone who is moving from Java to C# and I remembered that some time ago I wrote some notes about this. I put them up on this site ages ago, but I've tidied the text up, converted it to pdf and put it in a coloured cover (this time orange). You can find the new material alongside the Yellow book on the same site:
I've made some tiny changes to the text, and fixed some typos. It never looks good if you get the words wrong in the introduction.....
I've now taken advantage of the Amazon Connect service to add a little bit of Rob to the pages of Amazon.com. Hapless viewers of information about my books on the Amazon site will also get excerpts from these hallowed pages, as well as a link to my new Amazon blog with book related content.
To celebrate this I've uploaded the second section of Simple Simon, an XNA pattern matching game which has nothing to do with pies, to verysillygames.com.
Well, actually, not here. They are at VerySillyGames. These are actually the PDF files for chapters 1 and 2 that went to the printers. I've also included all the sample code so that you can make yourself a moodlight. I've posted them in celebration of the fact that the book is now being printed, ready for a release towards the end of Feb.
It always helps to read what you've written. Last night I finished the final chapter of the XNA book. And then I read through it. And then I threw it away.
It was very worthy, concise and carefully written. It gave as good an explanation of component based development as you can get into 35 pages. But by gum it was boring.
So I've ditched it. Risking the wrath of my editor I've embarked on a rewrite to make it more interesting. Rather than class diagrams we are going to have "Hide the Controller", "Pell Mell Pelmanism", "Simon Says Party" and "Bread vs. Carrot".
I'll explain the code that makes the programs work, whilst giving people some very silly games to play.
Much more fun.
Learn how to do this....
I've just been sent a question about an article that I seem to have published. I sent it over to the OpenNET people and they put it out in August this year. It is all about Image Processing in C# on a mobile device. If you want to take a look, get the code and get the articles, take a look here:
I've put my first XNA file on VerySillyGames. It is just a silly screen display. The source code will be provided when the book is released. It is a nice example of how you can get really good graphical effects almost by mistake. You can find a runnable version of the program for the PC at www.verysillygames.com. It is optimised for 1280 x 1024 displays on a PC with the XNA framework installed. An Xbox version will be available later.
If you are lucky enough to be a student at Hull you can join the VerySillyGames.com development effort, where we are going to take some of the silly game ideas and try to make them real. This time next year we'll all be millionaires. Oh yes.