Git Product home page Git Product logo

Comments (4)

dkubb avatar dkubb commented on June 28, 2024

What would be the use case for non-persistent objects? In a non-persistent environment, would some kind of observer system where you could register code for handling on-change events give you the ability to do the same thing? If you had some way to observe events, then tracking them in a UnitOfWork would be relatively simple.

One other thing I would like to add, is that if we were going to add observers or dirty tracking I would much rather see it being handled outside of the virtus gem. I think virtus almost does as much as it needs to, and I would even propose that the heavy lifting in the coercions system should be extracted.

Virtus, like DataMapper and ActiveRecord/ActiveModel give people this really convenient place to hang extra behaviour from. It's all-too-easy to keep adding more and more behaviour into Virtus. I think everything we do should be considered if it would be possible to add to regular Ruby objects, and if it can, then it should be done first.. then if we need any glue code to make it work with Virtus we can add that second.

from virtus.

namelessjon avatar namelessjon commented on June 28, 2024

You mean like https://github.com/solnic/virtus-dirty_tracking ?

from virtus.

solnic avatar solnic commented on June 28, 2024

@emmanuel As @namelessjon points out I already wrote a plugin for DT although it was just a quick code spike to test a different approach than what we have in dm-core/dm-types at the moment.

I'm still not sure if DT should be a part of virtus or a virtus plugin. As @dkubb writes we're dealing with a non-persistent environment so it's hard to justify why you would need dirty tracking. We briefly talked about it with @dkubb and kind of agreed that DT should be a part of UoW/Session which will not be coupled with Virtus (if I remember correctly).

from virtus.

emmanuel avatar emmanuel commented on June 28, 2024

@namelessjson — Thanks for the pointer!

Between virtus-dirty_tracking and rethinking my approach, I've realized I don't need general-purpose dirty tracking in Virtus.

Also, I agree that dirty-tracking on non-persistent objects is probably not a widespread use-case, and probably shouldn't be in Virtus itself in any case.

from virtus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.