Hacker News new | ask | show | jobs
by cyclinghacker 5113 days ago
I think it just comes down to differences between the OO approach vs the functional approach.

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.