Thursday, November 22, 2007

Oh boy oh boy oh boy (frantically)

.NET Framework 3.5 and Visual Studio 2008 are here! Can't wait to get my hands on this baby! I loved beta 2 and I found it to be very stable, compared to the beta versions of Visual Studio 2005 more than a year ago. I also love where C# is going, particularly the the automatic properties are excellent to reduce the amount of repetetive property access code that makes us more like monkeys typing stuff than programmers.

I also love the extension methods, lambda expressions, anonymous types and object initializers (examples below). But I'd really love to see optional parameters (like in VB.NET) someday. Oh well, the rest is cool enough for now. The only thing I haven't touched yet is Linq, which I'll be doing sometime soon I hope.

  • Extension methods:
    public static bool IsGuid(this string s)
    {
    // TODO: Add logic here, of course.
    return true;
    }

    From then on you can simply do:

    string test = "NotAGuid";
    if (test.IsGuid())
    {
    ....
    }

  • Anonymous types:
    var someObject = new { Name="Lobo", Profession="Sheriff", Salary=15500 },

  • Object initializers:
    Point point = new Point { X=15, Y=14 };

Thursday, September 20, 2007

WiX - The swiss army knife of Windows Installer development

It's been a while since my last (and ironically also first) post on this blog, but, as always, I've been very busy watching my plants grow and stuff. I think I'm just not that kind of blogger.

Today I want to talk a bit about Windows Installer XML, or WiX. This was actually the first ever open-source project that Microsoft (yes, you read that well) started, and they flung it on none other than SourceForge (and started quite a flame war doing that). In fact, it is a pet project of some Office Team and Windows Installer Team members, that got sponsored from higher-up (or something like that).

The concept is: you build an XML file complying to a certain schema, run it through a compiler and linker (named "candle" and "light") and bingo, you got yourself a fresh .MSI file, ready to deploy your precious software.

I'm not going into further technical details (I'll leave that to the other bloggers, especially those who know it way better than me). I'll just leave some hints as to where to look for information if you want to check WiX out.



http://wix.sourceforge.net/ - Home of the toolset
http://www.wixwiki.com/ - MediaWiki containing tons of information, undocumented features, etc.
http://robmensching.com/blog - Blog of (one of) the founder(s) of WiX, Rob Mensching (MSFT)
http://www.joyofsetup.com/ - Blog about WiX, one of the founders too, I presume
http://blogs.msdn.com/jrock - Blog of another WiX contributor
http://installing.blogspot.com/ - Another member of the WiX team, who regretably retired from it

Monday, May 28, 2007

Exception handling in .NET

I've been working in Java the last few weeks, and now I'm starting to remember what I like about that language (I never forgot what I hate about it ). I like the way exception handling is done in Java, particularly the fact that the compiler forces you to handle or re-throw all possible exceptions.

Whereas in .NET you heavily rely on documentation (which is often very incomplete) to know what exceptions could occur (granted, you could use some reflection tool for this), in Java, you instantly know because you can't compile until you handle them in some way, or re-throw them.