Skip to content

Commit

Permalink
add section on packages vs modules
Browse files Browse the repository at this point in the history
  • Loading branch information
Artemas-Muzanenhamo committed Sep 6, 2023
1 parent 836dd87 commit a26fb3b
Showing 1 changed file with 95 additions and 0 deletions.
95 changes: 95 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,101 @@ Below is a visual representation of the hexagonal architecture:

##### Packages vs Modules

Using packages and modules, such as Gradle Modules, to build an application based on the Hexagonal Architecture , each have their own advantages and disadvantages.

With Packages:

Pros:
<details>
<summary>Simplicity:</summary> Using packages is straightforward and doesn't require additional tools or configuration. It's a native way of organizing code in many programming languages.
</details>
<details>
<summary>
Ease of Use:
</summary>
Developers are already familiar with packages, as they are a fundamental part of most programming languages. There's no need for them to learn a new tool or framework for managing modules.
</details>
<details>
<summary>
Flexibility:
</summary>
Packages allow for a flexible organization of code. You can decide on your package structure based on the needs of your application.
</details>
<details>
<summary>
Compatibility:
</summary>
Packages work well with most development environments and tools, making it easier to integrate with existing workflows.
</details>

Cons:
<details>
<summary>
Limited Encapsulation:
</summary>
Packages may not provide as strong encapsulation as modules. In some languages, classes within the same package can access each other's internals, which can lead to accidental violations of architectural boundaries.
</details>
<details>
<summary>
Dependency Management:
</summary>
It can be challenging to manage dependencies between packages, especially in large and complex applications. Ensuring that dependencies flow in the correct direction can require careful discipline.
</details>
<details>
<summary>
Tooling:
</summary>
Some languages and development ecosystems may not provide strong tooling for enforcing architectural constraints when using packages alone.
</details>

Using Modules (e.g., Gradle Modules):

Pros:
<details>
<summary>
Strong Encapsulation:
</summary>
Modules often provide stronger encapsulation, allowing you to explicitly specify which classes and packages are accessible from outside the module. This can help enforce architectural boundaries more rigorously.
</details>
<details>
<summary>
Dependency Management:
</summary>
Modules typically have more advanced dependency management capabilities, allowing you to explicitly declare module dependencies. This can make it easier to ensure that dependencies follow architectural rules.
</details>
<details>
<summary>
Isolation:
</summary>
Modules can be built and tested independently, promoting isolation and better separation of concerns. This can lead to more modular and maintainable code.
</details>
<details>
<summary>
Tooling:
</summary>
Some build tools, like Gradle, offer powerful module management and build capabilities, which can be useful for large-scale applications.
</details>

Cons:
<details>
<summary>
Complexity:
</summary>
Setting up and managing modules, especially in larger projects, can be more complex than using packages. It may require additional tooling and configuration.
</details>
<details>
<summary>
Learning Curve:
</summary>
Developers who are not familiar with module systems may need time to learn how to use them effectively.
</details>
<details>
<summary>
Compatibility:
</summary>
Some older or less widely used programming languages and environments may not support modules, making it less suitable for certain projects.
</details>

##### Gradle Modules

##### Arch Unit
Expand Down

0 comments on commit a26fb3b

Please sign in to comment.