What is Active Record - design pattern or module?
Basically what's the 开发者_如何学运维difference between design pattern, module and some other terms we use.
That's quite a difficult question to answer.
It depends, basically.
Active Record is both, it's a design pattern in the traditional sense, described by Martin Fowler in Patterns of Enterprise Application Architecture. But, ActiveRecord (note no space) could be classed as a module, since it's an implementation of the Active Record design pattern.
Just to give a different perspective, ActiveRecord:Ruby - Hibernate:Java. Both are ORM Frameworks and solve the recurring problem of persisting to database and converting data from RDBMS to OO Models. So, you can call it both a Design Pattern & Module or more specifically ORM.
精彩评论