News for hackers. Stuff that matters.
Re:A Dangerous Obsession with Primitives by swanson on Thursday May 31, 2012 @12:49PM (#4048952)
I agree completely about the standard units - I was able to get that right in the production code fortunately. The biggest gain I can see from moving away from the primitive is from a developer's point of view.

By leaving it as an int, I (and the rest of the team) have to know that the value is not suitable for display. Moving to a value object is not the only way to solve this issue; I could have introduced a `CarbsView` that handled the conversions and it would have solved the issue as well. A lot of this kind of stuff just comes down to personal (and team) preferences for designing your app.

Re:A Dangerous Obsession with Primitives by jdlshore on Thursday May 31, 2012 @03:07PM (#4049780)
You might be interested in Ward Cunningham's "Whole Value" pattern [1] which is part of his awesome CHECKS pattern language [2]:

[1] http://c2.com/ppr/checks.html#1

[2] http://c2.com/ppr/checks.html