[development] The future of OO and Drupal?

Larry Garfield larry at garfieldtech.com
Mon Sep 3 06:12:21 UTC 2007


Contribs have always been able to use OO if they felt like it.  Views and the 
forthcoming Views 2 use classes internally, and it's one of the most widely 
used contrib modules.  The "Drupal Way" relates mostly to how modules 
interact with each other, which is via hook functions rather than methods or 
inheritance or any of the other common OO modular design setups.  Exposing 
classes to other modules is currently not recommended, but the internal 
architecture is largely unregulated.

What will happen in Drupal 7 is still up in the air.  I'm working on 
rebuilding the database system in an OO way, although it will have a 
procedural thin wrapper for simplicity so you'll still be using db_query() 
99% of the time.  There has been a fair amount of talk about possibly 
revising FAPI to use objects and the ArrayAccess Interface, but so far mostly 
just test code, not actual committable code.  I've been pondering a Page 
singleton object, some people have mentioned actions or nodes as objects... 
so far it's mostly all talk, no decisions. :-)

I expect a lot more constructive talk in Barcelona:

http://barcelona2007.drupalcon.org/node/350


On Sunday 02 September 2007, Caleb Gilbert wrote:
> My apologies if this has already been covered at length elsewhere, but
> given that PHP 5 will be the minimum required version for Drupal - what
> effect will that have on Drupal's code base from this point forward? Are
> current 'leading' discussions indicating that over time large parts of
> Drupal will be written/re-written in a totally OO way?
>
> I ask because I'm wondering if a fully OO contrib module for Drupal 6 would
> be considered as having been 'correctly' done in a 'Drupal-way', or not.
> (all other things being correct/equal, of course)


-- 
Larry Garfield			AIM: LOLG42
larry at garfieldtech.com		ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson


More information about the development mailing list