OOE: Drupal.org project page [mirror]

This page roughly mirrors the Drupal.org version currently at: https://www.drupal.org/sandbox/webel/2120905

Synopsis

The Object Oriented Examples (OOE) project is a unique educational tutorial module for Drupal7 intended primarily for enthusiasts of graphical software engineering with Unified Modeling Language (UML) and fans of object-oriented Design Patterns. It may also be of interest to advocates and practitioners of object-oriented software engineering who are not yet familiar with UML, especially those with some background in Java (or similar OO languages).

This is an actively maintained development project, with a dedicated live demonstration site and a gallery of graphical Unified Modeling Language (UML) diagrams of the OOE system.

OOE may also be taken to mean "One Of Each", as it endeavours to represent one of each of the capabilities of Drupal7 module development in purely object-oriented form, starting with object-oriented versions of some well known existing Drupal7 tutorials and examples.

It achieves this by using a special "bridge" between the Drupal7 contributed module API (via a specially organised .module file) and a completely object-oriented OOE world that uses a special PHP recipe that is (more) amenable to reverse engineering to graphical UML, currently optimised for processing with the PEAR:PHP_UML script into XMI and graphical modelling in the MagicDraw UML tool (although once in XMI any decent UML tool could be used).

When using the OOE classes one never has to deal directly with Drupal "by convention" structured arrays; instead, the Drupal arrays are encapsulated completely, and the OOE classes know how to build and hand off valid Drupal structured arrays to the Drupal contributed module API. By encapsulating Drupal structured arrays OOE also supports IDE prompting on operations/methods (and their tightly bound documentation) that is not possible with Drupal7's "by convention" structured arrays, as demonstrated in NetBeans IDE in this short video.

Finally, when using OOE, one does not need to implement complex behaviours in the usual hooks, page handlers, and form handlers in the .module file; instead, OOE supports fully object-oriented page controllers and form controllers (although this currently requires a small and harmless tweak to the Drupal7 core's form.inc, see below).

Requirements

The OOE module depends (as a "tip of the hat") on the experimental Page controller project.

It requires also the X Autoload class loader.

It also currently requires a small and completely harmless tweak to the Drupal7 form.inc, as described at:

- Drupal 7.25: form.inc 1471: form_execute_handlers($type, &$form, &$form_state): $function($form, $form_state); Does not work for static class method 'Drupal\mymodule\FormContoller::handler'

- drupal_retrieve_form() issues Undefined index: warning on line 764 when static class method used as $form_id: hinders use of object-oriented FormController

The need for the tweaks is also well explained in those issue reports.

News: Downloads now available: Drupal7 core patch required to support object-oriented form controllers; and OOE bundle with patched Drupal-7.-36

NEW: There is now a patch for Drupal 7.x-dev core as of 2015-04-04 (Drupal-7.36+) for the files includes/form.inc and includes/ajax.inc, making it easier for you experiment with the OOE = Object Oriented Examples = One Of Each tutorial module. Visit also: Download: a Drupal-7.x-dev patch to support the OO form controllers of the OOE tutorial module , and learn how to add your community support for inclusion of this modification into Drupal-7.37 !
NEW: Until the OOE patch for Drupal7 core is accepted, you may now also experiment with the OOE = Object Oriented Examples = One Of Each tutorial module easily using: Download: OOE bundle with adapted Drupal-7.36 and installation instructions.

it's also very simple to simply edit the Drupal7 core form.inc file using this guide.

Q: Is OOE an attempt at an object-oriented version of Drupal7 core (or a "better Drupal7") ?

No. OOE is designed specifically to work with the Drupal7 contributed module API, and to offer an object-oriented bridge to it. However, to the extent that it maps out the Drupal7 contributed module API in a UML-friendly object-oriented form it reveals a lot about Drupal7. OOE does not in any sense repeat the functionality of Drupal7 core.

Q: Is OOE already a complete object-oriented API mapping the entire Drupal7 system suitable for development of other object-oriented modules ?

No. So far it is deliberately only a functioning proof-of-concept with an emphasis on introducing a UML-amenable PHP coding style to the Drupal community, based on a few well known Drupal7 examples. But there is no reason it could not (given support and/or sponsorship) be extended to become a fully-fledged object-oriented module development system for Drupal7.

Q: But what about Drupal8 ? Isn't that object-oriented already ?

Drupal8 core introduces an increasing degree of object-orientation, but is not developed specifically with graphical UML software engineering in mind and is not particularly UML friendly. A Drupal8 version of the UML-friendlier OOE demonstration module may in future be developed for Drupal8 also. (In any case, when the OOE module was commenced, Drupal8 was not yet mature enough to support a live demonstration site.)

Related modules

The Ghost project also demonstrates object-oriented page and form controllers for Drupal7, but it is not conceived as a graphical UML-friendly project, and does not endeavour to map the Drupal7 system (including blocks, menus, menu items, rendering etc.) into an object-oriented API for Drupal7. Page and form controllers are just a small part of OOE.

Credits

The Object Oriented Examples (OOE) module is developed by Webel IT Australia, specialists in PHP-driven Drupal CMS web engineering, UML, SysML, Java and XML. In addition to using Drupal CMS for developing clients' web sites, Webel has used Drupal CMS for many years to develop educational web sites promoting graphical software engineering with Unified Modeling Language (UML) and graphical systems engineering with Systems Modeling Language (SysML).

Support the OOE project

If you are interesting in seeing OOE expanded to become a fully-fledged, UML-friendly, object-oriented API for Drupal7 module development, or in seeing a Drupal8 version developed, please consider supporting the project. Donations to the Object Oriented Examples (OOE) project may be made online via via PayPal.

Visit also