04. When Good Design Goes Bad

UML requires big design up-front, synchronization of diagrams and code. However, it is useful for communication.

What we’ve learned:

Design Erosion

AKA: architectural drift, software aging, architecture erosion, software decay, software rot, software entropy.

When the initial design becomes more and more obsolete:

Consequences:

Eventually, a replacement, rewrite, re-engineering or refactor becomes required.

So what to do when changes occur?

  1. Optimal design strategy
  1. Minimal effort strategy

‘Natural’ Rot

… the design of a software project is documented primarily by its source code

Robert C. Martin

To destroy an abandoned building, cut a hole in the roof and wait for it to rot from the inside out.

Software works the same way; without proper maintenance, a small hole can lead it to decaying from the inside.

Broken window theory: hacks in software normalize other hacks, leading to a spiraling descent in quality.

Symptoms of rot:

Preventing Rot

Address problems immediately:

Class Discussion: How Do Classical and Modern Processes Influence Design Erosion

Waterfall:

Agile:

Waterfall in business:

Design/Code Smells

NB: code smells can also refer to good smells.

An indication/symptom that something may be wrong: but does this mean it should be fixed? Two approaches:

Smells: Within Classes

Smells: Between Classes

Metrics

If you can’t measure it, you can’t improve it

Peter Drucker

You can’t control what you can’t measure

Tom DeMarco

Some context-dependent measure of a project, usually measured over time to track how the project is improving or getting worse. However, the context can change over time, making interpreting the metrics and making comparisons over time more difficult.

Benefits:

Dangers:

Difficulties:

Alternativ ways to identify code smells:

Measurements

McCabe’s Cyclomatic Complexity:

Chidmaber and Kemerer OO Metrics:

  1. Weighted methods per class (WMC)
  1. Depth of inheritance tree (DIT)
  1. Number of children (NOC)
  1. Coupling between objects (CBO)
  1. Response for class (RFC)
  1. Lack of cohesion in methods (LCOM):

TODO Lorenz and Kidd:

'Ar

Smells:

Other:

Refactoring

Refactoring will TODO

When to refactor?

TODO

Corerectness:

Rewrites:

Reengineering:

TODO