3 ms·
> Then don’t. Or only do it after everything is done and you have explored the domain. I think this really hits the nail on the head. Classes are the ultimate
by Spivak 7y ago
> Then don’t. Or only do it after everything is done and you have explored the domain.
I think this really hits the nail on the head. Classes are the ultimate DRY tool but it seems like much of our industry is realizing that it's rare for any project outside of small self-contained libraries to reach the point where you know enough about your problem domain to ever start meaningfully factoring code out like this.
Instead having "here are the different shapes of state you might see floating around" and "here are some functions that can do things with certain shapes" becomes really powerful when you need to be nimble with features/requirements. Encapsulation is beautiful when the scope is specified completely up front but it I've found it leads to more complicated code and mental overhead because you create a world where the least cost path to doing what you want does a run around with types.