|
|
|
|
|
by nostrademons
5040 days ago
|
|
You can get that out of the Gang of Four book. 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. |
|