Optimise Last
/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".
Rob Miles on the web. Also available in Real Life (tm)
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.....
This was the question:
Can I make some C# that compiles and contains these two statements? What type are d and x?
d = null;
d += x;
I wrote the question as a result of my surprise that you could do this with delegate types. In other words, you could add things to a null delegate.
However, it turns out that it works with other things too, including strings. It seems that a += overload (which is how we get the behaviour that allows us to use += to append strings and add handlers to delegates) is also smart enough to make a new object if it turns out that the original is null. Which makes very good sense I suppose.
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."
Went to a lovely wedding today. Best of luck to David and Emily.
How do you call the finalizer in a base class?
Why do we need the finally clause in a try construction? Can’t code to be run after the code in a try clause just be put straight after the end of the catch?
Why does the exclusive-or (^) operator not have a short circuit version
"When would a value type be stored on the heap?" And no, the answer doesn't involve boxing.
OK. I'm going to post a few C# Quick Questions. They're things that have come up as I'm writing the book. Today's question:
Can I make some C# that compiles and contains these two statements? What type are d and x?
d = null;
d += x;
Â
Don't expect much sense from me for the next few weeks. I'm going to spending all available hours writing pages for the latest book.
When we had our awful struggle to get to the airport a couple of weeks ago one of the things that sustained me was the knowledge that at least it wouldn't be this bad on the way back.
Ha.
Turns out that Mother Nature (tm) had arranged another show of strength just as we got back into the country, with lots of thick snow and the prospect of blocked motorways.
Fortunately, with jetlag you don't let such trifling things as icy roads worry you. All you want to do is sleep. So we got a train and a taxi back to our snowbound car, loaded it up and shot onto the M62 before fate noticed. And we got home just fine.
We've had a lovely time away. All the better for not having to be at home.
Flying home today. In a window seat with legroom. Double win!
Today is our last full day in this lovely place. It's gone by really quickly. And we are going to try really hard to come back here again sometime.
We keep hearing reports of the horrible weather in England. Well, turns out its rather nice here. We went off to the University shopping mall today to pick up some presents and stuff. And the blossom is out.
Hmm. The Starbucks Reserve Roastery in Seattle might be a cynical piece of coffee merchandising masquerading as a place where they make and roast overpriced coffee, but we do really like it there. And the coffee is very nice too.
It's hard to avoid the Seattle Museum of Pop Culture. For one thing the monorail actually drives through the middle of the building on the way to the Space Needle. For another it has the most amazing architecture. We've never got round to taking a proper look in the place. Until today.
To be honest I wasn't expecting that much, perhaps a few guitars in glass cases. But there was much more than that, including a really good Star Trek exhibition and stuff that kept us occupied for just about half of the day. They even had a David Bowie film where he actually mentioned Hull.
This is a Star Trek console. Really.
After our does of culture we headed back to Capitol Hill to meet up with a bunch of ex-Hull students who are now Microsoft folk. Quite a few of them got their big break as part of Imagine Cup teams. All doing very well, lots of great chat and lovely to see them all. They look so grown up. Probably because they are. And we got a bunch of recommendations for places to visit during our final days here.
I think this is my favourite picture of the trip so far. I took it on the ferry as we headed out to Bainbridge Island. Lovely place.
Another day. More amazing weather. Apparently temperatures records are on the verge of being broken (They are back home in England too, but in an entirely less pleasant way).
Anyhoo, whenever I'm in Seattle I go up the Space Needed. Always have. Always will. They're in the middle of a great big refurbishment exercise at the moment, replacing the sides of the viewing platform with enormous slabs of glass. This meant that we didn't get to walk all the way round the outside as we normally like to, but even so the view was rather nice, and you can actually see the mountain, which is nice.
Shurey shome mishtake I can hear you thinking. But no. Today we went up to one of my other favourite places in the world, Pike Place Market. And the sun was beating down.
Today's Seattle travel tip: If you get the chance, have the Lava Cake. It's amazing.
Rob Miles is technology author and educator who spent many years as a lecturer in Computer Science at the University of Hull. He is also a Microsoft Developer Technologies MVP. He is into technology, teaching and photography. He is the author of the World Famous C# Yellow Book and almost as handsome as he thinks he is.