Just wanted to note that I've just been elected into the board of the Norwegian .NET User Group (NNUG) - Oslo.
I'm looking forward to the experience! Hopefully something good will come out of it for you too :)
Friday, September 26, 2008
NNUG Oslo
Tuesday, September 23, 2008
Beware the enum-compilation!
I was recently made aware of a real eye-opener when it comes to how enums are compiled by the c# compiler.
When you compile a c# project, each enum is internally replaced with the corresponding value of the enum. What that mean is that in the IL code the reference to the enum is replaced by the integer value in the enum.
This could give you a problem if you redefine an enum that is used across multiple dlls. Say you have an enum with two values, and you decide to switch their place in the enum definition. If you only compile the dll with the enum definition, the other dll will work the opposite of what is fairly natural to expect!
The enum tip of the day is thus:
- Always specify the value of the enum in the defintion rather than using the default order.
- Never replace a value with another, always add new values to a number higher than the current top
- Always follow the points above. Would you like try to debug a patch creating that problem?
Thursday, September 18, 2008
Definition of good quality solutions
Recently I heard a new definition for what a good quality solution should be like:
- robust and stable
- easily maintainable
- good performance
- good user experience
If asked I would have listed this somewhat differently, but my point is rather:
This must be the most obvious thing. Could this possibly be necessary to say?
(Note: Was not directed at me :))
Could someone possibly try to create ..
- nonrobust
- unstable
- hard to maintain
- lousy performance
- poor user experience
I doubt it.
You won't always be able to do it - there's always compromises (maintainability+performance, time-contraints, etc), but still.
There's not really much point to this post. I just wanted to make a point. Or something.
Wednesday, September 17, 2008
Boo... Worth the time?
One of my colleagues, Tore Vestues, has recently sparked an interest in Boo internally.
Boo is, for those who don't know it, just another .NET language. I like Ayendes definition:
Boo is an object oriented, statically typed language for the common language runtime with a Python inspired syntax and focused on language and compiler extensibility.
Today we had a voluntary Boo-night, which meant about 15 developers having a go at Boo for a while. Good stuff :)
First of all, I really don't know Boo (at least not yet), but there's one thing I totally dig about it - the way anything and everything can be put together at compile-time. You got code generation at compile-time, without all the runtime hazards of standard code-generation. It really just rocks compared to the everyday c#-code.
For instance you can define what a singleton is one place, then just add a [singleton]-attribute around your class to define for the compiler to compile this as a singleton. Or a better example Tore came up with: INotifyPropertyChanged. Anyone like writing that code over and over again? How sweet is it to get to write it once, and use it over and over again? I can think of lot's of examples were I keep rewriting annoying boring code, which isn't just boring to write, it provokes errors, and it makes the code much harder to read than a declarative style possibly could.
So what's the negative things then?
First of all, Boo is a separate .NET language. It will compile to IL-code, but you need to use it fully in it's own assembly. You can of course not mix and match. In other words, you won't get C#-code with Boo compile-time code-generation. Unfortunately :(
Number 1 once again. This is the biggest problem the way I see it. The language in itself seems really cool. But what's the chances for mainstream development? Will you implement part of your application in Boo, or everything? Can you justify the cost of learning up all developers on the project to the Boo way of doing things? (I don't know, so I'm really just asking questions) Is it mature enough or has proper tool-support? (not yet)
I guess most of the initial issues with Boo comes from the fact that it's just new (of sorts) - with the standard problems you have when something is new. There is not enough documention, tool-support, or followers.
But isn't many of the concepts I just mentioned possible in C# for instance? It is, to some extent. You have AOP-support through for instance PostSharp, which does it's magic after your code has compiled. Now I don't really know just how big a difference these two approaches make (Can someone please educate me?), but since it gets in after you compile, at least all your code needs to compile already - which removes the possibility for defining your own keywords for instance, like "print" or something.
In conclusion, Boo seems exciting, but I need more time to conclude properly. Is it worth the time? Might be. I know I definitely need to have a closer look.