Ticket #941 (accepted Task)
Consolidate Core API
Reported by: | jri | Owned by: | jri |
---|---|---|---|
Priority: | Major | Milestone: | Release 4.8 |
Component: | DeepaMehta Standard Distribution | Version: | 4.7 |
Keywords: | Cc: | dgf, Malte, JuergeN, robert.schuster | |
Complexity: | 3 | Area: | Application Framework / API |
Module: |
Description (last modified by jri) (diff)
Meanwhile the (REST) APIs of the Core and the standard plugins are quite stable. However, some namings resp. request formats could be improved. One of the upcoming DM releases should consolidate the class/method namings and request formats. This is regarded a prerequisite for the to-be-written extensive DM Development Guide (see #444).
List of intended API changes:
- The DeepaMehtaService interface should be named CoreService. Consequently the omnipresent dms object should be named cs.
- The DeepaMehtaService's deliverEvent() method should be named dispatchEvent().
- The DeepaMehtaService's various getTopic[s] methods possibly could have more telling names, e.g. getTopicById().
- The ChildTopicModel's getTopic[s] methods should have the same form as its counterparts in ChildTopics. The forms that take default value should be transformed into getTopic[s]OrNull (that is a fixed default value of null). All forms should catch and report a ClassCastException.
- to be continued ... you proposals here ...
Change History
comment:2 Changed 9 years ago by jri
- Description modified (diff)
- Summary changed from Consolidate API wording to Consolidate Core API
comment:8 follow-ups: ↓ 11 ↓ 12 Changed 9 years ago by Malte
On thing came to my mind about API wording:
I struggled to understandd the meaning of has() as a method of ChildTopics? in respective to the Storage Layer (as of the concept when working with "attached" topics) it always seemed unclear to me if has checked if a specific composite topic :
- has this child topic at all (in the db) or
- has this child already loaded (from the db)
I would suspect that has() checks in the DB if such a child topic is existing (and not if it is loaded).
http://api.deepamehta.de/deepamehta/4.7/de/deepamehta/core/ChildTopics.html
And BTW just because this just changed:
In the DeepaMehtaUtils?.loadChildTopics() we still need the ability to load specific child selectively :)
Thanks & Cheers!
comment:10 Changed 9 years ago by Jörg Richter <jri@…>
comment:11 in reply to: ↑ 8 Changed 9 years ago by jri
Replying to Malte:
I struggled to understandd the meaning of has() as a method of ChildTopics? in respective to the Storage Layer (as of the concept when working with "attached" topics) it always seemed unclear to me if has checked if a specific composite topic :
- has this child topic at all (in the db) or
- has this child already loaded (from the db)
I would suspect that has() checks in the DB if such a child topic is existing (and not if it is loaded).
Actually the other applies.
ChildTopics has() checks if a certain child topic(s) is loaded into memory.
Indeed, the "has" wording is not lucky.
The same applies btw to the size() method. It tells you how many child topics are loaded.
Note that since DM 4.1 loading child topics is transparent to the plugin developer. On a ChildTopics object she just calls getTopic[s]() and the Core cares about on-demand loading.
Do you actually use has() or size() in your plugins?
Actually I can't think of any case when a plugin developer needs to know wether a certain child topic(s) is loaded into memory. Meanwhile (in the course of DM 4.8) I see has() and size() as Core internal and tend to completely remove them from the public Core API.
Thank you for pointing to this problematic API!
comment:12 in reply to: ↑ 8 Changed 9 years ago by jri
Replying to Malte:
And BTW just because this just changed:
In the DeepaMehtaUtils?.loadChildTopics() we still need the ability to load specific child selectively :)
Before DM 4.8 you can call loadChildTopics() on a ResultList object. It loads all child topics of all the objects in the ResultList?. Since DM 4.8 the ResultList class is dropped and so its loadChildTopics() utility method needed a new home, which is DeepaMehtaUtils. Note that DeepaMehtaUtils?.loadChildTopics() takes a List as argument.
At the moment I can't think of a case when you want load a specific child topic of all the objects in a List. At least this was never supported by ResultList's loadChildTopics() method. (If you need such a utility you can easily write it yourself).
DeepaMehtaObject (and thus Topic and Association) still provides both (and possibly this is what you meant):
loadChildTopics(); // loads all childs loadChildTopics(String assocDefUri); // loads specific child
Generally explicit child topics loading is something rarely needed by a plugin developer as in most cases it is done automatically by the Core.
comment:13 Changed 9 years ago by Jörg Richter <jri@…>
comment:14 Changed 9 years ago by Jörg Richter <jri@…>
comment:15 Changed 9 years ago by Jörg Richter <jri@…>
comment:16 Changed 9 years ago by Jörg Richter <jri@…>
comment:17 Changed 9 years ago by Jörg Richter <jri@…>
comment:18 Changed 9 years ago by Jörg Richter <jri@…>
comment:19 Changed 9 years ago by Jörg Richter <jri@…>
comment:20 Changed 9 years ago by jri
In https://github.com/jri/deepamehta/commit/e9e95484
Properies files: add spaces around = (#941).
See #941.
comment:21 Changed 8 years ago by Malte
BTW: After adapting many plugins to the new 4.8 API i would not like to go back ever again. Great work, I mean reading and writing using the api items is much clearer now. imho this was certainly worth all your work and makes me do appreciate refactoring "grown" stuff much more - Thank you very much, great lesson for me just watching.
Ok, all the best & keep it straight!
comment:22 Changed 8 years ago by jri
Thank you very much :-)