|
|
|
|
|
by eluos
5040 days ago
|
|
I feel like higher level organizational stuff could be taught in a codeacademy like format. Just simple lessons for different design patterns: "This is the delegation pattern, we use it to _________"
"This is a singleton method, it's best used for ____" "Create an MVC structure using the strategies we discussed" |
|
The problem is that until you're faced with a real-world software system with real-world problems - and in particular, faced with the consequences of your misuse - you'll be tempted to use them in places where they're not the best solution. It's one thing to read something in a textbook. It's another thing to wrestle with a million-line codebase and try to make sense of it.
Singletons, for instance, almost always turn out to be an antipattern in the long run. You're better off injecting your dependencies explicitly, even if you only think there is one in the whole program. Delegation is used all the time, but can also be overused, and it's important to know when you're better off modifying the original class rather than trying to wrap it with something else.