Re:Write tests. Not too many. Mostly integration
by quickthrower2 on Friday October 27, 2017 @04:47PM
(#15572102)
To be clear I'm not saying functional is always better. I'm saying there are other possibilities and dogma is bad.
The Haskell community has its dogmas too. And it's fair share of "let's do this simpler" blog posts.
As an aside Haskell has many equivalents of dependency injection and sugars to help and you can "inject all the things" there too.
My point is to think of the problem you are trying to solve, rather than ticking off the SOLID / Martin Fowler etc. tick boxes.
Understanding OO patterns, SOLID etc is a good thing but being prepared to "break the rules" is good IMO too.
Re:Write tests. Not too many. Mostly integration
by cjsuk on Saturday October 28, 2017 @06:03AM
(#15574591)
Breaking the rules is good when appropriate. Problem is those rules are pretty amazingly good. I went through a weird phase of denial and ended up back where I started before I applied the aforementioned rules.
Every exception I have shot myself.
String formats are data so they would be stored as constants so that they are interned. They can be stored in a const class which is a static class with no methods i.e.:
Also string formats for example tend to be owned by the respective objects so you can add overloads to the object to provide certain arbitrary representations. If the translation between an object and the string representation is complex, then you're really serializing it so that should be an abstracted concern.