Design patterns used in ActiveRecord Library

Hi Folks,

Just came across the question regarding what are the different design
patterns used in ActiveRecord library,

As of I know ORM is one of the design pattern used,

Is there any other design pattern used in ActiveRecord library?

···

--
Thanks with Regards,

Vinay KP
*'Work speaks louder than words'*

Hi :slight_smile:

Well certainly the Active Record pattern from which it has its name.

Best Regards,

Christian

···

Am 13.06.2018 um 14:39 schrieb vinay KP <vinaykp3@gmail.com>:

Hi Folks,

Just came across the question regarding what are the different design patterns used in ActiveRecord library,

As of I know ORM is one of the design pattern used,

Is there any other design pattern used in ActiveRecord library?

--
Thanks with Regards,

Vinay KP
'Work speaks louder than words'

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk&gt;

Thank you Christian.

Is there any other design pattern used in rails ActiveRecord library !!

···

On Wed 13 Jun, 2018, 6:12 PM Christian P, <christian.paling@googlemail.com> wrote:

Hi :slight_smile:

Well certainly the Active Record pattern from which it has its name.

Best Regards,

Christian

Am 13.06.2018 um 14:39 schrieb vinay KP <vinaykp3@gmail.com>:

Hi Folks,

Just came across the question regarding what are the different design
patterns used in ActiveRecord library,

As of I know ORM is one of the design pattern used,

Is there any other design pattern used in ActiveRecord library?

--
Thanks with Regards,

Vinay KP
*'Work speaks louder than words'*

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe
<ruby-talk-request@ruby-lang.org?subject=unsubscribe>>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk&gt;

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk&gt;

Oh, yes, there are others as you suspect. This is one of the reasons I found it incredibly difficult to implement a system in Rails using Domain Driven Design principles. I'm going to give you the answer rather than saying "This is the list for Ruby, not for Rails" since you can use ActiveRecord separately from Rails.

Active Record (PoEAA, 160) — (which is an example of a Domain Model (PoEAA, 116))
Association Table Mapping (PoEAA, 248) — has_many through (and the deprecated has_and_belongs_to_many)
Foreign Key Mapping (PoEAA, 236) — belongs_to
Identity Field (PoEAA, 216) — the ubiquitous `id`
Lazy Load (PoEAA, 200) — the behavior that can lead to 1+N issues which is overcome using eager loading
Query Object (PoEAA, 316) — technically, this is what ActiveRelation does now for ActiveRecord
Repository (PoEAA, 322) — schema and the various database adapters
Single Table Inheritance (PoEAA, 278) — for ActiveRecord subclasses using the `type` column

There are a few others that could be argued, but those are more than enough. (Either 8 or 9 depending on how you want to count Domain Model.)

"PoEAA" is Patterns of Enterprise Application Architecture, by Martin Fowler, Addison Wesley, 2003

-Rob

···

On 2018-Jun-13, at 08:39 , vinay KP <vinaykp3@gmail.com> wrote:

Hi Folks,

Just came across the question regarding what are the different design patterns used in ActiveRecord library,

As of I know ORM is one of the design pattern used,

Is there any other design pattern used in ActiveRecord library?

--
Thanks with Regards,

Vinay KP
'Work speaks louder than words'

IIRC I have heard Sean Griffin (on the podcast The Bike Shed) claim that, in fact, ActiveRecord doesn’t really follow the Active Record pattern (any more?), and at this point it’s quite hard to say what pattern it does follow.

Sean is one of the maintainers of ActiveRecord, so presumably he would know…

···

From: ruby-talk [mailto:ruby-talk-bounces@ruby-lang.org] On Behalf Of vinay KP
Sent: 13 June 2018 15:16
To: Ruby users
Subject: Re: Design patterns used in ActiveRecord Library

Thank you Christian.

Is there any other design pattern used in rails ActiveRecord library !!
On Wed 13 Jun, 2018, 6:12 PM Christian P, <christian.paling@googlemail.com<mailto:christian.paling@googlemail.com>> wrote:
Hi :slight_smile:

Well certainly the Active Record pattern from which it has its name.

Best Regards,

Christian

Am 13.06.2018 um 14:39 schrieb vinay KP <vinaykp3@gmail.com<mailto:vinaykp3@gmail.com>>:

Hi Folks,

Just came across the question regarding what are the different design patterns used in ActiveRecord library,

As of I know ORM is one of the design pattern used,

Is there any other design pattern used in ActiveRecord library?

--
Thanks with Regards,

Vinay KP
'Work speaks louder than words'

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org<mailto:ruby-talk-request@ruby-lang.org>?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>

Click here to view Company Information and Confidentiality Notice.<http://www.jameshall.co.uk/index.php/small-print/email-disclaimer>

Please note that we have updated our privacy policy in line with new data protection regulations. Please refer to our website to view the ways in which we handle your data.

Hey this helps :smiling_face:

···

On Wed 13 Jun, 2018, 7:48 PM Rob Biedenharn, <rob.biedenharn@gmail.com> wrote:

On 2018-Jun-13, at 08:39 , vinay KP <vinaykp3@gmail.com> wrote:

Hi Folks,

Just came across the question regarding what are the different design
patterns used in ActiveRecord library,

As of I know ORM is one of the design pattern used,

Is there any other design pattern used in ActiveRecord library?

--
Thanks with Regards,

Vinay KP
*'Work speaks louder than words'*

Oh, yes, there are others as you suspect. This is one of the reasons I
found it incredibly difficult to implement a system in Rails using Domain
Driven Design principles. I'm going to give you the answer rather than
saying "This is the list for Ruby, not for Rails" since you can use
ActiveRecord separately from Rails.

Active Record (PoEAA, 160) — (which is an example of a Domain Model
(PoEAA, 116))
Association Table Mapping (PoEAA, 248) — has_many through (and the
deprecated has_and_belongs_to_many)
Foreign Key Mapping (PoEAA, 236) — belongs_to
Identity Field (PoEAA, 216) — the ubiquitous `id`
Lazy Load (PoEAA, 200) — the behavior that can lead to 1+N issues which is
overcome using eager loading
Query Object (PoEAA, 316) — technically, this is what ActiveRelation does
now for ActiveRecord
Repository (PoEAA, 322) — schema and the various database adapters
Single Table Inheritance (PoEAA, 278) — for ActiveRecord subclasses using
the `type` column

There are a few others that could be argued, but those are more than
enough. (Either 8 or 9 depending on how you want to count Domain Model.)

"PoEAA" is Patterns of Enterprise Application Architecture, by Martin
Fowler, Addison Wesley, 2003

-Rob

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk&gt;

"PoEAA" is Patterns of Enterprise Application Architecture, by Martin
Fowler, Addison Wesley, 2003

-Rob

Now on my Amazon Wish List, thanks!

Leam

···

On Wed 13 Jun, 2018, 7:48 PM Rob Biedenharn, <rob.biedenharn@gmail.com> > wrote: