5 ms·
Not all patterns are equal. Of the GoF patterns, I'd say there are a few that are important to know: factory, observer, and visitor spring to mind. (Then there'
by antareus 16y ago
Not all patterns are equal. Of the GoF patterns, I'd say there are a few that are important to know: factory, observer, and visitor spring to mind. (Then there's the singleton pattern...)
- fragmede 16y agoSpecifically, examine the singleton's usage pattern, and make sure it's not just a convenient excuse for a mud-ball of globals. http://sites.google.com/site/steveyegge2/singleton-considered-stupid http://sites.google.com/site/steveyegge2/singleton-considere...
- GFischer 16y agoOn a followup interview to the GoF, they were in favor of dropping Singleton: http://www.informit.com/articles/printerfriendly.aspx?p=1404056 http://www.informit.com/articles/printerfriendly.aspx?p=1404... "When discussing which patterns to drop, we found that we still love them all. (Not really- I'm in favor of dropping Singleton. Its use is almost always a design smell.)"
- antareus 16y agoYep. The only justifiable use I've run across is internal bookkeeping in a class library across an API that doesn't provide space for context and you need lazy initialization.