Software Development Methodologies |
Lecture 6 | |
Software Development Methodologies Home - Lecture Support - Lecture 6 | |
|
Quick Links
|
Coupling and Message Passthrough Coupling and cohesion are key concepts when considering whether a system has been designed well or poorly. In both cases, these concepts imply that class structures (or modules in structured analysis and design) which are designed to be as independent of each other as possible. Specifically, good coupling seeks to reduce the number of connections between classes or modules. In object oriented systems, good coupling leads to minimising the number of messages passed between objects. On occasions, coupling can occur where there are structures formed from aggregation. Under these circumstances, some higher level objects may 'delegate' messages to their constituent object parts. This is known as 'message passthrough' and is a form of coupling. It is desirable because in passing through a message, the higher level object is relying on its part to execute the operation. Cohesion Good cohesion seeks to make classes, operations within classes or modules as self-contained as possible; in other words, they have one goal and only one goal. For example, a cohesive operation would be one that had a single task to perform and had no side-effects. Use measures of complexity to avoid over-complex behaviour and to identify candidates for simplification It is important to design classes (and their operations) to be easy to maintain. One measure of maintainability is to calculate the complexity measure of each operation using a measurement such as McCabe's cyclomatic complexity. Where operations are complex, for example, with many IF statements, you have candidates for simplification. One thing to consider is whether there are any opportunities for introducing sub-classes, inheritance and polymorphism in order to simplify operations. The importance of reuse and dealing with its associated problems A key goal with the object oriented approach is to maximise the reuse of class descriptions. By reusing existing classes, considerable savings in development costs can be achieved. However, there is an upfront cost in making an existing class reusable in the first place. This upfront cost can create a tension in organisations- the issue being who should pay for it- the original project creating the object or some other means. |
Quick Tips |
||
|
||||
|