|
|
|
|
|
by kuzux
5926 days ago
|
|
First of all, ActiveRecord is not a GoF pattern and its intent is not trying to implement the lacking dynamic features in static languages. Thus, it's not trivial or a source of unneeded complexity in ruby. And so is MVC(Actually, MVC is quite different from the other "Design Patterns" as it covers the entire architecture of the system instead of just a part of it). The point is, most GoF patterns(like factory, builder, strategy, facade etc.) are trivial in "dynamic" languages like ruby and lisp and strictly applying those static-language-origin patterns cause nothing but unneeded complexity in ruby. |
|
The problem with your argument is that the "triviality" of their implementation has nothing to do with whether or not you use them.
This is using the delegate pattern. It's pretty damn trivial to implement. But we are using the delegate pattern. This is a fact. We can do the same for singletons, factories, facades, visitors and strategies. How you implement them does not define whether or not you use them. Whether or not you tell people you use them is what matters, because patterns are about communication, not implementation. If you don't understand this simple concept then you're completely missing the point of design patterns.Yes, you can implement the Adapter pattern in Ruby without doing anything explicit-- that doesn't mean you didn't use the Adapter pattern. This is where denial kicks in. If you say "I don't use strategy patterns, I use DYNAMIC PROGRAMMING!" you're seriously deluding yourself.