In today’s web engineering practice, functionally rich web applications are not created from scratch. Instead, web developers use a variety of Web Content Management Systems (WCMSs) such as WordPress, Joomla, or Drupal. These systems provide functional extensibility in the form of installable software extensions. Examples for such functionality include web shops, file repositories, or image galleries. WCMS systems come with plug-in mechanisms that empowers users without a strong technical background to customize a WCMS instance according to their needs.
However, developing a Joomla extension (or a WordPress plugin or a Drupal module for that matter) is a challenging task even for experienced developers. For instance, the extension mechanism provided by Joomla is based on a sophisticated API as well as naming conventions. An elaborate standard file and code structure must be fulfilled to consistently deploy a given extension to its target platform. To fulfill this structure, a typical procedure for creating a new extension is to clone an existing one and to modify the clone to satisfy the new requirements.
However, this procedure is highly error-prone. For instance, mismatches between class identifiers and file names might go unnoticed. Another problem occurs when the underlying platform evolves and existing extensions must be updated to adapt to the platform changes. If the number of extensions to migrate grows, the required effort for updating the extensions can increase tremendously.
In this blog post, we present JooMDD, an infrastructure for the model-driven development of extensions in Joomla, a mainstream WCMS platform with a sophisticated extension mechanism. JooMDD supports Joomla extension developers with a standard MDD toolset:
- A DSL and model editor for specifying one or more extensions,
- a code generator for automatically generating recurrent code, and
- a model extraction tool to support the reverse engineering of existing extensions.
JooMDD can be applied to the two typical scenarios during WCMS extension development: The development of completely independent extensions as well as of extensions depending on existing extensions.
DSL and Code Generator for Joomla Extensions
We provide a DSL for the description of Joomla-based software extensions. The language consists of three parts: a part to model the data management of Joomla extensions (entities), a part for the definition of a page flow of extension views (pages), and a part for the description of an extension structure (extensions).
To use the DSL we provide plugins for IntelliJ IDEA, PhpStorm, and Eclipse, the most commonly used development environments in the WCMS domain. Additionally, we provide a platform independent web editor which supports the application of several use cases (forward and reverse engineering) in a user-friendly way.
Update sites for the IDE plugins can be found in Github and the web editor can be used directly on this page.
In addition to the DSL we provide a code generator to create full extension code for installable extensions for different versions of Joomla.
Tool Support for Reverse Engineering of Existing Joomla Extensions
Model-Driven Development of Joomla Extensions
To illustrate the applicability of our approach, we apply our infrastructure to two use cases which occur very frequent in extension development. One is the development of independent Joomla extensions, the other is the development of new extensions that use artifacts of existing extensions.
Creating a new Joomla Component
We devise a simple conference management component as an example extension to the Joomla core. The class diagram on the right supports the management of a conference with its participants, talks, rooms, and programme. Specifically, each entity should be displayable in a custom list and details view, such as those shown in the figure below. The figure shows these views from the perspective of a Joomla administrator who can make the same views visible to site visitors using a menu entry. Based on these requirements, we designed an extension model which can be used as input for our code generator.
The entities part of the model describes the data entities and their relation to each other.
The specification of the views can be found in the pages part. A page can contain links to other pages to provide interactions within the application. In the last section of the model (extension part), the Joomla-specific extension is defined in an abstract manner.
From these domain definitions, the code generator can then create a full installable conference component that can be used to manage the required entities; no manual addition of individual source code is required.
Data Management within a Joomla-based Website
Creating a Joomla Module using an Existing Component
As a second usage example, we consider the development of an extension based on an existing component. Specifically, we extend the users component, a core component being pre-installed on every Joomla instance. The component manages the users and user groups of a Joomla instance, illustrated in the figure below. Per default, there is no way to show existing user groups within the front end of a Joomla site. To improve this situation, we will add a new module to the existing component. In Joomla, modules are used to provide visual representations, such as the required representation of user groups.
Dependant Module which uses an existing Joomla Component
We first use our reverse engineering tool to extract an extension model from the users component. The resulting model provides entities, pages, and the extension specification which can be referred by new extensions. To avoid the generation of code for these existing elements, they are annotated with a @preserve tag.
Resulting Model after the Model Extraction task
To implement the new module, we create a new model and add a module specification as the following figure illustrates.
New Module Specification and Resulting Generated Code (Extract)
Using the model as input, the code generator creates the module with the dependency to the existing component as shown in the figure above. Since the generated file and code structure is fully compliant with the Joomla standard, the module can be deployed directly to an existing Joomla website. Once installed, it works together with the already installed user component by using its model as DAO for the data which should be shown – in our case the user groups which are managed by the component.
Application in current projects
In our team, we currently apply our infrastructure to several scenarios. In the university context, we developed a preparatory course management for first-semester students. The component is part of a Joomla website, which allows students to register for courses and manage their course membership. Another extension we created with JooMDD allows Joomla developers to extract existing extensions out of a Joomla-based website and create an installable zip file. This enables them to extract installation packages of any installed extension, which in turn can be used as input for our model extraction tool.
Another project deals with the development of a component for the resource management of our university, which we developed by hand over the course of six years. We augmented the existing component by new depending extensions by using JooMDD, following the scenario of the second use case. The developed extensions range from modules which display data of the component artefacts such as rooms, events, and study programmes. Using JooMDD, we saved effort and time during the development phase and supported new developers in our team while creating new dependent extensions.
By providing our tools on Github, other Joomla developers are able to use them. Based on existing user feedback, the main use is the initial development of Joomla extensions.
During both application scenarios, development speed increased since most of the code was generated. In addition, the defect potential of new extensions was tremendously decreased, because all generated fragments adhere to the given coding guidelines of Joomla. In both cases the extensions were installable and applicable without adding a line of code by hand.
While developing extensions on top of existing ones, a nice effect is the possibility to use the model extracted from the existing extension as a means of documentation, or a first version of the same extension, which may be developed in a model-driven manner. If an existing extension evolves, the model must be extracted anew. This could lead to inconsistencies between models of the existing and new extension. However, a re-engineering on the model level allows a more rapid adjustment in contrast to a manual change of the dependencies in the extensions’ code – especially if the dependencies concern different code fragments but are specified in same part of the model.
Beside the described strengths of the approach, we discovered some weaknesses during the application. The main weakness is the management of individual code. If an extension which is developed using our approach evolves, individual fragments are not considered within the extension model. This could lead to problems at runtime, since the individual parts could depend on generic fragments, which have been changed or removed. To detect and fix error-prone fragments, an adequate test suite is required. Otherwise, they won’t be detected.
During the case of developing a new dependent extension, the problem of individual code occurs in an earlier stage. When extracting a model from an extension, only the parts which adhere strictly to the Joomla standard can be found and abstracted. Individual parts remain unnoticed and can only be reused by a new extension if the dependencies are added to the generated code by hand. However, this procedure impairs the benefit of our approach.
Our future plans span over two research directions. First, we plan to improve the existing DSL and tools, in particular to provide support for other WCMSs, such as WordPress and Drupal. Second, based on anecdotal evidence from our communication with Joomla representatives, there is interest in using JooMDD for the development of extensions within the Joomla community. This situation allows us to provide our infrastructure directly to a large group of developers for a field study in vivo. Using this exposure opportunity, we intend to infer the usefulness of our approach empirically.
In the last months, we conducted a number of workshops and interviews with representatives. First insights confirm the usefulness of our approach. The analysis and interpretation of the results will be published in an upcoming conference paper.
I would like to thank all the contributors of JooMDD who helped to implement the infrastructure. Dieudonne Timma Meyatchie and Wolf Rost, both part of our institute, deserve particular mention here since they spent hours and hours to move the project to its current stage. Additionally, I want to thank Roland Dalmulder who promotes JooMDD within the Joomla community and supports us during the development of our tools. I’m also grateful for the collaboration with Daniel Strüber (University of Koblenz and Landau) who pushed the quality of my research in this area, for instance by editing this blog post and co-authoring in my scientific papers.
For Further Reading
Dennis Priefer, Peter Kneisel, Daniel Strüber
Iterative Model-Driven Development of Software Extensions for Web Content Management Systems
In European Conference on Modelling Foundations and Applications (ECMFA), Marburg, Germany, pp. 142-157, Springer, Cham, 2017. https://doi.org/10.1007/978-3-319-61482-3_9 [PDF]
Dennis Priefer, Peter Kneisel, Gabriele Taentzer
A Model-Driven Process to Migrate Web Content Management System Extensions
In Web Engineering – Volume 9671 of the series Lecture Notes in Computer Science, pages 603-606. Springer International Publishing Switzerland, 2016. Poster at the 16th International Conference on Web Engineering, Lugano, Switzerland. https://doi.org/10.1007/978-3-319-38791-8_57 [PDF]
Dennis Priefer, Peter Kneisel, Gabriele Taentzer
JooMDD: A Model-Driven Development Environment for Web Content Management System Extensions
In Proceedings of the 38th ACM/IEEE International Conference on Software Engineering, Austin, TX, USA, pages 633-636. ACM, New York, 2016. https://doi.org/10.1145/2889160.2889176 [PDF]