CSE403 Software Engineering, Autumn 1999

David Notkin


Lecture #7 Notes

Design (Overview)


1)       Understand the basic principles underlying software design

a)       Modularization

b)       Coupling

c)       Cohesion

d)       Understand that the driving force behind design is managing complexity

e)       Provides a basis for studying information hiding, layering, patterns, etc.

2)       Readings

a)       Bergland’s paper gives a related view to today’s lecture (plus lots more I won’t cover)

b)       Please, please, please read the next two Parnas papers by the scheduled dates

3)       What is design?

a)       The activity that leads from requirements to implementation

b)       A description that represents a key aspect of this activity

c)       If the requirements are the “what” the design (with an associated implementation) is the “how”

4)       Design space

a)       There are many designs that satisfy a given set of requirements

b)       There are also many designs that may at first appear to satisfy the requirements, but don’t on further study

c)       Collectively, these form a design space

d)       A designer walks this space evaluating designs

5)       Design: managing complexity

a)       Of course, this design space isn’t just sitting out there for you to search like a library catalog or the WWW

b)       You must also generate the designs

c)       A key aspect of design generation is understanding that the goal is to achieve the requirements in the face of the limitations of the human mind and the need for teams to develop products

6)       Dijkstra

a)       From “Programming considered as a human activity”

b)       “The technique of mastering complexity has been known since ancient times: Divide et impera (Divide and rule). … I assume the programmer’s genius matches the difficulty of his problem and assume that he has a arrived at a suitable subdivision of the task.”

c)       This final assumption is troubling!  It’s a big part of the job of software design!

7)       Decomposition

a)       Design is largely a process of finding decompositions that help humans manage the complexity

b)       Understand that the design satisfies the requirements

c)       Allow relatively independent progress of team members

d)       Support later changes effectively

e)       Not all decompositions are equally good!

8)       Decompositions

a)       A decomposition specifies a set of components (modules) and the interactions among those modules

b)       It is often the case that the components are related to parts of an object model

c)       The degree of detail in the specification varies

9)       Aside: Composition

a)       Decomposition

b)       The classic view of design

c)       Given a fixed set of requirements, what decomposition is best?

d)       Composition

e)       An increasingly common view of design

f)        Given a set of available components, what design that exploits them is best?

g)       Are there slightly different requirements that are easier to achieve given those components?

10)    Comparing designs

a)       Not all decompositions are equally good

b)       So, on what basis do we compare and contrast them?

c)       Indeed, on what basis do we even generate them?

d)       Parnas said: “Usually nothing is said about the criteria to be used in dividing the system into modules.”

e)       Criteria: delayed discussion

i)         I will not talk about the criteria for choosing a decomposition today

ii)       We’ll surely cover this, especially with respect to information hiding

iii)      Reminder: the readings are crucial in this class!

11)    What I will instead do is cover some about how to compare and contrast decompositions

a)       Coupling and cohesion

b)       Given a decomposition of a system into modules, one can partially assess the design in terms of cohesion and coupling

c)       Loosely, cohesion assesses why the elements are grouped together in a module

d)       Loosely, coupling assesses the kind and quantity of interconnections among modules

12)    Kinds of cohesion

a)       Elements can be placed together to provide an abstract data type

i)         if they are all executed about the same time (say, during initialization or termination)\

ii)       because they will be assigned to a single person

iii)      because they start with the same letter

iv)     because...

13)    “Good” vs. “bad” cohesion

a)       Bergland talks about different levels of cohesion

b)       Best: functional, where the elements collectively provide a specific behavior or related behaviors

c)       Worst: coincidental, where the elements are collected for no reason at all

d)       Many other levels in between

e)       Cohesion is not measurable quantitatively

14)    Coupling

a)      Coupling assesses the interactions between modules

b)       It is important to distinguish kind and strength

c)       kind: A calls B, C inherits from D, etc.

d)       And directionality

e)       strength: the number of interactions

15)    “Good” vs. “bad” coupling

a)       Modules that are loosely coupled (or uncoupled) are better than those that are tightly coupled

b)       Why? Because of the objective of modules to help with human limitations

c)       The more tightly coupled are two modules, the harder it is to think about them separately, and thus the benefits become more limited

16)    How to assess coupling?

a)       Kinds of interconnections

b)       Strengths of interconnections

c)       There are lots of approaches to quantitatively measuring coupling

d)       I’m not especially satisfied by any of them

e)       They are not broadly used in industry

f)        More used in reengineering than forward engineering

g)       They are beyond the scope of this class

17)    What kind (of relations)?

a)       There are many kinds of interconnections (relations) to consider

i)         calls, invokes, accesses, …

ii)       how about invokes in an OO language using dynamic dispatch?

iii)      others?

18)    Question: how many different relations are there among components of a software system?

19)    names vs. invokes

a)       Here is an example of a mix of relations

b)       Module A registers interest with an event that B can announce

c)       When B announces that event, a function in A is invoked

d)       A knows the name of B, but B doesn’t know the name of A

20)    Hierarchical designs

a)       Loose coupling is often associated with hierarchical designs

b)       They also tend to arise from repeated refinements of a design

c)       Hierarchies are often more coupled than they appear

d)       Because of other relations

21)    Strength of interconnection

a)       Q: does a module that relies on an ADT module have stronger interconnection if it makes calls to all the exported methods (as opposed to only a couple of them)?

b)       Q: what if it calls one or two methods, but it calls them millions of times each?

c)       Q: what if it has more kinds of relations with that module?

d)       Bergland says more

22)    Complexity

a)       A design with really complex modules is worse than a design with simpler modules

b)       Complexity is brutally hard to measure

c)       Correctness

d)       Correct designs dominate incorrect ones

23)    Correspondence

a)       How closely does it map to the requirements specification? 

b)       This is critical to evolution!

c)       Use a single module?

d)       Great cohesion!

e)       No coupling!

f)        Where’s the failure?

24)    Coupling and cohesion…

a)       …are just guidelines

b)       Again, they don’t by themselves give criteria for modular decomposition

c)       We’ll get to that in the next lectures