|
|
|
|
|
by notsosimple
6177 days ago
|
|
Using the abstractions of loose coupling at early stages of development tends to add more complexity than you gain, violate YAGNI, and give you the wrong things later. Unless you've already developed exactly that kind of software before you'll just make a lot of mistakes. You have to go through a refactoring process at every stage if you want to achieve a big system with loose coupling. |
|
Need to write something to a file, fine; just do it. Need to do it again in another class; time to extract common behavior.
You should also have an idea of what components will likely need this kind of abstracted behavior and preempt the wasted time writing something twice by just doing it the first time.
All of this comes with experience and the best way to gain experience is by doing it. Avoid trying to keep everything loosely coupled because it adds too much complexity is a great way to introduce tons of code smells and maintainability/extensibility issues.