2008-12-30

Code that is easy to read

An important code regarding programming is to write code that is easy to read.

I have many times written code, polished it and then rewritten it to the original text since it was easier to read.  This is considered mature and a good thing.

A month ago I wrote code like this:
    return AllControlsRecursively((Control)form
        ).FindAll( control => (null == control as IDirty) ? false : true
    ).ConvertAll( control => (IDirty)control );

I thought about it for several days and then decided to leave the code as it was.

My reasoning behind this is that once upon a time I had problem understanding Fn in BASIC.  Later * and & in C.  Then I had to learn inheritance, virtual methods and abstract.  Today it is lambda methods, WCF and WPF.

One day one has to decide to get the fingers dirty.  That day is every day.

No comments: