I'm a fan of Object Oriented programming (OOP), but don't use it much. The challenge is that nearly always the state and functionality gets mashed together, so it's hard to modify either one. Example: OO can be harder to test because it's not obvious which sequences of init / update functions are needed before you can actually test the resulting object.
Functional Programming (FP) makes adaptation and testing much easier.
Occasionally I'll do a "class" that's just a bunch of static methods, like a mini-library of related functions. Each function accepts state, and returns it. No side effects.
Rich Hickey's classic talk
Simple Made Easy
really brought the ideas together for me.
In response to Hesitation to Write Actual OOP on Reddit.
Top comments (0)