|
|
|
|
|
by oh-4-fucks-sake
1662 days ago
|
|
Kotlin has been a godsend when it comes to breaking free of Java dogmatic thinking. The effort to write good functional code is so much less. That's not to say that classes are useless. I try to limit class usage to data structures that do no more than: - Store data - Simple convenience functions that tell me about its state - Side-effect-free mutations (or data massaging) that have no external dependencies other than function params - Simple validation, if there are no external dependencies Everything else goes in a service/function. |
|
One anti-pattern/code smell I often see is finding classes in a service which should just be a functionally pure pipeline (eg. no internal state is managed)