Traun wrote:
One problem with OR mapping frameworks is that developers have so many
differing/conflicting requirements that it's almost impossible to create one
that everyone likes. I'm leaning heavily towards making this a separate module
rather than putting it in the core codebase, with the expectation that
community members would create forks that better meet their own requirements.
I've been musing that CBLModel actually serves three different needs:
1. A mutable representation of a document's state that lets you make property
changes in-memory and then save them when ready;
2. Mapping between JSON types to native types, for example between
ISO-8601-format strings and Date objects, or between base64 strings and byte
arrays;
3. Exposing JSON object properties as native language properties, so you can
write "ingot.weight = 17" or at least "ingot.setWeight(17)" instead of
"ingot.setProperty("weight", 17). This also includes integration with property
change notifications like Key-Value-Observing in Cocoa.
Item 3 is obviously very language/platform specific, and it wouldn't make sense
to define it in the API. It's also tricky to implement (at least it was in
Objective-C!) and in the case of Java I'm sure there are a number of
implementations already available.
Item 2 is less platform specific, though the details depend on how the platform
represents types like binary data. It does require extra annotations to specify
what platform class a JSON property should map to/from. Those annotations are
probably language-specific.
But item 1 is pretty cross-platform and generally useful. I think it should be
made part of our API. This would include methods like
setProperty(name, value)
needsSave
save
isNew
setAutosaves
setAttachment
Writing this list is making me think about the commonalities between Model and
the newer class UnsavedRevision. I think there may be opportunities to combine
these somehow; I'll have to think about it more.
--Jens
--
You received this message because you are subscribed to the Google Groups
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/mobile-couchbase/85BF1CFE-2F09-46DA-B66E-76B89E7B67F4%40couchbase.com.
For more options, visit https://groups.google.com/groups/opt_out.