Entries in Software (75)
Engineering Windows 7 Blog
I have a kind of love-hate relationship with Windows Vista. I love it on some machines and hate it on others. This has a lot to do with the quality (or indeed existence) of device drivers, some manufacturers seem to have got away with sticking "Vista Capable" on things that were definitely not ready for showtime. More like "Vista Culpable".
You can't blame Microsoft for all these problems, but at the end of the day it is their name on the Vista tin and I hope they get tougher with hardware makers in the future. At the moment all eyes are on the upcoming "Windows 7", which is rather cleverly not pitching itself as the answer to all prayers, the wonder of wonders and the operating system to end all operating systems. Merely something that is better than XP and Vista.
As part of the efforts to keep everyone informed of how the development is going the senior managers of the Windows 7 team (and I do mean senior, these folks report directly to the top of Microsoft) have started an Engineering Windows 7 Blog. This is actually quite a worthwhile read. It gives you a nice insight into the way that enormous software products are created, and the conflicting pressures that the teams are exposed to. I also rather like the way that they are using the same blogging tool as I do, the venerable Windows Live Writer. (although I bet they get more hits than I do).
Casting?
I'm writing some new teaching material at the moment. It is going roughly half as fast as I expected, which is about right in my experience.
Anyhoo, I'm doing casting, where you tell the compiler to convert from one type to another by putting the type in front:
int i, j;
float factor = (float) i / j;
I have to cast i to floating point in the sum, otherwise I get an integer division and no fractional part.
In other words, in the above code if the value of i is 1 and the value of j is 2 I want the value of factor (1/2) to be 0.5 (floating point division) rather than 0 (integer division). I get this result by casting i to float in the sum. C# uses floating point division with floating point operands, and everything comes out OK.
This is a standard computing thing, most languages provide support for casting. And I started to wonder why it is called casting? Popular wisdom seems to be that it is related to casting things in a foundry, where you pour liquid metal into a mould of a particular shape. The shape of the mould determines the result of the cast. So by casting you can change one thing into another.
However, I've thought of another way to look at it. You can think of casting as making a movie. You take an actor (Christian Bale) and cast him as a character (Batman). For the duration of the film the character will behave in terms of the role they have been cast into. This even works when we consider stupid casts. In C# you can't do things like cast a string into an integer. In films you can't do things like cast Christian Bale as City Hall. I quite like this way of looking things, but one thing does worry me. Maybe this is the original meaning, and it has taken me years to figure it out.....
Final TechEd Sessions
Today I went to my final two sessions at TechEd 2008, which is rather sad. I really love these conferences. I only have to get a whiff of brand new nylon carpet (which they must use loads of) to be transported into a world of name badges, backpacks and session planning.
The first session I went to was by Jonathon Kagle who was doing something rather uncharacteristic for a Microsoft Product Manager. He was lifting the lid on the next version of his product, .NET Micro Framework 3.0, and even inviting comment and discussion. He has put a really good post onto the Micro Framework blog describing what is coming down the tracks, believe me it is good stuff.
One of the great things about the Micro Framework team is that they are staying true to their roots. Some products get kind of bloaty and feature creepy as they get older. Stuff gets added which might be useful in some contexts, but not all, and the whole thing gets larger and more complex as time goes by until it becomes less useful with each release. I'm a bit worried about C# 3.0 in this respect, stuff has been added which I don't really see the need for.
This is not happening with the Micro Framework. Version 2.5 actually has a smaller memory footprint than 2.0, as the team have got better at squeezing quarts into pint pots. At one point Jonathon said that they had actually figured out how to add generics (a very useful but by no means essential part of C# 2.0) to the framework but that this would have added around 17K to the memory footprint of the platform, with no easy way to disable it.
That amazed me for two reasons. The first is that someone managed to get generic support into the runtime in 17K of code, the second is that 17K is a tiny amount of memory. Less than a full stop in this text is taking up on the screen. However, in the context of a platform that needs to be able to fit into 400K or so, it is big deal, at around a 5% increase. So they left it out. The Micro Framework will now fit onto a single chip microprocessor (a single 9mm square chip). Amazing.This platform just gets better and better.
The next session I went to was about Linq, which is also amazing. The reason you go to TechEd is to find out things that you'd never get hold of any other way. Like PasteXmlasLinq. You can find it in amongst the samples provided with Visual Studio 2008. For me it was C:\Program Files\Microsoft Visual Studio 9.0\Samples\1033\CSharpSamples.zip\LinqSamples\PasteXmlAsLinq.
This does exactly what it says on the tin. it converts a file of XML into the Linq code to produce that XML output. it provides a magical way of taking an existing lump of XML and getting code that will write it. So rather than having to mess around with writing elements and building up the structure the hard way, I can just paste the XML source into Visual Studio had have the code written for me. You have to play with it to believe it. If you have any interest in the use of Xml you should know about Linq. In fact, if you work with data in any way (even if you are not even using a database, just objects) you should know about Linq. Dan Fergus, the MVP who gave the talk did a first rate job of showing the power of Linq, and how you can use it to good effect on a mobile device.
RSS Reader on Very Silly Games
If you've ever wanted your own RSS feed reader written using XNA (and who hasn't), you can now get one at verysillygames.
You Lucky People.
Growing your own game content
There are two ways you can get content into games. You can hand craft and design your entire environment, painstakingly the drawing trees, rocks, grass and sky. Or you can get a program to create all this for you. In the first approach you get exactly what you want, but it takes a while and you have to do all the work yourself. In the second you use carefully managed randomness to get something which "grew" by itself.
First thing this morning we were at a talk by the developers of FarCry 2, which is due for release later this year. They've gone for the programmatic approach to making their jungle. Their trees really grow, based on parameters and design settings from the graphics designers creating the game world world. They don't actually create the scenery when the game runs, instead they use a whole bunch of programs to make it before it is fed into the game. The end result was really impressive, with very realistic trees which wave in the breeze, and even come to bits when the weather hits storm force.
I expect that in the future more games will work this way, as the power of the consoles increases and the increasing amount of detail in the game environments makes it harder to make this stuff by hand.

