[Qt-qml] QtJsonDb QML API review
denis.dzyubenko at nokia.com
denis.dzyubenko at nokia.com
Tue Nov 22 13:00:37 CET 2011
Hi Alan!
On Nov 22, 2011, at 12:38 AM, Alan Alpert wrote:
> On Wed, 16 Nov 2011 22:33:15 ext denis.dzyubenko at nokia.com wrote:
>> Hi guys,
>>
>> Here in QtJsonDb project we want to improve our existing QML api and hence
>> ask for a review of our api proposal.
>>
>> The documentation can be found here:
>> http://chaos.troll.no/~denis/qtjsondb-qml-api
>
> There are some little things I noticed, but without overview docs it's hard to
> understand the real purpose of the API and so difficult to review it at a high
> level.
yeah, I agree that is not trivial to review api without overview documentation, which we currently do not have, unfortunately.
>
> Why QtAddon::JsonDb instead of QtJsonDb (for JsonDbConnection)?
right, that is a namespace that was originally proposed by Henry Haverinen as a namespace naming scheme for Qt Addons, but apparently open governance team has changed their mind afterwards. We are going to change namespace to QtJsonDb soon.
>
> Partition has properties with names starting in _. This usually implies
> private members, and is confusing to see in public API. Is this a detail of
> JsonDb schema that is not explained somewhere else?
At the moment QtJsonDb project has a scheme for obligatory properties on *database* objects - and those properties are _uuid and _version. It is a mistake that those properties are exposed as is to QML api.
Imo Partition QML element should not have _file and _uuid properties at all.
> We don't have a great solution for JS docs yet, but you can create 'fake'
> element docs to represent JS objects with defined parameters. For example, you
> could add a CreateResponse object with documented properties and refer to that
> in the partition docs instead of having a bullet point list.
>
> http://chaos.troll.no/~denis/qtjsondb-qml-api/qml-qtaddon-jsondb-
> jsondbcomponent.html doesn't actually document anything...
right. I believe this is an old component that is not used anymore. Ignore it, we will remove it from the doc and from the source.
>
> I don't understand why you have to have a separate model for sorting instead
> of having a sort command in the query (like in SQL). Surely the data store is
> more suited for that? And then you won't need the confusing problem of two
> ListViews, one that can sort and one that can incrementally fetch data (you
> could just have one super-view).
We *do* have a query syntax to specify sort order. (one can give a query like "[?_type=Person][/name.last] " to sort by last name.
However this syntax has a few restrictions - to minimize database server impact on performance for various queries we want to explicitly say that what ever sort order is given to a server is expected to have a database index on that field and if the index does not exist, the query will fail.
That being said, JsonDbSortingListModel will pass the given sort order to the database server so that we can use the server side index to get the sorting order right, and if there is not index on the server side, listmodel will sort data on the client side instead.
>
>> Some sample qml files can be found here:
>> http://chaos.troll.no/~denis/qtjsondb-qml-api/simplelistmodel/simplelistmod
>> el.qml
>> http://chaos.troll.no/~denis/qtjsondb-qml-api/simplelistmodel/simplelistmo
>> del2.qml
>> http://chaos.troll.no/~denis/qtjsondb-qml-api/simplelistmodel/simplelistmo
>> del3.qml
>
> All three of these appear to be simple contact lists. I don't suppose you have
> any other example use-cases? Perhaps the SameGame high scores should be stored
> with JsonDb instead of SQL, or is it not entirely suitable for that usecase?
that is a great example. I don't know why, but we always describe objects of type Person or Contact as our examples :) I guess it is just a mind set of qtjsondb being used to store address book entries. Plus it is a use case that everybody should be able to easily understand :)
As opposed to another example that I was trying to implement - an irc bouncer that keeps irc log messages in qtjsondb :)
If you have further questions, feel free to mail us! We really appreciate your help with the api review, which we really need to do - the current api that we have can be definitely improved :)
Cheers,
Denis.
More information about the Qt-qml
mailing list