GithubHelp home page GithubHelp logo

datalayer's People

Contributors

aleksanderk avatar davidevincenzi avatar nfgrilo avatar

Stargazers

 avatar

Watchers

 avatar  avatar

datalayer's Issues

Nested relationship

DetailViewController.swift:31

    var detailItem: EventType? {
        didSet {
            if let detail = detailItem {
                userItem = dataLayer?.userOfEvent(detail)
            } else {
                userItem = nil
            }
            configureView()
        }
    }

This can become very "nested" when trying to get through several relationships level (eg. topic.documents.first?.revision). We'll also end up with lots of these methods.
And we lose the main benefit of having an ORM behind.

I was thinking wether we can have a solution where the struct itself provides the relationship. But then we would have to have a reference to the managed object inside the struct (eg. the NSManagedObjectID).

Thread safety

@nfgrilo @aleksanderk I added the User entity and its relationship with the Event. About thread safety, do you have an example where this may be an issue?

Thread safety in Structs

Just wanted to note that thread safety imo is really something we need to live without. Even in the Struct solution, we need to be careful when updating the entities, as this can lead to crashes, as you can see in the latest commit in the data_layer_with_structs branch: 7d57bc0

Basically with Structs we're safe when reading properties, but not when writing them.
With Protocols, this is never safe. I tried to workaround it with this commit 550a720 and it works, you can read and write in background threads. But it requires lots of boilerplate code, so I don't know if it's worth the effort.

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.