Modular Application Architecture - Intro
Modular Application Architecture - Intro
Modules
Why?
- Customizations: the application can behave really differently by just enabling/disabling some modules.
- Less dependencies: the modules are more independent from the application itself, till the "entrypoints" are compatible, both modules and the application can evolve independently.
- Third-party extensions: since the modules are not part of the application and the "entrypoints" are well defined, developing modules can be done by third parties.
- Independent development: Since the application and the modules are independent, they can be:
- Smaller application The applications is smaller (many functionalities can be implemented via modules) and smaller application is translated in better maintainability.
- Wordpress it the most popular blogging platform nowadays. Part of its success is an incredibly powerful and at the same time incredibly simple plug-in and theme system.
- Symfony is a popular PHP framework. Thanks to its "bundles" system, is possible to get a large variety of ready functionalities with almost no effort.
- PHP, itself offers a great set of extensions and those extensions allowed to integrate the language with a large variety of systems.
Challenges to solve
1. Module structure
2. Registration
- discovery: our application can try to use predefined set of "rules" to look for new modules and load/register them.
As example is possible to try to look in specific folder (s) for some particular file (s) or check if a particular class (es) is defined and try to instantiate it. - configuration: we can explicitly configure the application to load a particular file (s) or a particular class (es).
- composer: the composer way of adding functionalities is by discovery.
Composer will search for installed packages havingtype=composer-plugin, will search for a property namedclassdefined in the package'scomposer.jsonfile and will register the event listeners declared by that class. More info about it are available here - symfony: the symfony way of adding functionalities is by configuration.
In theAppkernelclass is necessary to define all the "bundles" that will be used by symfony to enrich the framework functionalities. The "bundle" class will be instantiated and is responsible for registering the bundle into the extension points that symfony allows. More info about it are available here - laravel: the laravel way of adding functionalities is by discovery.
Laravel will search for installed packages and will search for a property namedextra.laraveldefined in the package'scomposer.jsonfile and will register the service providers declared in there. More info about it are available here
3. Configuration
- composer: the composer's
composer.jsonfile allows you to decide which plugins to load, which commands to run and so on. - symfony: the symfony allows YAML, XML and PHP as configuration languages, configuration values can to be declared in
config.(yml|xml|php)(and in few other places) and bundles can provide default values for it. - laravel: the laravel uses mainly PHP as configuration language and thank to it is possible to use the power of the PHP syntax when defining configurations.
4. Resources
- linking/copying the content to the web directory
- serve the resources using the applications, as example pipe-it via PHP
- configure the webserver to serve explicitly the plugin resources



Comments
Post a Comment