Recently I stumled upon a blog post which asked if design patterns are useless. Are they useless? In fact the classic GOF design patterns (COMPOSITE, STRATEGY, MEMEMTO, etc) seem to be useless for developing Ruby on Rails web applications. I haven’t seem them in many Ruby on Rails application so far, and I haven’t use them either, although I used them frequently in windows applications.
- win applications: objects represent GUI objects
- web applications: objects represent database tables
In the first case, if objects represent GUI objects, then the GOF patterns are more useful than the eaa patterns. In the second case, if objects represent database tables, then the eaa patterns of Martin Fowler are much more useful than the classic GOF patterns, esp. the object-relational patterns. Objects representing database tables are often “flat” and use inheritance only in exceptional cases, due to the common Object-Relational impedance mismatch problems: essential OOP concepts as inheritance are not supported by relational database systems.