[kforge-dev] domainmodel API design suggestions

Jo Walsh jo at frot.org
Mon Nov 13 13:03:23 UTC 2006


dear Rufus, John, thankyou both for indulging me in pair- and triad-
programming sessions last week and enduring my barrage of stupid
questions and answering many of them.

I was just looking over my notes on the domainmodel interface and
wondering about possible API reworking. I find the current API more
*seems* overcomplex because it talks the language of the pattern
process so literally. Well illustration is always best; the following
is what my notes say now about how to query for instances of an object
in the domain model:

    from ckan.soleInstance import application
    register = application.registry.getDomainClassRegister()
    domainClasses = register.keys() 
    domainClass = domainClasses['PackageName']
    objectRegister = domainClass.createRegister()
    objectRegister.findDomainObjects(filter)

^^^^- note my four-space tabs, Rufus :P 

I would like to be able to address domainmodel more idiomatically thus:

    ...
    classes = application.classes()
    package = classes['Package']
    package.list(filter) or package.search(filter)

And have the stuff below abstracted away a bit more. It is a beautiful
if baroque design underneath, that works really well, but as an
application developer i don't think i need to be so exposed to the
inner workings and to the raw pattern language as the current interface
necessitates.

I wish i had the focus to accompany this with more constructive
illustrations but it probably wants to be talked over a bit more
before code written anyway, the latter is relatively unimportant?  

I am probably working fulltime for the next couple of weeks (!) but
would love to come back to Cambridge in 3 or 4 weeks time and have a
more proper sprinting session then, and patch the docs up.

love,


jo
-- 




More information about the kforge-dev mailing list