Discussion:
Design patterns used in ActiveRecord Library
vinay KP
2018-06-13 12:39:41 UTC
Permalink
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'*
Christian P
2018-06-13 12:41:43 UTC
Permalink
Hi :)

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

Best Regards,

Christian
Post by vinay KP
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'
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
vinay KP
2018-06-13 14:16:00 UTC
Permalink
Thank you Christian.

Is there any other design pattern used in rails ActiveRecord library !!
Post by Christian P
Hi :)
Well certainly the Active Record pattern from which it has its name.
Best Regards,
Christian
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'*
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
Andy Jones
2018-06-13 14:39:46 UTC
Permalink
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-***@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, <***@googlemail.com<mailto:***@googlemail.com>> wrote:
Hi :)

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 <***@gmail.com<mailto:***@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-***@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>


Unsubscribe: <mailto:ruby-talk-***@ruby-lang.org<mailto:ruby-talk-***@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.
Rob Biedenharn
2018-06-13 14:17:58 UTC
Permalink
Post by vinay KP
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
vinay KP
2018-06-13 14:50:41 UTC
Permalink
Hey this helps ☺
Post by vinay KP
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
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
leam hall
2018-06-13 15:06:28 UTC
Permalink
Post by Rob Biedenharn
"PoEAA" is Patterns of Enterprise Application Architecture, by Martin
Fowler, Addison Wesley, 2003
-Rob
Now on my Amazon Wish List, thanks!

Leam

Loading...