The Architect of the Capitol (AOC) employee portal project adhered to an application development philosophy which balances the strengths and weaknesses of each layer in the application stack, from PHP and Drupal to the client browser and, ultimately, to the user.
Almost every functional user interface feature is developed as a theme template (.tpl) with a corresponding preprocess function, accepting both required parameters and optional settings. Then, page-level layout processing can “mix and match” individual features as desired, using any logic needed on a per-instance basis. Each feature self-includes any required libraries or additional CSS and JS files, as needed. Clean .tpl files make it easy to perform finely-tuned UI layouts, while robust preprocessor functions allow complex controller logic.
Instead of relying on a hodgepodge of questionable-quality community modules, AOC benefits from one high-grade custom module that addresses almost all of its needs. Ultimately, only 12 top-level contributed modules were installed to meet the system requirements (4 of which are purely API modules). This focus on self-reliance not only reduces the administrative overhead associated with managing many contributed modules, but also mitigates the dangers of regression and/or interoperability bugs that can occur with upgrades or other changes to them.
Store Configs and Admin Settings in the Code, Not the DB
One of the strongest (and legitimate) criticisms of Drupal is that the system administrative data is intermixed with content in the database. This fact is coupled with Drupal’s “point-and-click” administrative philosophy to result in a framework which is very challenging to maintain in a development > quality assurance > production lifecycle. Where possible, the critical configuration settings and logic for AOC are contained in module or theme code, such that deployments across platforms result in much more consistent configurations.
Class-based Entity and Fields Management
While not a traditionally object-oriented framework, Drupal runs on PHP 5 and it is therefore possible to employ a class-based development pattern. For AOC, this is implemented for content types (node types, such as an Event or Notification) and their custom fields. Since node types and fields share many common functional requirements but with disparate properties and logic, they lend themselves naturally to polymorphism.
Client-side When It Makes Sense
Many features of a complex web application can be managed at either the server or the client level, and AOC takes a balanced approach to this topic. The preeminent example of this is the use of the DataTables library to create a robust Search feature, which relies on a custom RESTful service to accept search requests and provide structured data results for theming by the client. The user benefits from a high-performance, response interface and the system benefits from lower overhead due to reduced page calls and the distribution of processing.