I was reading ploeh's blog this morning and it made me think about coupling and cohesion in general. These are import concepts in software development, Wikipedia has great definitions for both here & here. These are often contrasted together but they are different concepts and just because you have low coupling doesn't mean you'll have high cohesion.
Using a car analogy the headlight unit for my Audi has tight (high) coupling because it's designed only to be fitted to a particular version. You could say it has high cohesion because it is part of a greater system to show light when a button is turned\clicked....
Taking another part of the car the tyre, the actual type of tyre will have low coupling to my Audi because it would suitable for several different models and makes, it would also have low coupling to the wheel, it has to fit a particular size but it could fit many wheels of this size. The tyre would still have high cohesion for the same reason, part of a greater system to make a car move...
The box in the boot (trunk) of the car has low cohesion because it contains all the stuff I drive round with, not just stuff such as oil, glass cleaner, foot pump etc. but stuff I have just left in the car overtime. There only relation is they are all in the same box.
What I find interesting about measures of coupling, is there related cost: the higher the coupling the more likely there will be few options available to replace\maintain which means higher costs, where as low coupling allows for multiple solutions and therefore more likely reduced costs.
Using a car analogy the headlight unit for my Audi has tight (high) coupling because it's designed only to be fitted to a particular version. You could say it has high cohesion because it is part of a greater system to show light when a button is turned\clicked....
Taking another part of the car the tyre, the actual type of tyre will have low coupling to my Audi because it would suitable for several different models and makes, it would also have low coupling to the wheel, it has to fit a particular size but it could fit many wheels of this size. The tyre would still have high cohesion for the same reason, part of a greater system to make a car move...
The box in the boot (trunk) of the car has low cohesion because it contains all the stuff I drive round with, not just stuff such as oil, glass cleaner, foot pump etc. but stuff I have just left in the car overtime. There only relation is they are all in the same box.
What I find interesting about measures of coupling, is there related cost: the higher the coupling the more likely there will be few options available to replace\maintain which means higher costs, where as low coupling allows for multiple solutions and therefore more likely reduced costs.
Comments
Post a Comment