News for hackers. Stuff that matters.
Re:Realm is a mobile database: an alternative to SQLite and ... by azinman2 on Monday February 06, 2017 @03:56PM (#13583820)
I've had some nasty bugs happen in production with Realm, as is expected with any new database store. Newer version seem better in this regard, but if you read the changelogs you might be shocked at how fundamental the fixes can be.

It also times some time getting use to -- my biggest gripe is that the notification API won't tell you what actually has been modified, just that an object changed _somehow_. That makes a pure reactive design quite hard if those changes have non-trivial consequences, and not just a quick re-rendering of some element on the screen.

Looking forward to finding time to go back to SQLite where I can actually do complicated queries, relational joins, triggers, etc on a fast and mature code base.

Re:Realm is a mobile database: an alternative to SQLite and ... by pixelman32 on Monday February 06, 2017 @06:37PM (#13585428)
I've also experienced some production issues with Realm. I've been using it for an App Store mac app since before 1.0 (Quite risky, yes, but it's for a simple use case). In the worst cases, it caused data corruption for end users.

Over the past year, it's become a lot more stable and I've seen far fewer user reported issues with it. As others have pointed out, it's also a very nice API and very simple to get set up.

The Realm team has also been very helpful in my experience and usually have responded to my support requests almost immediately, despite the fact I'm using their free product and not the DB-as-a-service they recently shipped.

Re:Realm is a mobile database: an alternative to SQLite and ... by BoorishBears on Monday February 06, 2017 @08:10PM (#13586039)
I wouldn't take exception to it's stability if they didn't call it ACID compliant. I was about to use it in a setting where failure to be ACID complaint would be fairly expensive (but not safety critical). In just 24hrs of testing I managed to end up with a corrupt DB. In the same tests SQLite's been running for almost a year without corruption...
Re:Realm is a mobile database: an alternative to SQLite and ... by BoorishBears on Monday February 06, 2017 @04:04PM (#13583908)
SQLBrite adds reactivity to SQLite (https://github.com/square/sqlbrite)

But in general I rely on RxJava to provide fine grained notifications. For example (psudeocode):

    someUserQueryThatReturnsObservable()
      .map(user->user.firstName)
      .distinct()
      .subscribe(newFirstName->newFirstName)
It's messy because you end up having to repeat everything after map for every property, not really an ideal solution
Re:Realm is a mobile database: an alternative to SQLite and ... by unsoundInput on Monday February 06, 2017 @05:46PM (#13585038)
I started using sqlbrite (in combination with sqldelight) and stopped treating the database as an object store. Instead I create an interface for the data the customer needs (e.g. an item interface for elements in a listview), write a select query whose result fulfills this interface, and let the rest happen via databinding. This seems to work fine up to a couple of thousand of elements for me.
Re:Realm is a mobile database: an alternative to SQLite and ... by bigfish24 on Monday February 06, 2017 @06:48PM (#13585522)
I am assuming this is coming from an Android point of view? If not, we do support passing what changed in the notifications for all the other platforms now. We call it "collection notifications" for example with JS: https://realm.io/docs/javascript/latest/#collection-notifica...

Android support is coming in a matter of weeks, so stay tuned.

Re:Realm is a mobile database: an alternative to SQLite and ... by azinman2 on Monday February 06, 2017 @06:58PM (#13585611)
I'm on iOS and I haven't upgraded to the latest as we're still on swift 2.3.

The docs you sent me seem to suggest that it's still just indices for objects modified. Where are the property changes?

Re:Realm is a mobile database: an alternative to SQLite and ... by bigfish24 on Monday February 06, 2017 @07:04PM (#13585653)
Property changes are only supported with individual object notifications that were introduced with Realm 2.4. We haven't planned to add property changes in the collection notifications yet, but will definitely note the request!
Re:Realm is a mobile database: an alternative to SQLite and ... by andrewbarba on Monday February 06, 2017 @04:16PM (#13584080)
Re: your gripe, this is solved in their latest release with object-level notifications: https://realm.io/news/realm-objc-swift-2.4/

I personally think they did an awesome job with the change api

Re:Realm is a mobile database: an alternative to SQLite and ... by azinman2 on Monday February 06, 2017 @04:23PM (#13584175)
Except that's on an individual object -- existing KVO functionality re-invented. I want it on an entire collection... basically their existing API except give me more than an index.