May 2008 - Posts

16
Comments

Avoid returning "null" and use the Null Object pattern? by Fredrik N

When I build applications and add methods to return a list of objects, I make it robust. So I always return an instance of the list instead or returning null. The reason is because I like the use of Count and also use foreach. I don't want to add extra...
19
Comments

Avoid "else" as much as possible, use "?:" instead by Fredrik N

To have a 10 week old baby Chihuahua takes a lot of time… the housekeeping is not so easy. I need to go up twice at night to let the little baby boy do his stuff. But it’s really wonderful to have such a small dog in my home, I bought a lot...
10
Comments

Use "constraints" instead of argument validation for int and double etc by Fredrik N

I will still continue with the argument validation track in this post also, I think it's an interesting topic. If you haven't read my earlier posts about this topic, take a look at the following posts on my blog: http://weblogs.asp.net/fredriknormen/archive...
31
Comments

How to validate a method's arguments? by Fredrik N

Yesterday I wrote a post about developers that skip validation of arguments . In this post I will give some example of how validation can be done. There are probably better way to do it, and that is why I need your feedback and comments. The first example...
13
Comments

Lazy Developers? by Fredrik N

When I was out with my new dog (I Chihuahua, wonderful dog), I was thinking about Defensive Programming and Design by Contract. I like to do some refactoring and help other people to write cleaner code etc, not that I’m an expert in the area but I think...
More Posts