> I am wondering what the benefits of using CouchDB are over using
> Apple's own Core Data, is it faster, is it better at doing queries, is
> it easier to code queries, or is better for native data storage?
Zardon,
The virtues of CouchDB are extolled elsewhere. I'm restricting myself to CouchDB v Core Data.
Core Data is an Object Graph with a persistence mechanism. It is an attempt to make model data storage as natural a process for Objective-C programmers as possible. At this, it largely succeeds.
What is the big difference between CD and CouchDB? Schema flexibility. CD requires a compile-time schema definition. CouchDB, as a document store, allows the schema to evolve without having to revise the application. The second difference is CouchDB can naturally replicate its data to another CouchDB instance. CD does not have any concept of data replication.
Anon,
Andrew
____________________________________
Andrew W. Donoho
Donoho Design Group, L.L.C.
a...@DDG.com, +1 (512) 750-7596, twitter.com/adonoho
"When you can't imagine how things are going to change,
that doesn't mean that nothing will change.
It means that things will change in ways that are unimaginable."
Bruce Sterling, January 02, 2009
Core Data is really good for what it does on the device. That last
phrase is the key: Core Data doesn't know that the rest of the world
exists, which is kind of strange for a data persistence layer on a
mobile device in 2011.
I haven't embedded Couchbase in an app yet, but I have several apps
that use Couch for cloud data storage. For me, the promise of
Couchbase on iOS is the ability to maintain a shared dataset in the
cloud, and then replicate it down to Couchbase on the phone for better
performance when cellular data speeds aren't good enough, or when the
device is offline. Let your users make changes, and replicate those
changes back up so everyone else can see them the next time they sync.
Core Data has no concept of this, so you have to build your own web
service (or use something like Couch) to manage it all, and you have
to roll your own sync to and from the device. With Couch on the
device, you can just use replication.
Another use case I'm looking at is syncing private data between
devices: you have a Universal app, and your users expect to edit on
the phone and have the change appear on their iPad. Or they add an
item in a desktop app at work, and expect it to be on the iPhone on
their evening commute, and available in their desktop app at home
after dinner.
If you are using Core Data, you could use the same model files for
your iOS apps and your OS X desktop application, which allows for some
code re-use, but that's about the extent of it. You have isolated data
stores on each device, and again, you have to code a solution to
manage changes between all of them. Doing this well is non-trivial.
(The story of Cultured Code and Things cloud-sync may or may not be a
good example, depending on your perspective.)
Using master-to-master replication with Couch seems like it could be a
great option here. (I think this is similar to how Ubuntu uses Couch,
but I could be wrong.)
Customers expect "edit once, magically appear everywhere" and Couch
can help make that magic happen with a lot less work than Core Data
alone.
And as Andrew mentioned, schema flexibility is a big plus for Couch,
too, especially during the development phase.
Schema migrations in Core Data can be tricky. Even when they go well,
they eat up your time. And if you are using SQLite for storage with
Core Data, Apple considers their SQLite schema for Core Data 'private'
and subject to change, and suggests that you write Objective-C code to
instantiate and save all objects to your store. The actual schema is
fairly well reverse-engineered, but building your own store with tools
of your choice might not be future proof. Bottom line: It's usually a
lot easier to import, restructure and move data around with Couch and
JSON than it is with Core Data and Objective-C.
Matt
I think CoreData can exist over the top of CouchDB and that's what I do in AnythingBucket (a simple CouchDB/CoreData based Geo tracker app). CoreData provides. At the moment I don't think it's possible to make this CoreData "just work" on top of CouchDB but this might be possible in the future (in fact pretty sure it can work like this on 10.7 - and there's hope this ability will come to iOS eventually).
Jon.
The CouchDB guys may or may not agree with me here though.
Sent from my iPad
Not really. As I mentioned in my last post CouchDB doesn't provide the niceties you'd want. While you could use CouchBase as a purely local solution it wouldn't buy you much. And the costs (memory usage, risks of using an extremely immature project, project complexity, possible risks with Apple Store acceptance) outweigh the benefits in my opinion. If you need CoreData my advice would be to just use CoreData. CouchDB's reason for being is the cloud.
Yes, however reducing footprint is likely to be the next thing once
functionality is sorted (reading Chris' mind here).
> - Does user need to install erlang to be able to run iOS Couchbase?
Not directly, but it is included in the app bundle.
> - Does the same thing (Mobile couchbase) also exists in the Android and
> Blackberry world?
Yes for android - I'm not sure of the status. Hopefully somebody else
can cover that.
A+
Dave
On 21 May 2011 18:06, Joshua Partogi <joshua....@gmail.com> wrote:
> Hi Guys,
> Just like Zardon, I am also interested to exploit Mobile couchbase for our
> next mobile apps.
> My question is:
> - Do we need to embed the whole iOS Couchbase with our apps? If so, how big
> the size would it be? I don't want to end up distributing a large size apps
> just because we need to embed iOS Couchbase in our apps.Yes, however reducing footprint is likely to be the next thing once
functionality is sorted (reading Chris' mind here).
> - Does user need to install erlang to be able to run iOS Couchbase?
Not directly, but it is included in the app bundle.
> - Does the same thing (Mobile couchbase) also exists in the Android and
> Blackberry world?Yes for android - I'm not sure of the status. Hopefully somebody else
can cover that.A+
Dave