4 ms·
For me it’s the following: - going for polymorphic classes instead of a few switches can cause bad coupling of knowledge. ( For example, instead of a switch on
by strulovich 5y ago
For me it’s the following:
- going for polymorphic classes instead of a few switches can cause bad coupling of knowledge. (
For example, instead of a switch on what to log in module A and the same for module B, now you’re mixing code from these two modules due to a shared constant.
Sometimes these polymorphic classes make sense, but my experience is that it’s a minority, and it’s better to err on the side of some simple enums.
Also note that Uncle Bob in Clean Code pretty much directly opposes in one of the chapters about logic and data separation (can’t find the chapter right now since I don’t have the book anymore)