in Search

cruizer

aspiring to free and open the mind of .NET developers

May 2008 - Posts

  • JP Hamilton on testing WinForms

    JP Hamilton has posted a brief blog post on how he unit tests WinForms. Looks nifty, especially if you use a pattern like Model-View-Presenter for your forms. His rationale is that if you keep on testing only the presenter and mocking out the view in your unit tests, your forms code still gets zero code coverage.

    He makes his extension methods available for download in the post. If you're using only VS 2005 or .NET 2.0, it's a simple matter to take out the "this" in the method signatures and just use them as static methods instead of cooler-looking extension methods. It is important to note though that these are especially useful if you use the MVP pattern; otherwise your forms would have functionality that this tool won't be able to test or cover.

  • Silverlight 2 Unit Testing: slides and code

    It was my first time to join a community event in Singapore during yesterday's Heroes Community Launch and it was a blast!  It was also cool to see that of nine presentors during the event, three of us are Pinoys.  I definitely am looking forward to meeting more of the community people soon.

    First-time jitters got to me though. Towards the end of my demonstration, I encountered a problem which I didn't encounter during my personal run-through while preparing for it.  And when I saw the "15 minutes left" sign from the organisers I knew I was in trouble! Stick out tongue Fortunately the attendees were patient and didn't walk out on me, ha ha.

    Anyway, as promised, here are the slides and demo code. The problem I encountered was because I was trying to trigger a UI event indirectly from the data bound to the control. I'll make sure I'll never do that again! Download the links below:

    Maybe next time I'll imitate Pom and put in some video (or series of screenshots -- maybe less than 213 screens, huh?) as backup just in case I flub the demo. Or I can do some cut-n-pasting in the background to ensure I'm not putting in typos and stuff (does anybody have a nice free tool that can do this?). I guess I'm getting old.
  • Speaking about Silverlight 2 and Unit Testing

    I will be speaking tomorrow at the Heroes Community Launch 2008 here in Singapore with my favourite (boring?!) topic...Unit Testing!  Only this time it's about the testing framework that comes with Silverlight 2's beta release.

    Kinda excited and nervous at the same time, since it'll be my first time to participate in a community event since arriving in Singapore over a year ago.  I'll be posting my slides and demo code tomorrow after the event.

  • Design patterns are NOT from hell

    I saw this somewhere in my daily reading list (I religiously browse my Google Reader at the start of the day).

    I thought to myself that the blog author probably had negative experiences with programmers or architect types who place too much emphasis on design patterns.  I agree that people who give too much importance (or "cool factor") on design patterns will probably see the trees but not the forest.

    Personally, I agree with the author that the problem has to be understood before a solution can be applied.  It was said that there was supposed to be this app whose developers wanted to implement all 23 GoF design patterns -- of what use is that?!  It's like putting the cart before the horse.  One has to feel the pain of a particular problem before a solution can become suitable and be appreciated.  That's why I believe in refactoring to patterns.

    But that doesn't make me conclude that design patterns are from hell.  Just because one thing can be used negatively by some doesn't mean it's evil -- see for example the internet, or TV.  I had to eat my words not too long ago when I said that enums are evil. Stick out tongue I see design patterns as useful in enabling developers to share a common design vocabulary ("you plan to use the state pattern there? that's too complicated, why not use strategy instead...") and it helps me identify possible solutions to design problems.  I wouldn't be proud of my code just because it implements this and that pattern -- I would be proud if it meets user expectations and runs relatively bug-free!