April 06, 2019 , ☕️ 4 min read
Components are the units of deployment, they are the smallest entity that can be deployed as part of the system, In Java, they are Jar files, In Ruby, they are gems files.
Components can be linked together into a single executable or they can be independently deployed as separate plugins, regardless of how they have eventually deployed well-designed components always retain the ability to be independently deployed and developed.
the granule of reuse is the granule of release.
To reuse a software component you can’t do so unless that component tracked through a release process and is given a release number because without a release number there would be no way to ensure that all the reused components that you’re using are compatible with each other.
This principle means that the classes and modules that are formed into a component must belong t a cohesive group. a software component can not consist of random classes and modules there’s must be some overarching theme of purpose.
gather into component those classes that change for the same reason and at the same time separate into different components those classes that change at a different time and for different reasons.
The CCP is the component form for the SRP, while the SRP tells us to separate methods into different classes if they change for different reasons, the CCP tells us to separate classes into different components if they change for different reasons.
Don’t force users of a component to depend on things they don’t need.
Finally, that was a very simple introduction to how to develop a cohesive component, helping you to take the decision of which classes belong in which components.
Personal blog by Mustafa Hussain. I share what I learned about Software Engineering, Productivity, and building new habits on my Youtube channel and blog. Feel free to join my newsletter to follow along.