3 ms·
If SRP is akin to water is wet I'm working with newborns. What is so trivial about what to do in a class? Deciding where to put what is one of the hardest part
by croo 7y ago
If SRP is akin to water is wet I'm working with newborns.
What is so trivial about what to do in a class? Deciding where to put what is one of the hardest part of the job...
- cjfd 7y agoWhat to do in a class may not be entirely trivial but also not that complicated. What is trivial is noticing that a class is doing too many things. The problem is actually doing something about it. This seems in many case to be more of a discipline problem than it actually being that hard. I also have seen that people are trying to do too much. When one sees a problem many have the inclination to want to refactor everything at once and also redesign an entire program. A more productive way is to do one small refactoring that solves just one code quality issue at a time. Before you know it you have done 5 or 10 small refactorings and things are starting to look much better. The big refactoring is very likely to make as many things worse as it makes better. The small refactoring has much more chance to have only or mainly positive effects. Sometimes one also has to take a step back and think about in what direction to go with an application. That can be a bit hard, indeed. Even in that case it is much better to do small steps in the right direction that one has envisioned rather than some bing bang rewrite.