Saturday 28 July 2007

80 characters long line is gone

I remember that not so long ago everyone was saying that a line of code should not be longer then 80 characters. The problem with this approach is that it leads you to cryptic method/class/variable names because of the 80 characters hard limit. I could justify that rule back in the epoch of 15 inch CRT monitors because there are not too many things more annoying then constant scrolling from right to left and left to right to be able to read a piece of code. But even nowadays there are people who would stick with that rule which doesn't make sense for me because it's just a waste of space of your 17/19/20 or 24 inch LCD monitor. 24 inch is a really great one and 2 of them are just brilliant :).

Friday 27 July 2007

Joel Spolsky will come to Dublin

Great news. Joel Spolsky will (more then likely) come to Dublin to promote FogBugz. I don't use FogBugz personally but I've been following Joel's blog for more then one year and I can always learn something from him. It's not about the technology itself. It's rather about how the technology is related to our real life and how we can take advantage of it :).

Friday 20 July 2007

Dynamic nature of C# I bet you don't know :)

Yesterday I read a blog post that meant to discuss possible naming conventions for LINQ but it turned out that the most interesting part of it was something completely different. Namely, Krzysztof Cwalina wrote that we don't have to implement IEnumerable and IEnumerator to be able to iterate through an object(collection) using foreach statement. It's enough that a class exposes GetEnumerator() method. It doesn't have to implement IEnumerable interface. At the beginning I thought that it's just another example of syntactic sugar and that the C# compiler generates implicit IEnumerable declaration on our behalf. But then I opened ildasm.exe and saw that that's not the case. IEnumerable wasn't there. That's it. Have a look at the code snippet and screen shot below to check it out.
The bottom line is that I learn every day and .NET doesn't stop surprising me which is fun :).
EDIT: I've modified the image because it looked horrible.

using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
class Program
    static void Main(string[] args)
        FakeEnumerableClass enumerable = new FakeEnumerableClass();

        foreach (object o in enumerable)

            //works perfectly fine :)
class FakeEnumerableClass
    public FakeEnumerator GetEnumerator()
        return new FakeEnumerator();
public class FakeEnumerator
    public bool MoveNext()
        return false;

    public object Current
            return null;
class RealEnumberableClass : IEnumerable
    public IEnumerator GetEnumerator()
        throw new Exception("The method or operation is not implemented.");


Tuesday 17 July 2007

DTrace - an interesting tracing solution

I've just come across an interesting article about DTrace which is a tracing solution developed by SUN. I still need to dive into it deeper but it's key features are:
  • zero overhead when it's turned off
  • C based query language that allows you to query available probes
  • it allows you to analyze the whole system at very low(kernel level operations) and/or high level (number of garbage collections)
  • it gathers probes only when it's safe for the system
  • it's built-in into Solaris 10 and will be part of the next operating system from Apple called Leopard
It's been awarded many times and it really looks great because it provides very precise picture of the system.

Sunday 8 July 2007

Model View Controller ?? Model View Presenter

Jean Paul Boodhoo explains what the Model View Presenter design pattern is and what's the difference between it and Model View Controller. I've never been a big fun of MVC because it tightly couples View and Model.

Great book: C# via CLR

As I mentioned earlier I always wanted to read C# via CLR by Jeffrey Richter. Finally I got it a few months ago and while I was sick I read it. I think it's just brilliant because:
  • I like the way Jeffery explains problems.He is strict and precise whenever it's needed but no more.
  • As far as I know he is not a Microsoft employee which lets him express criticism of everything that deserves it.
  • It reveals lots of things that you will never be aware of unless you start thinking in an illogical way. Unfortunately CLR and/or C# not always behave in a predictable way.
  • The books touches nearly all the .NET internals that you can come across during your everyday job as long as you don't work on compilers and runtimes :).

Thursday 5 July 2007

You always struggle with formatting strings?

Check this out. It's a great crib sheet and I've even downloaded it to my machine. Just in case it disappears from the Internet :).

Monday 2 July 2007

Rough but enough explanation of WS-* standards

Michele Leroux Bustamante presents a rather short article about WS-* standards. It's great because it allows you to see the big picture and how all of these standards fit together. There are so many of them that it's easy to get lost if you don't deal with them directly on daily basis.