Super Secret Project Pt 1

mono-logo-300x261I’ve been working on a super secret project (Christmas present for my wife), the coding for the project has been done in C# using Mono on my Windows Vista laptop, although the plan is to run the code on Linux.

Don’t worry my wife hardly ever reads this site so I doubt she’ll read all this and anyway she’s unlikely to puzzle out what I’m up too, but because I don’t want her to know what I’m building I’m going to stick to describing the technology and tools I’m using and show snippets of code but try not give it all away.

The reason for picking C# + Mono is that I know C# already, ?I code all day long in it so I don’t have to learn something new. I must say I’m actually very impressed by Mono so far, almost all the C# stuff I know about just works in Mono, obviously the more Microsoft/Windows specific stuff might have problems, but I haven’t run across anything yet but thats because I’m not using much of that stuff.

One of my biggest problems is that I don’t know the Linux libraries as well as I would like so I spend alot of time trying to puzzle things out. At the moment I’m doing alot of image handling using Gdk (via Gtk#) and drawing using Cairo, there don’t appear to be a huge number of C# examples of these so I’ve ended up using the C/C++/Python examples on the net and translating those to C# which obviously complicates matters further. (My C/C++ & Python are a bit rusty)

Cairo is actually very impressive and allows you to easily draw vector graphics on a screen which is awesome for doing custom menu’s and other UI stuff. Mixing Cairo with images (jpeg’s in particular) is a little hard though and has taken some puzzling out to get right. I’m still not happy with the speed of the loading of the images but I’ll sort that out a little later when I’ve got more of the code done and I’m able to do some proper benchmarking and profiling to see exactly what is slowing things down.

Premature optimisation can waste a lot of time on things that don’t need any optimisation in the first place, also optimising code without knowing if its working or if it even needs it is also a waste of time, which is why I’m holding off on it for the moment and rather spending the time finishing the code.

One thing that I have enjoyed using is MonoDevelop, Mono’s IDE its?similar?to Visual Studio which is nice and its seems to feel a little snappier that VS 2008 which is what you want in an IDE. Unfortunately I haven’t been able to find a fullscreen mode which is something I miss when I’m coding, but otherwise its a very nice IDE.