[drupal-devel] Standard set of objects and methods?

Bèr Kessels berdrupal at tiscali.be
Mon May 2 20:37:06 UTC 2005


Yay!

Op maandag 02 mei 2005 20:34, schreef Nedjo Rogers:
> How can we improve parallelism between the various object types in
> Drupal?  Should we be providing a standard way to determine available
> object types?  Should we create common methods for all?
>
> As object types, we have (at a minimum) nodes, vocabularies, terms, and
> users.  We might also consider, e.g., modules, themes, and file uploads
> as core object types.  In many cases we might wish to do parallel things
> with each object type (track it, display it, interact with it), but at
> present we need to do this somewhat differently for each.

I suggest, for the sake of the discussion we limit to: nodes, comments, users, 
vocabularies, terms and menu items. Those are the core objects.

> Example 1: extended information.  We sometimes want to display
> additional information about an object being viewed (who created it,
> when, how often it has been viewed, etc.).  But we would need to do this
> differently for each object type (user, node, term, etc.), and some
> entirely lack methods.
>
> Example 2: statistics.  We track statistics by node.  But what if we
> also want statistics on users, terms, etc.?  We'd need separate tables
> (term_statistics, user_statistics, etc.) and separate methods.
>
> Example 3: associated images.  We want to associate images with objects.
>   For users we put a file reference in the user table field, for terms
> (via a contrib module) in a term_images table, for themes somewhere else.
>
> Potential solution/approach: object abstraction.  Methods prepared to
> meet any kind of object.  And a way for object types to register
> themselves, so a list of available types can be accessed.
>
> Would this make sense?

Yes, a lot. But IMO we should (a) not discuss his too much, for it will be 
hard to find a compromise; And (b) limit us to the practical side of this, 
not get too academic.

IMO we could simply start by renaming everything with a single unified naming 
convention. Not name (user), title (node) or subject (comment), but rather a 
single word, used to define that part. Same for body (node), description 
(term). just don't ask me what names to use, though ;). IMO these changes 
should be reflected in the database column names too.

Regards,
 Bèr
-- 
 [ Bèr Kessels | Drupal services www.webschuur.com ]



More information about the drupal-devel mailing list