Giter Club home page Giter Club logo

Comments (4)

jfirebaugh avatar jfirebaugh commented on May 12, 2024

The basic idea here is that the core object graph is immutable. Edit operations are represented as pure functions that take one object graph and return another. The returned graph shares the subgraphs that haven't changed; for any given edit operation this is likely to be a large proportion of the overall structure.

Another way to think about this is as a fine grained copy-on-write strategy. It's also sometimes called a 'functional core, imperative shell' architecture and is popular for obvious reasons in functional programming. Keeping large sections of your code side-effect free tends to have benefits in testability and ease of reasoning.

Undo/redo in this implementation is trivial-- each undo state has a reference to the object graph at that time and undoing is simply resetting the 'current' reference.

In JS, sharing substructure can be done with shared object references and perhaps prototypal sharing via Object.create. I think es5 even has an Object.freeze that can be used to check our work as far as preserving immutability.

The trade off is that for some operations, updating structure in place is probably easier than copying the parts that change (especially if we have lots of parent references that need to be traversed).

from id.

tmcw avatar tmcw commented on May 12, 2024

Okay, so in-between steps from here to there - possibly we should exchange actual object-references in Entity for lists of ids?

And we don't have a real 'parent' element right now - likely the data-storage part of iD.Connection needs to be decoupled from the connection part.

from id.

jfirebaugh avatar jfirebaugh commented on May 12, 2024

Okay, so in-between steps from here to there - possibly we should exchange actual object-references in Entity for lists of ids?

An indirection layer that decouples Entity from parents -- I like it.

And we don't have a real 'parent' element right now - likely the data-storage part of iD.Connection needs to be decoupled from the connection part.

Yep. iD.SceneGraph.

from id.

tmcw avatar tmcw commented on May 12, 2024

This is now implemented, onto particulars like #64

from id.

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.