Are there, in the canonical Gang of Four list, any design patterns that you often find misused, misunderstood or overused (other than the highly debated Singleton)? In other wor
Factory Patterns...
I was parachuted into a project before where every single MyObject
in the system had an equivalent MyObjectFactory
for generating new instances. There was no concept of abstraction or extended classes... just plain old ClassX & ClassXFactory.
And no-one could explain why... "It was just the way things had always been done"
The observer pattern is pretty useless in C# because it has events.
Actually, what I see most often is the lack of use of an appropriate pattern. Typical scenario: me: "Hey, module A already has a piece of code that loops through a set of objects and performs database operation X on them, why didn't you reuse that code?" coder: "well, but I had to do operation Y on those objects." me: "what about using refactoring it to use the Command pattern to execute X or Y as appropriate?"
I once saw usage of the Subject-Observer pattern get out of hand. It was implemented between processes using the database to persistently store the Subject. Because of the sheer number of updates to the subject, and the number of observers, the load on the database was tremendous, and caused an unforeseen system-wide slowdown.