
Realm 1.0 - porsager
https://realm.io/news/realm-1.0/
======
spotman
Realm is awesome! I have been using it for a year now in a large production
iOS/swift app with great success.

Great job on the recent additions to the more fine grain notifications, with
this I was recently able to reduce my own code, simplify and increase
performance!

Core data is good and a powerful weapon, and certainly educational to learn
its approach and how to use it effectively. I sometimes ponder if going
through the that first has made me a more competent iOS developer.

Realm is the right tool for the job for me in most use cases. Don't see myself
switching back anytime soon, keep up the good work!

~~~
sametmax
What's the benefit of using realm instead of Sqlite + an ORM ?

~~~
bigfish24
Here are a couple we highlight:

1\. Since Realm is not a relational database with an ORM, we don't run into
the impedance mismatch. Relationships are first-class citizens.

2\. Realm uses a zero-copy architecture. Objects and collections are lazy
loaded offering benefits to both memory use and speed.

~~~
sametmax
Thank you.

------
jchrisa
Congrats to the team for expanding their platform support. I'm still
interested to see what sync looks like.

If you are interested in mobile databases, you'd do well to evaluate Cocuhbase
Mobile, which is 100% open source, available for most mobile platforms, and
includes bulletproof synchronization with its open source secure cloud server.

More info here
[http://developer.couchbase.com/mobile/](http://developer.couchbase.com/mobile/)

~~~
opendomain
I do not think Realm has sync. Using couchbase for mobile development
definitely makes it easy to get data from the device into the cloud (and
back). The only complaint is it feels more geared to enterprise to have the
best infrastructure for large set of users, but I guess that goes with the
data size.

Do you have any comparison metrics of Couchbase and Realm or other mobile
Databases?

------
ysleepy
Can someone elaborate how this differs from JPA/Hibernate style ORMs ?

The examples look suspiciously similar.

EDIT: So i easily believe that it's nicer than CoreData, and I see that there
is lots of potential to reduce an ORMs complexity by assuming a single Writer
(Process of App), but the core Problem seems to be exactly the same. - And the
solution looks also very familiar. -> Proxy Objects, Bytecode manipulation to
intercept field access etc.

Does it handle the uncool cases of ORMs better? \- Unloading of state when
thousands/millions of objects are touched once

\- Collection fetching of large collections, iterators/chunks

\- OrderedList O(N) index update for non-append inserts

\- What happens to invalidated (deleted) objects? are collections updated
live?

\- Does is handle cascades explicitly/implicitly/not ?

I'm quite interested in this, since it may solve real pain problems.

~~~
ChrMelchior
Realm is not a relational database, but an Object database.

This means that we totally avoid the impedance mismatch when you try to map
Java references to tables. In Realm, relationships are first-class citizens.

This is also one of the reasons that we can provide lazy-loading for
everything. With ORM's the API might look the same on the surface, but you
usually run into problems when trying to access foreign collections.

API wise we try to stay as close to normal Java as possible, which is probably
why it looks similar to what Hibernate offers.

Regarding specific features.

\- Realm uses zero-copy as much as possible, so collections in Java point
directly to the underlying data (i.e takes almost no space on the Java heap).

\- Collections are live updated yes.

\- Deleted objects could potentially be accessed after they are deleted, but
there is API methods for avoiding that.

\- Cascading deletes is not supported yet, but really high on our TODO and
definitely a feature we want to add.

~~~
ysleepy
Sorry my edit was after your answer.

Yeah well, literally ORM has relational in it, but you probably know what I
mean.

So it behaves more like a graph store? \- Can I query bottom up / through
collections ?

I'm really interested in the technical details and their implications.

~~~
ChrMelchior
Yes, thinking about the internal structure as a graph will give you the right
ideas.

We don't have support for collecting objects bottom up yet, bu t it is tracked
here: [https://github.com/realm/realm-
java/issues/2232](https://github.com/realm/realm-java/issues/2232)

Realm Swift/Objective C has support for bi-directional references and we are
adding that to Realm Java shortly as well: [https://github.com/realm/realm-
java/issues/607](https://github.com/realm/realm-java/issues/607) ..That will
also help when doing bottom-up queries.

If you want to know more about the internal details. There is some
talks/articles here that might interest you:

\- [https://realm.io/news/threading-deep-
dive/](https://realm.io/news/threading-deep-dive/)

\- [https://realm.io/news/jp-simard-realm-core-database-
engine/](https://realm.io/news/jp-simard-realm-core-database-engine/)

\-
[https://www.youtube.com/watch?v=vGFInG96KH4](https://www.youtube.com/watch?v=vGFInG96KH4)

~~~
ysleepy
Thanks !

I'm reading through the docs and it seems very appealing. Especially the
Observability of changes. I assume this works well because it is contained in
one Process.

~~~
ChrMelchior
No, the change notifications will work across processes as well. Realm Java
still need to add multi-process support though
([https://github.com/realm/realm-
java/issues/1091](https://github.com/realm/realm-java/issues/1091)), but it is
working in Realm Swift/Objective C.

------
flipgimble
Realm has excellent marketing, but being a closed source third party SDK
disqualifies it as anything I would recommend for my company to use.

I've had to deal with enough pain from closed source libraries from the likes
of Google and others. Closed-source prevents me from adopting a new platform
until the vendor gets around to porting it, and only if it fits with their
strategy. Also a middleware-only company is liable to be bought out, and then
closed. Example: Parse.

~~~
yAak
What part of it is closed source?

[https://github.com/realm/realm-cocoa](https://github.com/realm/realm-cocoa)
[https://github.com/realm/realm-java](https://github.com/realm/realm-java)
[https://github.com/realm/realm-js](https://github.com/realm/realm-js)
[https://github.com/realm/realm-dotnet](https://github.com/realm/realm-dotnet)

Edit: Apparently not the guts of it, my bad :(

~~~
mahyarm
The core C++ part. They plan to open source it later, but who knows what will
happen in the meantime.

~~~
mwcampbell
Where did you read that they plan to open-source it later?

~~~
mahyarm
FAQ time:

I see references to a “core” in the code, what is that? The core is referring
to our internal C++ storage engine. It is not currently open-source but we do
plan on open-sourcing it also under the Apache 2.0 license once we’ve had a
chance to clean it up, rename it, and finalize major features inside of it. In
the meantime, its binary releases are made available under the Realm Core
(TightDB) Binary License.

[https://realm.io/docs/objc/latest/#faq](https://realm.io/docs/objc/latest/#faq)

~~~
mwcampbell
Ah, OK. I always assumed that the core was closed-source for business reasons.

~~~
SandyAndyPerth
It's a LOT of work to open-source something which has been evolving at a huge
pace and is as complex as the Realm core.

Even just announcing the work of the Xamarin C# team that I'm on got some
complaints from the public about this representing a "loss of focus". So yes,
you could say there was a "business reason" of protecting the core team whilst
they got to 1.0.

If you look at the C++ portions included in most of the Realm open source you
can see we have moved code gradually into the open source codebase. There's
not yet an official C++ API either for the same reason - it would lock in too
many decisions and tie up the team. (disclaimer - these are opinions and
observations from a remote contractor, not Realm management!)

~~~
flipgimble
I don't believe that complexity or size of code really affects the difficulty
of open sourcing a project. Its more likely the culture and daily development
practices that are difficult to change, but probably not as difficult as the
business strategy we're all wondering about.

------
mwcampbell
What exactly is Realm's business model? The core is closed-source, but as far
as I can tell, it's free for application developers to use.

~~~
timanglade
As detailed on our pricing page[0] Realm makes money by selling Enterprise
products & services. If you’re interested, you can always reach us at
info@realm.io

[0]: [https://realm.io/pricing/](https://realm.io/pricing/)

------
creager
Congrats on 1.0!

+1 for not just telling us what Realm is, but for _showing_ us (with inline
code), and for supporting React Native :)

------
tokenizerrr
What about using realm Java outside of Android? The readme says:

> This repository holds the source code for the Java version of Realm, which
> currently runs only on Android.

I'm interested in trying this on the desktop (windows/linux/mac), but that
doesn't seem possible? Wonder what makes it android only.

~~~
mwcampbell
The core of Realm is closed-source, and Realm only provides builds for iOS, OS
X, tvOS, and Android.

~~~
tokenizerrr
Oh, missed that bit.

------
timanglade
VP Product at Realm here. Thanks to everyone on HN for the support over the
years! We came out of YC in Summer 11 and it’s been a fantastic ride growing
over the past few years. Would love to hear y’alls thoughts on what we should
add next. Is there any reason why you’d still use SQLite?

~~~
fermigier
1\. "Realm is not an ORM, and is not built on top of SQLite. Instead we’ve
built a full database for mobile app developers, one that uses native objects
that are dynamically mapped to a full, custom database engine (not just a key-
value store)."

=> Why not use the terms "object database" or "OODBMS", then ?

2\. "Realm supports Java, Objective-C, React Native, Swift and Xamarin."

=> "React Native" is not a language, why not just state that you support
"JavaScript" ?

3\. What about Python ?

~~~
mwcampbell
> 3\. What about Python ?

Is there any practical way to use Python for mobile apps? Realm is only
targeting mobile platforms AFAIK.

~~~
fermigier
Some people are active in this domain, see:
[https://www.python.org/community/sigs/current/mobile-
sig/](https://www.python.org/community/sigs/current/mobile-sig/) and
[https://mail.python.org/pipermail/mobile-
sig/](https://mail.python.org/pipermail/mobile-sig/)

Two approaches that seem to work (or to be promising) are Kivy
([https://kivy.org/](https://kivy.org/)) for cross-platform and PyBee / VOC
([http://pybee.org/voc/](http://pybee.org/voc/)) for Android.

------
sytse
Congrats on the release, glad you made it to 1.0. And well done sticking to
semantic versioning and going to 0.100 before doing the 1.0.

------
hanief
Yes. I've been using Realm for my work app. In my opinion it's easier than
Core Data, and certainly much easier than bare SQLite.

I've expected it to cross 1.0 after 0.99 but it keeps going on to more than
0.101. So, congrats on finishing the milestone.

One request though: what about grouping functionality?

~~~
jpsim
(JP from Realm here) Yes, that's something we're hoping to add! We're tracking
that feature as #3384[0]. Still needs some design work though.

[0]: [https://github.com/realm/realm-
cocoa/issues/3384](https://github.com/realm/realm-cocoa/issues/3384)

------
molikto
Please don't say it is faster than SQLite anymore.
[http://kpgalligan.tumblr.com/post/133281929963/my-talk-at-
dr...](http://kpgalligan.tumblr.com/post/133281929963/my-talk-at-droidcon-uk)

~~~
ChrMelchior
With all respect to Kevins benchmarks. There are many ways to measure
performance and most of them are wrong. If you see the talk he even admit that
his numbers changed quite a bit between each benchmark run.

From what we see, we are generally faster than raw SQLite on all metrics
except when doing batch inserts. This is primarily an API problem, because our
low-level access is 200-300% faster than SQLite (which Kevin also mentions).
It is something we are well aware of and plan to address quickly after 1.0:
[https://github.com/realm/realm-
java/issues/1684](https://github.com/realm/realm-java/issues/1684)

Our own numbers are here: [http://www.slideshare.net/ChristianMelchior/realm-
building-a...](http://www.slideshare.net/ChristianMelchior/realm-building-a-
mobile-database#25) including a link to the code

------
fabianshallari
my main frustration with realm is that the design for the rxjava support is
not that great. I can't use custom schedulers when fetching data and almost
always end up mapping realm data objects to Pojo immutable entities generated
with Autovalue, thus giving up the lazy loading speedup (since I have to copy
all the data). also sometimes the asObservable() method returns empty
collections a few times before returning the whole collection EVEN IF FILTERED
WITH .isLoaded() and is wayyy too much spammy (it redelivers to subscribers a
whole lot more times than when the underlying model is written to), therefore
I have to debounce the stream with 1 second to save the adapter from rebinding
the whole dataset again.

------
donnfelker
Been using Realm in all of my Android projects for the last 8+ months. It has
now become my defacto mobile database for all my mobile projects. It's that
easy to use. Gets out of the way and lets me focus on business problems, not
bit shifting problems.

------
dcosson
Just curious, why is there no Realm support for web & mobile web using
localstorage? It seems like that could be useful, to re-use your model/data
tier between react native and a react web app.

~~~
appden
That would be really neat, but the core technology of Realm is written in
native code. Somebody in the community could certainly create a Realm-like API
for web local storage. If you (or anyone else reading this) is interested in
building it, I would suggest building it on top of localForage
([https://github.com/mozilla/localforage](https://github.com/mozilla/localforage)),
and definitely hit me up if you'd like to further discuss implementation
details!

------
zimbatm
As I understand it Realm is an Object database. It's similar to the GemStone
Smalltalk database in that regard but only local to the device.

How does Realm tackle data syncing between devices ?

~~~
timanglade
You can just use whatever you like to sync at the moment: REST, Parse,
Firebase, carrier pigeons… We are interested in adding it and the feature
request is tracked here: [https://github.com/realm/realm-
cocoa/issues/913](https://github.com/realm/realm-cocoa/issues/913) We’d love
to hear about specific use-cases y’all have in mind in that thread.

------
justsaysmthng
Does Realm support NSFetchedResultsController-like functionality ?

I'm currently starting work on an iOS application which will display large
lists of data which will be constantly updated on a background thread...

I wonder how Realm implements lazy-loading / faulting of off-screen items .. ?

~~~
astigsen
Yes, see [https://realm.io/docs/swift/latest/#collection-
notifications](https://realm.io/docs/swift/latest/#collection-notifications)
for details on how you can watch query results for changes to update your
TableViews.

All elements of Realm (queries, lists and even individual properties on
objects) are lazy loaded. That is an intrinsic property of the zero-copy
architecture where objects directly reflect what is in the underlying
database.

~~~
justsaysmthng
Thank you, I'm going to try and use it in my project then.

------
DenisM
So, not a whole lot is known durability. Any pointers?

[https://www.google.com/search?q=site%3Arealm.io%20durability...](https://www.google.com/search?q=site%3Arealm.io%20durability&rct=j)

------
dabit3
If you're into React Native, check out Realm. Great experience for me so far.

------
hackim
I'm using Realm for my React Native project it awesome! Thanks Realm team.

~~~
tbolt
Likewise. Really making me happy so far.

Is react native going to be 1.0 shortly? Or is that not included in this
release?

~~~
ckurose
Chris from Realm here - we're definitely working toward 1.0 for React Native
as well, but it won't be part of this release :).

------
hoodoof
Well I read the front page of the website which says that Realm is a
replacement for sqlite and coredata.

I didn't gain any understanding though of why they needed to be replaced and
how Realm is different.

------
coldcode
Is having to use the Realm objects in the same thread they were created it
much of a burden on how you use it? Having not tried it yet I wondered about
that limitation.

~~~
jpsim
(JP from Realm here)

It certainly forces you to think about threading (which is a good thing IMO).
I just responded to a similar comment[0], and there are always our docs on
threading[1] which I'd encourage you to read.

[0]:
[https://news.ycombinator.com/item?id=11771558](https://news.ycombinator.com/item?id=11771558)
[1]:
[https://realm.io/docs/swift/latest#threading](https://realm.io/docs/swift/latest#threading)

------
warmwaffles
Really wish there was a C interface to tinker with.

------
dayanruben
Realm's team, congrats for the good work.

------
mikeike
I use Realm for React Native and it's awesome! Congrats to the Realm Team.
great work!

------
shadinay
Awesome! Congrats to Realm and their entire team!

------
BaconJuice
Will we see some NativeScript support?

~~~
appden
We're considering it depending on the level of interest. You can vote on it in
this GitHub issue: [https://github.com/realm/realm-
js/issues/428](https://github.com/realm/realm-js/issues/428)

------
findjashua
for react native, how does realm compare to relay?

~~~
appden
Realm is for local storage on the device, whereas Relay is really for getting
data from cloud storage.

------
foo123456
The "What is Realm?" paragraph begins with "Realm is not an ORM".

Jesus Christ, that was the very first line.

~~~
ysleepy
Well thats the reason I asked to elaborate on how they are different.

~~~
foo123456
One is an ORM, the other is not. If you want I can explain to you the
difference between airplanes and horses, u interested?

------
betimsl
In order to use this, you have to have know SQLite, given that, why would I
spend time to learn something that wraps around it?

Most of the time you do a insert/update/view, something that a simple helper
class would do well.

~~~
sangnoir
> In order to use this, you have to have know SQLite, given that, why would I
> spend time to learn _something that wraps around it?_

The linked article explicitly says it's not a wrapper around SQLite - what
gave you that impression?

> Realm is not an ORM, and is _not built on top of SQLite._ Instead we’ve
> built a full database for mobile app developers, one that uses native
> objects that are dynamically mapped to a full, custom database engine (not
> just a key-value store)

