Welcome to ModularBr
Discover how to implement the ModularBr framework in your Delphi projects.
Last updated
Discover how to implement the ModularBr framework in your Delphi projects.
Last updated
ModularBr for Delphi offers a modularized solution for two common challenges in API development with Delphi:
ROUTES : Modules per route
BINDS : Dependency injection
IMPORTS : Importing binds exported by other modules
ROUTEHANDLERS : Route handler
EXPOSEDBINDS : Exporting binds to other modules
ModularBr is a framework that provides a modular development architecture for applications, allowing the separation of resources into independent and interconnected modules. With this architecture, it is possible to achieve benefits such as code organization, greater scalability, easier and clearer maintenance, more efficient testability, and a more agile development process.
With modularization, it is possible to develop and test each module independently, as well as reuse modules in different projects. This approach allows the development team to work on different areas of the application simultaneously, increasing productivity and reducing development time.
ModularBr offers several useful features for developers, such as dependency injection and route-based module management. Dependency injection is a technique that allows easy swapping of class implementations during application execution or API requests, making the code more flexible and modular. Route management enables organized instantiation of modules, providing resources that can be used in a simple, manageable, and decoupled manner. Additionally, ModularBr allows route interception, enabling validation of permissions and user authentication before granting access to certain routes. These features are essential for ensuring scalability and maintainability in more complex projects.
See the benefits of using a modular architecture in your project:
By dividing the scope of resources, it is possible to have a clearer view of each part of the system, which helps in maintaining and evolving the project.
By managing each resource independently, changes in one module do not affect others, reducing the risk of system breaking.
With modularization, it is possible to add new features without conflicts, as each module is independent.
By separating resources into modules, it is possible to have a clearer view of the core business rule and avoid blind spots.
With a modular architecture, it is easier for new developers to understand the system and start working on new functionalities.
The separation of resources into modules makes the code more readable and facilitates maintenance, extending the project's lifespan.
A practical example of a modular architecture is a standard MVC model with 3 resources (Authentication, Home Page, and Products). With modularization, each resource can be managed independently, without interfering with other parts of the system.
Above, we presented a common structure using the MVC pattern, which is very useful in virtually all types of applications.
What we did in this structure was to continue using MVC, but this time on a scope basis. This means that each functionality has its own MVC, and this simple approach solves many scalability and maintenance issues. We call this approach "Smart Structure". However, there were still two things that were global and conflicted with the structure itself, so we created ModularBr to resolve this impasse.
In summary, ModularBr is a solution for modularizing the routing system and dependency injection, making each scope have its own routes and injections independent of any other factor in the structure. We created objects to group the Routes and Injections, and we call them Modules.
ModularBr is not only brilliant for accomplishing something amazing, like componentizing routes and dependency injections, but also for doing it all in a simple way!
Go to the next topic and begin your journey towards an intelligent structure.