Posts tagged microsoft

Framework Design Guidelines

Published on 20 February 2009 at 09:19 GMT by Nicholas Lativy Discuss

A few months ago I finished reading the second edition of Brad Abrams and Krzysztof Cwalina's excellent Framework Design Guidelines book. I just love how this book condenses the lessons learned in building the .Net Framework in areas such as design patterns and API usability into a set of easy to follow guidelines annotated by various luminaries from Microsoft and beyond.

For me reading the book provided valuable insight into .Net, reinforced my knowledge of design patterns and provided lots of useful advice on software engineering in general. As an example one guideline that I recall as I write this is do prefer protected accessibility over public accessibility for virtual members''. This leads to the suggestion of applying the template method pattern as follows:

1
2
3
4
5
6
7
8
9
public Control {
    public void SetBounds(...)
    {
        ...
        SetBoundsCore(...);
    }

    protected virtual void SetBoundsCore(...) { ... }
}

The book also makes the valuable point that this pattern allows the base class to enforce that overloads remain semantically consistent by defining them in the base class in terms of one core virtual method that can then be overriden.

On the usability front a comment from Krzysztof has stuck with me since reading the book:

The number of customers that will use your API is inversely proportional to the number of new statements in your simple scenarios.

This reinforces the book's suggestion of a scenario driven design approach where we are encouraged to write code for common scenarios before designing the API and run user studies early on with other developers writing code exercising these main scenarios.

Finally Framework Design Guidelines introduced me to FxCop which does the great job of encoding the guidelines in a static analysis tool thus catching any accidental slips in our APIs early on. This makes following a large number of the guidelines incredibly easy.

As Miguel de Icaza asserts in the foreword: this book will help you become a better programmer.

iPhone 3G

Published on 13 July 2008 at 21:51 BST by Nicholas Lativy Discuss

My contract with Orange ends this month which happily coincides with the launch of the iPhone 3G on Friday. I decided to pop down to the local O2 (the exclusive iPhone carrier in the UK) store and pick one up. Somewhat naively I expected it to be “busy” but in actual fact I ended up queueing for well over and hour and after finally getting my phone it was not activated for a further day and a half! While the queueing is perhaps normal for such things I am rather disappointed in O2 in that my first experience with them is this somewhat botched launch.

The phone however is my favourite new toy and a welcome replacement for my buggy as hell Nokia N73. I’m greatly impressed with the email and calendaring which make use of the Microsoft Exchange server in my office, notifying me of mail and meeting invites as they arrive, and the web browser is easy to use and actually makes it worthwhile to use the web on the go. The bundled applications are good but the selection of extra ones on the “App Store” seems a little limited at the moment. Hopefully that will improve with time.

For someone who has always been frustrated with the quality of mobile devices the iPhone just seems incredibly polished down to the little details. For instance today I noticed that the screen blanks when I have the phone to my ear during a call but then immediately comes back on when I move the handset away from my ear. The rendering of SMS messages as a conversation and the way the calculator becomes a scientific one when I change the orientation of the screen all add up to a pleasant user experience. I also appreciate the “visual voicemail”, as I believe it’s called, which lets me browse the messages that have been left and rewind while listening to one; finally I have escaped those horrible “press one for new messages” interfaces.