by cageface · 14y ago · 0 comments
Personally I'm on the fence but when you look at how much boilerplate this Virtus example needs to get rid of the code "smell" you have to wonder if maybe he has a point.
And funnily enough I had the itch to say I'm a primitive obsessive today: http://williamedwardscoder.tumblr.com/post/25916255470/taxon...
It almost feels like a reply to this post, but it was an coincidental bit of pontification.
In OO code I try to create types to represent every concept in my code. It seems overkill at first but I have found in most cases it pays off with reduced duplication. It almost always removes the question of where to put static utilities. Lets say you have a postcode - by creating a Postcode type you can put postcode validation, postcode formatting, etc, directly on that type rather than floating in different parts of your codebase.
Additionally, in a statically typed language it adds type safety - so for example you can't pass a postcode into an address parameter.