Article

October 27, 2026

Hexagonal architecture in the applicability of Domain-Driven Design in a modular monolith of agricultural management

Lucas Fonseca dos Santos; Vinícius Santos Andrade

DOI: 10.22167/2675-6528-202601110

Article prepared by the ResumeAI tool, an artificial intelligence solution developed by the Pecege Institute focused on synthesis and writing.

Summary

Value generation in software arises from the ability to represent the business domain, making Domain-Driven Design (DDD) a crucial concept for systems with high functional complexity. The agribusiness sector, for example, represented 23.2% of Brazil’s Gross Domestic Product in 2024. The impacts of hexagonal architecture on the applicability of DDD in a “greenfield” project were evaluated. A module, named Fonagro, was implemented as a minimum viable product (MVP), consisting of an agricultural management ERP developed in Java with Spring Boot. The system was built as an event-driven modular monolith, following hexagonal architecture and DDD principles. Seven code quality metrics were collected, including coupling between classes, lack of cohesion in methods, response per class, number of children, lines of code, depth of inheritance, and weighted methods per class, using the CK Metrics tool on the Production module. The analysis of 240 code units revealed an architectural quality compliance rate of 97.32%, with all evaluated metrics showing values above 92%. The results obtained supported the hypothesis that hexagonal architecture is suitable for contexts of high business complexity, requiring domain isolation and low coupling, fundamental principles of Domain-Driven Design.

Keywords: Agribusiness; Software engineering; Event driven; Code quality.

1. Introduction

Contemporary software engineering seeks to build digital solutions that deliver substantial business value, requiring software to accurately represent the domain it aims to serve (Mendes-da-Silva and Albertin, 2024). The inherent complexity in many sectors poses challenges to system design. Brazilian agribusiness, for example, demonstrated its robustness by representing approximately 23.2% of Brazil’s Gross Domestic Product (GDP) in 2024 (CEPEA-ESALQ/USP, 2024). This sector, with extensive value chains and intricate processes, demands information systems that incorporate a deep understanding of its operations. Digital transformation in agribusiness is crucial for competitiveness, requiring approaches that ensure clarity and adaptability of business models in code.

In this scenario of high functional complexity, Domain-Driven Design (DDD) emerges as a fundamental approach. It is a set of principles that guide software development based on an in-depth understanding of the business domain, promoting ubiquitous communication between specialists and teams (Khononov, 2022). Its objective is to create software models that faithfully reflect business logic and rules, using concepts such as bounded contexts. The application of DDD aims to reduce coupling, increase isolation, and promote internal cohesion of components, resulting in more maintainable systems aligned with needs (Vernon, 2024). The effectiveness of DDD depends on the ability of architectural decisions to support these principles, ensuring that the domain remains the protected core of the application (Litvinov, 2020).

To materialize the principles of DDD, the hexagonal architecture, also known as the “Ports and Adapters Pattern”, stands out for isolating the business domain from technical and infrastructure concerns (Cockburn and Garrido de Paz, 2024). This architecture establishes a clear separation between the domain (business rules), the application layer (orchestration), and the infrastructure layer (technological details). The fundamental principle is dependency inversion, where dependencies flow from outside to inside: infrastructure depends on the application, and the application depends on the domain, but the domain has no external dependencies. This isolation ensures that business rules remain agnostic to specific technologies, facilitating evolution and protecting the domain from external changes (Litvinov, 2020). The adoption of such an architectural pattern is crucial for the isolation of business rules in the application and infrastructure (Özkan et al., 2025).

The implementation of complex systems, such as those demanded by agribusiness, can be optimized through a modular monolith. Unlike a traditional monolith, where all business contexts are grouped together, the modular monolith organizes the application into multiple loosely coupled modules, each representing a bounded context (Guntakandla, 2025). This approach combines deployment simplicity with the benefits of low coupling and high cohesion, characteristics desirable in microservices architectures, to which it can scale in the future with less effort (Faustino et al., 2024). Communication between these modules is often event-driven, where domain events are published and consumed, allowing contexts to interact without direct dependency on internal implementations. This asynchronous mechanism reinforces the system’s isolation and resilience.

Given the functional complexity and economic relevance of agribusiness, the choice of a software architecture that promotes domain isolation and low coupling is imperative for robust and adaptable systems. The combination of Domain-Driven Design with hexagonal architecture and the structure of an event-driven modular monolith presents itself as a promising strategy to meet these requirements in “greenfield” projects. Thus, this work is justified by the need to empirically understand how such architectural choices impact code quality and adherence to DDD principles in a challenging business context. The objective of this study is to evaluate the impacts of hexagonal architecture on the applicability of Domain-Driven Design in a “greenfield” agricultural management project, through the analysis of code quality metrics in an event-driven modular monolith.

2. Material and Methods

The research conducted was characterized by an exploratory and applied approach, according to the need to deepen the understanding of the applicability of the hexagonal architecture in Domain-Driven Design. The study sought to validate the results in a software product developed specifically for this work, Fonagro, an agricultural management system. The exploratory nature was essential to delimit the scope of the research, guiding the definition of the model, the construction of the Minimum Viable Product, and the analysis of the collected metrics, as recommended by Lösch et al. (2023). The data analysis, in turn, had a descriptive character.

The study’s context focused on Brazilian agribusiness, a sector of high functional complexity and economic relevance, which demanded a robust and adaptable information system. The project, named Fonagro, was conceived as a “greenfield” Minimum Viable Product (MVP), meaning it was developed from scratch, with no pre-existing codebase. The implementation was done in Java, using the Spring Boot framework, structured as an event-driven modular monolith, under the principles of hexagonal architecture and Domain-Driven Design. The unit of analysis consisted of two hundred and forty Java files belonging to the Fonagro Production module.

The population of interest for this study was the Fonagro system’s source code, specifically the Production module, which represented the main business domain. The research sample comprised two hundred and forty Java files, which constituted the code units of this module. The selection criteria for the sample were defined by the choice of the Minimum Viable Product (MVP) Fonagro’s Production module, as it was the main business domain and the initial development focus. No other mapped modules or contexts that were not implemented in the MVP were included.

The data collection began with a comprehensive bibliographic survey, fundamental for establishing the theoretical framework that supported the study. Scientific articles published between the years two thousand and twenty and two thousand and twenty-five were evaluated. The keywords used for the search included “Software Engineering”, “Domain-Driven Design”, “Software Architecture”, “Hexagonal Architecture”, and “Software Quality Metrics”. This stage aimed to consolidate the conceptual basis and best practices related to software architecture and code quality, providing the foundation for subsequent analyses.

For the construction of the Fonagro domain model, the “Event Storming” technique was employed, which allowed for the abstraction of business contexts and the mapping of relevant events, commands, and actors. Aggregates, value objects, policies, and bounded contexts were identified, essential for the characterization of the domains. Contexts such as Production Management, Identity, Fiscal Management, Machinery Management, Stock Management, Inventory Management, Human Resources, and Commercial were mapped. Additionally, thirty-six functional and non-functional requirements were elicited, organized into four main contexts: property, plot, crop, and operation, covering create, read, update, and delete operations, as well as domain events and lifecycle validations.

The Fonagro Minimum Viable Product (MVP) was developed in Java, using the Spring Boot framework, following a hexagonal architecture and the principles of Domain-Driven Design in an event-driven modular monolith. After the implementation of the Production module, the generated source code was submitted to the CK Metrics Tool. This tool was used to collect seven code quality metrics: Coupling Between Object Classes (CBO), Weighted Methods per Class (WMC), Lack of Cohesion in Methods (LCOM), Number of Children (NOC), Depth of Inheritance Tree (DIT), Response for a Class (RFC), and Lines of Code (LOC). The collection occurred in the “commit” version “b1091ed”, available in the project repository.

The architectural compliance of the project was ensured by the implementation of twenty-eight automated tests, using the ArchUnit library. These tests were designed to rigorously verify the dependency rules between the layers of the hexagonal architecture, locality and naming conventions, inheritance hierarchies, contracts, and adherence to Domain-Driven Design principles, such as the immutability of events and value objects, the absence of cycles, and domain isolation. To maintain isolation between layers and prevent rule leakage, the “Delegate Pattern” was employed in conjunction with the “Adapter Pattern”, delegating implementations to the application layer.

The analysis of the data collected by the CK Metrics tool was exploratory and descriptive, aiming to understand the benefits and challenges inherent in the adoption of the hexagonal architecture in the context of Domain-Driven Design. The interpretation of the results was based on the code’s compliance with the architectural model established by DDD. This evaluation allowed for precise information to be obtained regarding architectural adherence, the level of coupling between contexts, and other crucial code quality characteristics. For each metric, previously defined value ranges from previous studies were considered, classifying them as “good”, “moderate”, or “bad”.

The calculation of the result for each metric was obtained through an estimate of the weighted average. For this, specific formulas were used that considered the quantity of classes with values classified as “good” (C), with a weight of one hundred percent, and “moderate” (D), with a weight of fifty percent. Values classified as “bad” did not contribute to the calculation. The variable N represented the total quantity of classes, interfaces, or enums analyzed in the project. Based on the individual metrics, the Architectural Quality Compliance Index (ICQA) was calculated, an average of the seven metrics, to measure the overall quality of the system in relation to the architectural requirements of the DDD.

This study presented some methodological limitations that should be considered when interpreting the results. Firstly, the work did not include a comparison between different architectural models, which restricts the ability to generalize the findings to other contexts. Furthermore, as it is a “greenfield” project developed as a Minimum Viable Product (MVP), only one module, Production, was implemented. The execution of the project by a single author may also influence the perspective and design decisions. Although these limitations restrict generalization, they do not compromise the validity of the observations made within the defined scope.

3. Results and Discussion

The analysis of the data collected by the CK Metrics tool, applied to two hundred and forty Java files from the Production module of the Fonagro system, revealed a detailed panorama of the project’s architectural quality. In total, one hundred and ninety-seven classes, thirty-four interfaces, three inner classes, and six enumerations were examined. The distribution of these code units across the architectural layers demonstrated an expected progression, with fifty-two units in the domain layer, seventy-seven in the application layer, and one hundred and eleven in the infrastructure layer. This distribution, which shows an increase from the central layer (domain) to the outer layers (application and infrastructure), aligns directly with the pattern predicted by the hexagonal architecture, where the infrastructure, by its nature, tends to be more voluminous due to the implementation of adapters and integrations with external technologies (Cockburn & Garrido de Paz, 2024).

The aggregated results of the seven code quality metrics, as presented in Table 1, indicate a high level of architectural compliance. The calculated Architectural Quality Compliance Index (AQCI) was 97.32%, a value that supports the hypothesis that the hexagonal architecture is effective in applying Domain-Driven Design principles in high-complexity contexts. The following discussion details each metric, its results by layer, and its implications.

Table 1. Data collected by the CK Metrics tool

Metric

Good

Moderate

Bad

Total Classes

Acceptance Results

CBO

213

27

0

240

94,37%

WMC

230

0

10

240

95,83%

DIT

203

37

0

240

92,29%

LCOM

238

0

2

240

99,16%

LOC

240

0

0

240

100%

RFC

240

0

0

240

100%

NOC

239

0

1

240

99,58%

Source: Original survey data

The Coupling Between Object Classes (CBO) metric, which measures the coupling between classes, is fundamental to Domain-Driven Design (DDD), as low coupling is a prerequisite for the isolation of bounded contexts (Prykhodko et al., 2022). The overall result for CBO, according to Table 1, was 94.37% compliance, with two hundred and thirteen classes classified as “good” and twenty-seven as “moderate”, and none as “bad”. This finding is particularly relevant, as excessive coupling can compromise the maintainability, testability, and evolution of the system, crucial aspects in complex software projects.

When analyzing the distribution of CBO by layers, according to Table 2, it is observed that the domain layer presented an average of 2.34, a significantly low value and well below the threshold of 10 established as “good” for this study, based on the analyses by Prykhodko et al. (2022). This result corroborates the effectiveness of the hexagonal architecture in isolating the domain from external dependencies, one of the pillars of DDD (Litvinov, 2020). The application layer, in turn, registered an average of 5.24, and the infrastructure layer, 6.02. The trend of increasing CBO from the domain layer to the infrastructure is expected and justified. The infrastructure layer, by its nature, implements adapters that interact with external frameworks and services, which naturally raises its coupling level. However, even with this increase, the values remain within acceptable limits, indicating that the coupling is managed effectively.

Table 2. Data distributed by layers

Metric

Layer

Good

Moderate

Bad

Total Units

Metric Average

CBO

domain

49

3

0

52

2,34

CBO

application

65

12

0

77

5,24

CBO

infrastructure

99

12

0

111

6,02

WMC

domain

49

0

3

52

6,90

WMC

application

73

0

4

77

4,93

WMC

infrastructure

108

0

3

111

3,71

DIT

domain

21

31

0

52

1,711

DIT

application

77

0

0

77

1

DIT

infrastructure

105

6

0

111

1,05

LCOM

domain

50

0

2

52

19,46

LCOM

application

77

0

0

77

0,24

LCOM

infrastructure

111

0

0

111

0,14

LOC

Domain

52

0

0

52

24,23

LOC

Application

77

0

0

77

20,37

LOC

Infrastructure

111

0

0

111

13,59

RFC

Domain

52

0

0

52

2,67

RFC

Application

77

0

0

77

5,41

RFC

Infrastructure

111

0

0

111

2,62

NOC

Domain

51

0

1

52

0,59

NOC

Application

77

0

0

77

0

NOC

Infrastructure

111

0

0

111

0,05

Source: Original survey data

The main offenders for CBO in the domain layer were FieldModel (CBO=13), CropModel (CBO=12), and PropertyModel (CBO=11). These classes represent root aggregates, which, by definition in DDD, encapsulate and manage the lifecycle of other entities, value objects, and domain events. The reference to these internal components is inherent to their responsibility as aggregates, which justifies a slightly higher CBO, but still functionally cohesive and controlled. In the application layer, classes such as CreatePropertyUseCase (CBO=19), CreateCropUseCase (CBO=18), and CreateOperationUseCase (CBO=16) showed the highest values. Being use cases, these classes orchestrate services and publish domain events, which naturally leads them to depend on multiple domain and infrastructure components (through ports), confirming the tendency for high CBO for this responsibility. The hexagonal architecture, with its Ports and Adapters pattern, as illustrated in Figure 1, facilitates this orchestration while maintaining the direction of dependencies from outside to inside, protecting the domain.

Source: Original survey data

Figure 1. Hexagonal Architecture (“Ports & Adapters”) abstracted in the project

In the infrastructure layer, the “controllers” and JPA entities were the main contributors to the CBO. CropCommandController (CBO=15), FieldEntity (CBO=15), and OperationEntity (CBO=14) are examples. Controllers, which act as input adapters, interact with the Spring Boot framework and the application layer’s use cases, naturally increasing their coupling. The implementation of a native Spring Boot “Command Bus”, a design pattern that decouples action from its execution, helped mitigate CBO, but some dependencies with the framework are unavoidable. JPA entities, in turn, reflect the relationships of the relational model, encapsulating diverse information in value objects to reduce coupling, without violating bounded context limits. Figure 2 demonstrates how the hexagonal architecture implementation organizes these interactions, ensuring dependencies flow in the correct direction.

Source: Original survey data

Figure 2. Implementation of the Hexagonal Architecture (“Ports & Adapters”) in the project

The Weighted Methods per Class (WMC) metric evaluates the complexity and size of a class by summing the complexity of its methods. For DDD, a low WMC is desirable, as it indicates smaller, more focused classes, aligned with the principle of cohesive aggregates and a thin application layer (Hanifah et al., 2024). Table 1 shows 95.83% compliance for WMC, with two hundred and thirty “good” classes and only ten “bad” ones. No classes were classified as “moderate”. This result suggests that the majority of classes in Fonagro maintain manageable complexity.

The layer-by-layer analysis in Table 2 reveals that the domain layer has an average WMC of 6.90, the application layer 4.93, and the infrastructure 3.71. Hanifah et al. (2024) suggest that WMC values between 1 and 50 indicate good quality. All average values per layer are well below this upper limit, which is a strong indication that the classes are well-designed, with clear responsibilities and concise methods. The ten classes classified as “bad” (with WMC > 150) should be investigated individually in future refactorings, but their reduced number (approximately 4% of the total) does not compromise the overall quality. Maintaining a low WMC is crucial for code maintainability, facilitating understanding and modification, and reducing the probability of introducing defects.

The Depth of Inheritance Tree (DIT) metric measures the depth of a class’s inheritance hierarchy. High DIT values can indicate increased complexity, maintenance difficulty, and behavioral unpredictability (Aziz et al., 2021). In the context of DDD, the simplicity of domain entities and the preference for composition over deep inheritance are valued. Table 1 shows that 92.29% of classes are compliant, with two hundred and three “good” classes and thirty-seven “moderate” ones. No classes were classified as “bad”.

The layer distribution in Table 2 indicates that the domain layer has an average DIT of 1.711, while the application and infrastructure have 1 and 1.05, respectively. Prykhodko et al. (2022) define values below 1.72 as “good” and between 1.72 and 4.47 as “moderate”. The thirty-seven units in moderate degree in the domain layer (DIT > 1.72) are classes representing domain entities, identities, and events. These classes inherit from BaseModel, BaseId, and DomainEvent from the cross-cutting Kernel module. The Kernel module is responsible for auditing, strong typing, and event publishing, and these inheritances are considered tactical DDD patterns (Khononov, 2022; Vernon, 2024), not representing a violation of the domain structure, but rather a way to reuse common behaviors in a controlled manner. The low inheritance depth in the application and infrastructure layers reinforces the preference for composition and delegation, which contributes to a more flexible and less coupled design.

The Lack of Cohesion in Methods (LCOM) metric assesses the internal cohesion of a class. High cohesion (LCOM close to zero) is a fundamental principle of DDD, indicating that a class’s methods are strongly related and that the class has a single, well-defined responsibility (Hanifah et al., 2024). Table 1 reveals an exceptional compliance of 99.16% for LCOM, with two hundred and thirty-eight “good” classes and only two “bad” ones. No class was classified as “moderate”.

The layered analysis in Table 2 shows that the domain layer, despite having two “bad” classes, presents an average LCOM of 19.46. However, the LCOM5 metric, used in this work, is normalized to a scale between 0 and 1, where values above 1 indicate a violation. The two classes that exceeded the limit for LCOM were CreateOperationCommand (in the application layer) and FieldEntity (in the infrastructure layer). CreateOperationCommand is an API input DTO with twenty-six fields, which naturally leads to lower apparent cohesion due to its data aggregation function. FieldEntity, in turn, reflects the complexity of the relational model. In both cases, the structural complexity and the specific function of the classes justify the LCOM values, and they are not interpreted as failures of functional cohesion, but rather as inherent characteristics of state and data representation (Filó et al., 2024). The application and infrastructure layers presented average LCOMs of 0.24 and 0.14, respectively, indicating high cohesion in the vast majority of classes.

The Lines of Code (LOC) metric provides a measure of software size. Although not directly a quality metric, very high values can indicate technical debt and maintenance difficulty (Filó et al., 2024). Table 1 shows full 100% compliance for LOC, with all two hundred and forty classes classified as “good”. No classes were classified as “moderate” or “bad”.

The layer distribution in Table 2 indicates that the domain layer has an average LOC of 24.23, the application 20.37, and the infrastructure 13.59. The upper limit of one hundred and fifty lines of code per class, adopted in this work based on industrial practices, was not exceeded by any class. The highest LOC value observed was eighty-nine, well below the limit. This result suggests an effective distribution of responsibilities among aggregates, services, and factories, avoiding the creation of “god objects” or excessively large classes. A low LOC contributes to code readability, facilitates peer review, and reduces debugging effort, positively impacting team productivity and software quality in the long term.

The Response for a Class (RFC) metric measures the number of methods in a class plus the number of external methods called by that class. A low RFC is desirable in DDD, as it indicates simpler domain services and effective isolation of calls, aligned with the explicit ports principle (Hanifah et al., 2024). Table 1 shows full 100% compliance for RFC, with all two hundred and forty classes classified as “good”. No classes were classified as “moderate” or “bad”.

The layered analysis in Table 2 reveals that the domain layer has an average RFC of 2.67, the application 5.41, and the infrastructure 2.62. The thresholds defined by Filó et al. (2024) consider values up to fifty as acceptable and indicative of low complexity. The fact that no class presented moderate or poor values for RFC demonstrates that there was no breakdown of isolation due to excessive calls from use cases, confirming the effectiveness of the explicit ports principle in hexagonal architecture. This means that the classes have well-defined responsibilities and interact in a controlled manner, which facilitates unit and integration testability, in addition to promoting a cleaner and more understandable design.

The Number of Children (NOC) metric counts the number of subclasses that inherit from a class. High NOC values can indicate greater difficulty in system maintenance and evolution due to increased modification impacts (Hanifah et al., 2024). In DDD, although inheritance is used, the preference is for shallow hierarchies to avoid excessive complexity. Table 1 shows a 99.58% compliance for NOC, with two hundred and thirty-nine “good” classes and only one “bad” one. No classes were classified as “moderate”.

The layered distribution in Table 2 indicates that the domain layer has an average NOC of 0.59, the application 0, and the infrastructure 0.05. Hanifah et al. (2024) study points out that values below four are considered “good”. The only code unit with a critical NOC value was DomainEvent, a class from the cross-cutting module Kernel. This class is used to describe the domain event contract, defining the event publishing mechanism. All domain events inherit from DomainEvent. However, this occurrence does not represent a violation of inheritance design, as domain events do not share behavior among themselves, but rather a common contract for their identification and handling. Therefore, this inheritance is a strategic application of a DDD tactical pattern, not an indication of undue complexity that hinders maintenance. The low NOC in the application and infrastructure layers demonstrates that the project avoided excessive abstractions and complex inheritance hierarchies, which is beneficial for code clarity and maintainability.

The Architectural Quality Compliance Index (AQCI) of 97.32% reflects the robustness of the implemented architecture. In the layer distribution, the domain layer achieved full compliance in four out of seven metrics, and the other metrics showed compliance values above 94%. The application layer maintained full compliance in five out of seven metrics, while the infrastructure layer achieved it in four metrics, which is justified by the points discussed previously, such as the need to interact with frameworks and the relational model. The points of attention, concentrated mainly on the DIT metric with 92.29% compliance, are explained by the use of tactical DDD patterns, which, although they increase inheritance depth in specific cases, do so in a controlled and justified manner.

Architectural compliance was significantly strengthened by the implementation of twenty-eight automated tests using the ArchUnit library, as detailed in the Architectural Tests Document. These tests were crucial for rigorously verifying the dependency rules between the hexagonal architecture layers, locality and naming conventions, inheritance hierarchies, contracts, and adherence to DDD principles, such as immutability of events and value objects, absence of cycles, and domain isolation. It is inferred that the observed indices for LOC, RFC, WMC, and DIT were positively impacted by the discipline imposed by these tests, which acted as a continuous validation mechanism, preventing violations and ensuring that design decisions were maintained throughout development. The presence of these automated tests not only validated the architecture but also served as living documentation of the architectural rules, facilitating the future maintenance and evolution of the system.

The communication between contexts and modules in Fonagro, which occurs through domain events, is a crucial aspect of the architecture and is managed in the infrastructure layer. Figure 3 illustrates the property deactivation policy, an example of how contexts communicate through events and policies (“listeners”).

Source: Original survey data

Figure 3. Property deactivation policy implemented in the Example communication between contexts and modules through events and policies (“listeners”) project

This asynchronous, event-driven communication approach contributes directly to low coupling between modules, a pillar of the modular monolith and DDD. The use of the “Delegate Pattern” in conjunction with the “Adapter Pattern” to maintain isolation between layers, delegating implementations to the application layer and keeping external annotations and resources in the infrastructure, as shown in Figure 4, is a practical example of how the hexagonal architecture protects the domain from infrastructure details.

Source: Original survey data

Figure 4. Service adapter to isolate responsibilities of the “application” and “infrastructure” layers. General scheme of the “Delegate Pattern” implementation

The decision to adopt a modular monolith, as illustrated in Figure 11 (Comparison between the architectural models of a traditional monolith and a modular monolith), for the Fonagro project, especially being a “greenfield” project and a Minimum Viable Product (MVP), proved to be strategic. This model combines the simplicity of a monolith with the low coupling and high cohesion of microservices (Guntakandla, 2025). The “multi-schema” approach for the database, where each module operates on an isolated schema, even within a single PostgreSQL database, reinforces the DDD “Bounded-Context” concept. This logical separation, without direct relationships between tables of different contexts via “constraints”, ensures that communication and coordination between modules are handled by the application, promoting even greater isolation and facilitating future refactorings or an eventual migration to microservices (Faustino et al., 2024).

In summary, the results obtained demonstrate that the hexagonal architecture, when applied in conjunction with the principles of Domain-Driven Design and the modular monolith approach, provides robust structural support for the development of complex systems. The consistently high code quality metrics, low coupling, high cohesion, and domain isolation, validated by ArchUnit tests, confirm the effectiveness of this architectural combination. Although the study was limited to a “greenfield” project with a single module and author, the findings are valid within the defined scope and offer valuable insights for software engineering, especially in domains with high functional complexity such as agribusiness. The ability to maintain code clarity, maintainability, and adaptability, even in the face of inherent business complexity, is a testament to the suitability of the hexagonal architecture for such challenges.

4. Conclusion

It is concluded that the objective was achieved, evaluating the impacts of the hexagonal architecture on the applicability of Domain-Driven Design in a “greenfield” agricultural management project, through the analysis of code quality metrics in an event-driven modular monolith. The results obtained, with an Architectural Quality Compliance Index (ICQA) of 97.32%, demonstrate the robustness of the implemented architecture. The consistently high code quality metrics, low coupling, high cohesion, and domain isolation, validated by automated tests, confirm the effectiveness of the combination of hexagonal architecture with Domain-Driven Design principles and the modular monolith approach. This structure provided robust support for the development of complex systems, maintaining code clarity, maintainability, and adaptability, even in the face of the complexity inherent in agribusiness.

However, the study presents some important limitations. The work did not perform a comparison between different architectural models, focusing only on the proposed solution. Furthermore, as it is a “greenfield” project and a Minimum Viable Product (MVP), only one Production module was developed by a single author. Although these characteristics restrict the generalization of the results to other contexts, they do not compromise the validity of the observations within the defined scope. For future studies, it is suggested to conduct comparative research between layered and microservices architectural models, in order to validate the possible generalization of the findings and explore the evolution from the modular monolith to microservices, deepening the understanding of the applicability of these approaches in different software development scenarios.

Bibliographic References

Aziz, S.R.; Khan, T.A.; Nadeem, A. 2021. Exclusive use and evaluation of inheritance metrics viability in software fault prediction: an experimental study. PeerJ Computer Science 7: e563. Disponível em: https://doi.org/10.7717/peerj-cs.563. Acesso em: 16 abr. 2026.

Centro de Estudos Avançados em Economia Aplicada [CEPEA-ESALQ/USP]. 2025. PIB do agronegócio brasileiro cresce 18% em 2024, aponta estudo do Cepea. Disponível em: https://www.cepea.org.br/br/pib-do-agronegocio-brasileiro.aspx. Acesso em: 31 mar. 2026.

Cockburn, A.; Garrido de Paz, J.M. 2024. Hexagonal Architecture Explained: How the Ports & Adapters Architecture Simplifies Your Life, and How to Implement It. Humans and Technology Press, Gulfport, FL, EUA.

Faustino, D.; Gonçalves, N.; Portela, M.; Silva, A.R. 2024. Stepwise migration of a monolith to a microservice architecture: performance and migration effort evaluation. Performance Evaluation 164: 102411. Disponível em: https://doi.org/10.1016/j.peva.2024.102411. Acesso em: 31 mar. 2026.

Filó, T.G.S.; Bigonha, M.A.S.; Ferreira, K.A.M. 2024. Evaluating thresholds for object-oriented software metrics. Journal of the Brazilian Computer Society 30: 1.

Guntakandla, A.R. 2025. Modular architecture: a scalable and efficient system design approach for enterprise applications. World Journal of Advanced Research and Reviews 26(1): 3114-3126. Disponível em: https://doi.org/10.30574/wjarr.2025.26.1.1340. Acesso em: 31 mar. 2026.

Hanifah, H.; Irawati, A.R.; Utami, Y.T. 2024. Implementasi pengukuran object oriented metrics (studi kasus aplikasi Movie DB). Jurnal Pepadun 5(3): 238-248.

Khononov, V. 2022. Aprenda domain-driven design: alinhando arquitetura de software e estratégia de negócios. 1ed. Alta Books, Rio de Janeiro, RJ, Brasil.

Litvinov, A.A. 2020. On business logic layer design and architecture. System Technologies 1(126): 86-94. Disponível em: https://doi.org/10.34185/1562-9945-1-126-2020-09. Acesso em: 31 mar. 2026.

Lösch, S.; Rambo, C.A.; Ferreira, J.L. 2023. A pesquisa exploratória na abordagem qualitativa em educação. Revista Ibero-Americana de Estudos em Educação 18(0): e023141. Disponível em: https://periodicos.fclar.unesp.br/iberoamericana/article/view/17958. Acesso em: 31 mar. 2026.

Mendes-da-Silva, F.M.; Albertin, A.L. 2024. A influência do alinhamento estratégico TI-negócio na transformação e sustentação do negócio pré-digital. Revista de Administração Contemporânea 28(4): e240128.

Prykhodko, S.B.; Prykhodko, K.S.; Smykodub, T.G. 2022. A statistical estimation of the coupling between objects metric for open-source apps developed in Java. Herald of Advanced Information Technology 5(3): 175-184. Disponível em: https://doi.org/10.15276/hait.05.2022.13. Acesso em: 31 mar. 2026.

Vernon, V. 2024. Domain-driven design destilado. Alta Books, Rio de Janeiro, RJ, Brasil.

Özkan, O.; Babur, Ö.; van den Brand, M. 2025. Domain-Driven Design in software development: a systematic literature review on implementation, challenges, and effectiveness. Journal of Systems and Software 230: 112537.

Article originating from the Final Course Work of the Specialization in Software Engineering of the MBA USP/Esalq

To learn more about the course, click here and access the MBX Academy platform

You may also like

Executive Mba In Leadership And Management

November 23, 2026

Improvements in the efficiency of a secondary biological sludge drying plant

The management of industrial solid waste, especially secondary biological sludge, represented an operational and strategic challenge for a company in the pulp and paper sector. A secondary biological sludge drying plant, installed to meet environmental requirements and reduce costs, operated with low efficiency and high unavailability. The objective of this study was to evaluate and propose a set of actions to increase the operational availability of the plant, ensure the integral processing of the generated sludge, and reduce treatment and transportation costs, in addition to mitigating environmental risks. To this end, an analysis of the root causes of low efficiency was carried out, using tools such as the cause-and-effect diagram (Ishikawa) and the “5 whys” analysis, and hypotheses were tested to identify the most impactful factors. Three main root causes were identified: addition of low-load effluent to the process, absence of a dedicated maintenance team, and lower consistency of dewatered sludge. The proposed countermeasures, which included stopping the addition of effluent, hiring a maintenance team, and testing polymers, had a monthly implementation cost of R$ 35,000.00. An annual reduction in operating expenses of up to R$ 1,800,000.00 and maintenance costs of R$ 600,000.00 was estimated, in addition to a 25% reduction in operational unavailability. It was concluded that the proposed measures are viable, quick to implement, and capable of ensuring the integral processing of secondary biological sludge, strengthening the company’s ESG strategy and ensuring environmental compliance.

Keywords: Operational costs; Operational efficiency; ESG; Biological sludge; Sludge drying.

Data Science And Analytics For Operations

November 19, 2026

Polyp-YOLO: an efficient, low-latency detector for polyps in colonoscopies

The early detection of colorectal polyps is crucial for the prevention of colorectal cancer, and real-time computer-aided detection (CADe) systems have shown gains in endoscopic practice. The objective was to develop and validate a lightweight colorectal polyp detector, based on the YOLO architecture, capable of operating on restricted hardware with high precision and low latency. The methodology used public datasets of endoscopic images, partitioning the Kvasir-SEG dataset for training and internal validation, and CVC-ClinicDB and ETIS-Larib Polyp DB for cross-dataset evaluation. Lightweight variants of the YOLOv8, YOLO11, and YOLO26 families with 640×640 pixel input were evaluated. A grid search tested 70 combinations of optimizers and activation functions, and identified AdaBelief and LeakyReLU as the configuration with the best generalization. The optimization pipeline applied unstructured pruning, knowledge distillation, and fine-tuning. The optimized YOLO11n-seg model outperformed the higher-capacity architecture (YOLO26m-seg) in mAP50 and showed similar performance in F1-Score, operating with approximately seven times fewer parameters. It achieved an mAP50 of 0.7929 and an F1-Score of 0.7514 on the ETIS-Larib dataset, and fast inference was demonstrated in different formats, with real-time latencies. The explainability of predictions was validated by Grad-CAM activation maps. The proposed solution demonstrated itself to be a promising experimental tool for diagnostic support, with technical feasibility for integration into environments with reduced computational power, although it requires future clinical validation.

Keywords: Computer-aided detection; Edge computing; Hyperparameter optimization; Endoscopic image segmentation; Medical computer vision.

Data Science And Analytics For Operations

November 19, 2026

Multi-touch Attribution in E-commerce: A Comparison between Markov Chains and Last-Click

The research investigated Multi-touch Attribution (MTA) Models in e-commerce, seeking to overcome the limitations of the Last-Click model, widely used in the market. The objective was to compare the performance of first-order Markov Chains with Last-Click and Position-Based approaches, identifying the value of assistance channels frequently ignored. To this end, Markov Chain algorithms were applied to a large volume of purchase journey data from the Google Merchandise Store, extracted via BigQuery. The study probabilistically mapped the purchase journey and calculated the Removal Effect to quantify channel relevance. The results demonstrated that data-driven models identified the strategic role of discovery (awareness) and assistance channels, which Last-Click neglected in 65% of complex journeys. Simulated financial analysis indicated an approximate 28% hidden efficiency in Cost Per Acquisition (CPA) for Paid Search, compared to the Last-Click model. It was concluded that Markov Chains allowed for a more accurate mapping of purchase journeys, validating the technical feasibility of the modeling and providing evidence for more efficient budget allocation in digital media, mitigating the risk of early divestment in crucial channels.

Keywords: Assistance channels; Data science; E-commerce; Digital marketing; Media optimization.

Project Management

November 19, 2026

Integrated Software for Operational Communication and Control: Practical Evidence in a Medium-Sized Company

The study analyzed the impacts of the lack of integration between commercial and operational modules of an integrated management software (ERP/CRM) in a medium-sized company in the mechanical engineering sector. The main objective was to evaluate practical evidence of communication and operational control optimization, identify bottlenecks, and formulate improvement proposals. A qualitative-quantitative approach was adopted through a single case study with documentary research, based on the extraction and filtering of historical task records from the Bitrix24 software and statistical correlation analysis between workload and allocated team. Based on the diagnosis, an action plan structured in the 5W2H tool was developed. The results revealed that 54.4% of the registered tasks consisted of duplicate, test, or practically useless records, generated by manual insertion during the scope transition between commercial CRM and engineering. It was also demonstrated that the increase in the commercial team linearly accompanied the growth of inefficient tasks, polluting the database and masking the organization’s real productive capacity. It was concluded that the automation of workflows and native integration between modules are essential to mitigate operational and financial risks, providing replicable guidelines for data governance in small and medium-sized enterprises.

Keywords: System Customization; Enterprise Resource Planning (ERP); Task Management; Management Software.

Project Management

November 19, 2026

Supervised learning in voltammetric quantification with electrochemical sensors

The application of supervised learning in the voltammetric quantification of paraquat in artificial urine was evaluated. The study aimed to quantitatively assess the predictive performance of supervised learning models compared to a univariate “baseline”, preserving independence between devices in the training and testing sets. The research was conducted as an applied case study, processing data from four physical devices, each evaluated under a blank condition and six paraquat concentration levels, totaling 28 square wave voltammetry (SWV) curves. A computational “pipeline” integrated automated file reading, organization of curves into current-potential matrices, generation of potential maps, and device-specific blank correction. Five approaches were considered: conventional univariate calibration, predictive univariate “baseline”, partial least squares (PLS) regression, support vector regression (SVR), and random forest (RF). Predictive evaluation was performed using device-grouped cross-validation. PLS showed the best predictive performance for curves from a device not used in training, with an R² of 0.7981. RF exhibited intermediate performance, while SVR and the predictive univariate “baseline” showed inferior and similar performance between themselves. It was concluded that a compact multivariate representation of the voltammetric profile was more favorable for inter-device prediction than increasing model flexibility under the studied conditions. Grouped validation preserved independence, but the limited number of devices restricts the generalization of results.

Keywords: Supervised learning; Paraquat; PLS; Electrochemical sensors; Square wave voltammetry.

Project Management

November 19, 2026

Improvement of Inventory Management via Lean Six Sigma: Study in the Paper Industry

Organizations seek methodologies to reduce waste, increase efficiency, and become more competitive, promoting sustainable improvements in their processes. In this context, the study aimed to apply the Lean Six Sigma methodology, through the DMAIC cycle, to improve inventory management in a company in the paper industry manufacturing pneumatic hoses, aiming to increase the accuracy between physical and systemic inventories and improve the visual management of parts storage. The research was developed from the collection and analysis of data extracted from the company’s ERP system. Tools such as SIPOC, Ishikawa Diagram, and 5 Whys were used to define and identify the root cause of the problem. As improvement proposals, a Digital Kanban system and an adaptation of the Two-Bin system, called the Three-Bin System, were implemented, in addition to the development of standardized operating procedures and the establishment of control mechanisms. The results demonstrated a significant improvement in inventory accuracy, raising the lowest identified index from 28% to 80%, and detected discrepancies between systemic and physical records equivalent to R$ 134,335.53. It was concluded that the application of Lean Six Sigma, combined with Project Management, represented an effective approach for conducting operational improvement projects, contributed to increased reliability of inventory information, to the improvement of material control processes, and to the strengthening of the organization’s operational management.

Keywords: Inventory accuracy; DMAIC; Visual management.

Data Science And Analytics For Operations

November 19, 2026

Predictive Analysis Methodology for Performance Optimization in E-commerce: Correlation between Public Data and Paid Media

A predictive analysis methodology was developed for e-commerce, integrating transactional data and public search trends. The objective was to develop and validate a predictive model, based on machine learning algorithms, capable of correlating organic search trends with sales performance and paid media costs in the Beauty and Health category of Brazilian e-commerce. The Brazilian E-Commerce Public Dataset by Olist and data from Google Trends were used, processed in Python with the Random Forest Regressor algorithm. A moderate inverse correlation (r = -0.43) with a seven-day lag was identified between organic search volume and purchase. Initial models, based solely on behavioral variables, presented insufficient metrics (R² = -0.47; MAE of R$ 2,120.54). The incorporation of microeconomic (average ticket and shipping) and macroeconomic (exchange rate and Ibovespa index) variables raised the R² of the final model to 0.29, with an MAE of R$ 1,489.63, representing a 24.7% reduction in error compared to the baseline. Temporal cross-validation showed that, in periods of mature operation (2018), the model achieved an R² of 0.42. It was concluded that isolated search volume explains the moment of consumer interest, but not the financial magnitude of sales, making the fusion with transactional and economic data mandatory for predictive viability.

Keywords: Beauty and Health; Consumer Behavior; Google Trends; Machine Learning; Time Series.