Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The foursquare map video shows how the experience with realm is better (and does that well), but it didn't give me any sense of how it's achieving those results. As a developer, I'd love to see an accompanying explanation with details on how the original version works, and how the realm version works.


Absolutely. We didn’t get a chance to clean up the codebase for this app before the launch (it’s actually using an old version of our API that would be confusingly different than what our docs detail) but we’ll try to set up a blogpost about that since I may not be able to do the topic justice in a comment here :)

The short version is that most apps tend to do a query on click, fetch from an API and then cache the results in memory. The Realm version fetches from the API asynchronously in the back, pre-fetching results and writing them form the DB on one thread and reading & displaying them on the map from another. This has a few benefits (& drawbacks). On one hand, you do hit your servers a bit more often at first, and you may actually get so much data in the map that the UI component will start to lag. On the plus side, your data points are cached so you can do a lot less API queries over time (especially for something like Foursquare where users tend to stay in the same area and the dataset of venues doesn’t change that often). You also get better control as a designer or developer, and you can trim down & display relevant datasets on the fly.

To sum up, I’d say the key difference is the availability of a local, concurrent data structure that can easily be updated & read from multiple places (i.e. in a few lines of code if you look at the samples on http://realm.io)


Thank you! So in theory one could do the same thing writing your own threads and using vanilla local storage? But realm is removing all the boilerplate custom code you'd have to write yourself, and making the local side more performant than custom code would be? Is that it in a nutshell?


Yes, that’s the spirit, although I’m sure others would tell you that using Core Data across threads and at high throughput it much easier said than done :) You can achieve anything with almost any storage technology — we just try to let you do it well, easily and in a very performant & maintainable way.


"You can achieve anything with almost any storage technology" - is actually being very generous to quite a few other technologies :-) One of the promising benefits of any technology that can make things run magnitudes faster, is actually that you can do totally new things you previous thought impossible.


I'm looking for exactly this. Thanks for building.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: