I’m having problems understanding why people prefer to implement the
ActiveRecord pattern in dynamic languages. Of course it is very
convenient if you don’t have to worry about what type is your column,
but dynamic languages are more than that.
some aspects of BASIC. A variable can change its type based on its
Ruby is a strongly, dynamically typed language. Strong because nothing
ever changes its type, and dynamic because you can add features to
Do åval, higher-order functions, runtime alteration of object, closures,
etc. matter in the implementation of the ActiveRecord pattern…?
You are asking how a “Domain Specific Language” can integrate with a
host language of a different type. Ruby is procedural, and SQL is
declarative. The answer is you use the host language’s features to
write a declarative DSL. ‘select foo from bar’ becomes
Bar.find(:select => :foo)
Both expressions are declarative, but the Ruby one can now enjoy the
benefits of the rest of Ruby.