The next problem solving technique is Cohesion and Coupling. These terms are often contrasted with one another. They have an inverse relationship. Low coupling equals high cohesion and vice versa. According to Wikipedia, “Low coupling is often a sign of a well-structured computer system and a good design, and when combined with high cohesion, supports the general goals of high readability and maintainability.” Cohesion is defined as a measure of the internal statement of a method serve to accomplish the method’s purpose. Coupling is the degree to which one program module depends on the methods of another. In programming this can be seen in a simple Java color bar tool. I recently had to complete this color bar as a final assignment for my Java class. The first part of the program built the individual bars and color ranges with a color selector sliding bar. The second part of the program was tightly coupled with the first in that it really depended much on the methods in my first program. It did this by creating a swatch that showed the colors of various blends of blue, red, and green. Unfortunately, because this was so tightly coupled, a simple typo in my first program caused me major headaches in the second.
References:
http://en.wikipedia.org/wiki/Coupling_(computer_science)
No comments:
Post a Comment