Persistence ignorance in Rails. ActiveRecord 6 and beyond!

已查看 102 次
跳至第一个未读帖子

Laerti Papa

未读,
2020年2月3日 22:39:472020/2/3
收件人 Ruby on Rails: Core
Hi guys,

thank you for your effort so far and for your contribution.  

I've been playing around with DDD concepts lately and trying to apply them to Rails. It's been super annoying and frustrating trying to fight the framework to apply them especially when it comes to **Persistence ignorance**. It would be nice if the framework supported that out of the box either with a DSL likeish framework or configuration files. Also to have a more safe typing approach regarding data attributes I have to either implement it myself or use existing libraries like dry-rb or something.   

I was curious why so many years we don't decouple active record into two pieces. One to keep it as is. Second, allow users to decouple entities and data access objects and have a framework that will support them in better domain modeling without having to write much-supporting code to do so. 

I would appreciate any thoughts.

Best
LP




William T. Nelson

未读,
2020年2月9日 22:24:112020/2/9
收件人 Ruby on Rails: Core
Building this capability into Rails would be contrary to the current project philosophy, so don't expect it soon.

However, Ryan Bigg has been working on similar features recently. See his reports here: https://ryanbigg.com/2020/02/rom-and-dry-showcase-part-1

Laerti Papa

未读,
2020年2月10日 14:14:322020/2/10
收件人 Ruby on Rails: Core
Thank you for your reply, 

I understand that it is against the active record philosophy, it would be nice though to support both patterns and let the developer choose. I end up writing a lot of code every time I use AR only as the persistence on top of a repo instance. 


Thanks again.
LP

Pedro Fernandes Steimbruch

未读,
2020年2月18日 09:28:322020/2/18
收件人 rubyonra...@googlegroups.com
Just my two cents here.

Do not waste time trying to apply code concepts (factories, repositories, etc.) from the Eric Evans book, if you think you are DDD only by using those, you are doing it wrong.
DDD is much more about Crunching Knowledge, Ubiquitous Language, Bounded Contexts and converging these to express your domain on your model always evolving to a deeper insight.

DDD is about tackling complexity on your software. Isn't writing a lot of code just to implement *Persistence Ignorance* increasing the complexity of what you have?

Enjoy what ActiveRecord gives you in a healthy way.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-core/ec331d07-d81a-45eb-a9e8-eb43728be750%40googlegroups.com.

Kasper Hansen

未读,
2020年2月18日 12:07:332020/2/18
收件人 rubyonra...@googlegroups.com
Well said, Pedro. I don’t think there’s much interest in adding the repository pattern to Active Record.

--
Kasper
On 18 Feb 2020, 15.28 +0100, Pedro Fernandes Steimbruch <pedrofst...@gmail.com>, wrote:
Just my two cents here.

Do not waste time trying to apply code concepts (factories, repositories, etc.) from the Eric Evans book, if you think you are DDD only by using those, you are doing it wrong.
DDD is much more about Crunching Knowledge, Ubiquitous Language, Bounded Contexts and converging these to express your domain on your model always evolving to a deeper insight.

DDD is about tackling complexity on your software. Isn't writing a lot of code just to implement *Persistence Ignorance* increasing the complexity of what you have?

Enjoy what ActiveRecord gives you in a healthy way.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-co...@googlegroups.com.

Laerti Papa

未读,
2020年2月21日 14:25:082020/2/21
收件人 Ruby on Rails: Core
I don't think that using tactical patterns in DDD should be avoided. I agree that AR is awesome but expressing the domain when you involve persistence you have conflicts. As well said evolving your model should not affect my persistence layer. 

Thanks for the feedback both much appreciated.

Best
LP

On Tuesday, February 18, 2020 at 6:07:33 PM UTC+1, Kasper Timm Hansen wrote:
Well said, Pedro. I don’t think there’s much interest in adding the repository pattern to Active Record.

--
Kasper
On 18 Feb 2020, 15.28 +0100, Pedro Fernandes Steimbruch <pedrofst...@gmail.com>, wrote:
Just my two cents here.

Do not waste time trying to apply code concepts (factories, repositories, etc.) from the Eric Evans book, if you think you are DDD only by using those, you are doing it wrong.
DDD is much more about Crunching Knowledge, Ubiquitous Language, Bounded Contexts and converging these to express your domain on your model always evolving to a deeper insight.

DDD is about tackling complexity on your software. Isn't writing a lot of code just to implement *Persistence Ignorance* increasing the complexity of what you have?

Enjoy what ActiveRecord gives you in a healthy way.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonra...@googlegroups.com.
On Mon, Feb 10, 2020 at 4:14 PM Laerti Papa <laerti...@gmail.com> wrote:
Thank you for your reply, 

I understand that it is against the active record philosophy, it would be nice though to support both patterns and let the developer choose. I end up writing a lot of code every time I use AR only as the persistence on top of a repo instance. 


Thanks again.
LP


On Monday, February 10, 2020 at 4:24:11 AM UTC+1, William T. Nelson wrote:
Building this capability into Rails would be contrary to the current project philosophy, so don't expect it soon.

However, Ryan Bigg has been working on similar features recently. See his reports here: https://ryanbigg.com/2020/02/rom-and-dry-showcase-part-1

On Monday, February 3, 2020 at 9:39:47 PM UTC-6, Laerti Papa wrote:
Hi guys,

thank you for your effort so far and for your contribution.  

I've been playing around with DDD concepts lately and trying to apply them to Rails. It's been super annoying and frustrating trying to fight the framework to apply them especially when it comes to **Persistence ignorance**. It would be nice if the framework supported that out of the box either with a DSL likeish framework or configuration files. Also to have a more safe typing approach regarding data attributes I have to either implement it myself or use existing libraries like dry-rb or something.   

I was curious why so many years we don't decouple active record into two pieces. One to keep it as is. Second, allow users to decouple entities and data access objects and have a framework that will support them in better domain modeling without having to write much-supporting code to do so. 

I would appreciate any thoughts.

Best
LP




--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonra...@googlegroups.com.
回复全部
回复作者
转发
0 个新帖子