Common Symptoms
- A Project layer module contains a conspicuous amount of concrete code.
Why does it occur?
Typically a component needs to combine functionality from multiple features, and a substantial amount of additional code is needed in the Project layer to facilitate this.
What problems can it cause?
Project modules are where your application is given context (e.g. it forms a specific site). Too much functional code in the project layer can prevent reusability becuase that code is specific to the individual context.
What's the solution?
The project layer should primarily be used for composition. That means taking elements from the various Feature and Foundation modules within your solution to form a cohesive application. IIf you find that you need to write a lot of "application" code in the project layer, then there are a few potential reasons:
Missing Foundation Abstraction - Logic is often added to the project layer to provide indirect communication between features. This often suggestes a missing abstraction in Foundation layer that could be utilized by the features, leaving less logic in the Project layer.
Poorly defined Feature boundaries - Is the reason that you are being forced to combine multiple Features simply because they are too granular? Could elements of one Feature be moved to another, or could they merged entirely?
The overall aim is get most of your funcionality into the project layer. If you find yourself writing "new" functional code, you need to think about how it could be pushed down to a module.
Related Reading
- The Fat Project smell can occur as a byproduct of trying to avoid the Fat Foundation smell.
- Deciding on Feature boundaries is a balance between making sure each one is as small as possible while still being self contained. The packaging principles that deal with these issues directly are the Common Reuse Principle and the Reuse Release Equivalance Principle.
I'll update the post over time as my thoughts on the subject evolve.
Comments
Post a Comment