Skip to main content

Why Design Principles Exist — The Cost of Bad Design

Editorial

Introduction

By now you can write classes, give them fields and methods, build hierarchies with inheritance, and connect objects by association, aggregation and composition. Code built that way can work well on the day it ships. This part of the course is about what happens after that day, when the requirements change and the code has to change with them.

Robert C. Martin described what goes wrong in his 2000 paper "Design Principles and Design Patterns". A design starts out clean, and then "The software starts to rot. At first it isn't so bad." Small hacks pile up, until "the sheer effort required to make even the simplest of changes to the application becomes so high that the engineers and front line managers cry for a redesign project."

Here we look at how that rot shows itself, work through a class that has it, and then meet the principles meant to keep it away. Most of the cost of software comes after its first release, in changing it; Why LLD Matters — The 70% Maintenance Problem shows the numbers.

How a Design Rots

Martin names the signs: "There are four primary symptoms that tell us that our designs are rotting." They are rigidity, fragility, immobility and viscosity.

Rigidity is "the tendency for software to be difficult to change, even in simple ways. Every change causes a cascade of subsequent changes in dependent modules." A change planned for two days spreads through module after module and takes weeks. Martin adds that managers then grow afraid to let engineers fix anything that is not urgent.

Fragility is "the tendency of the software to break in many places every time it is changed. Often the breakage occurs in areas that have no conceptual relationship with the area that was changed." You fix the search, and the profile page stops loading. Every fix starts to feel like a risk.

Immobility is "the inability to reuse software from other projects or from parts of the same project." The piece you want, say the pricing rules, is tied to so much else that pulling it out costs more than writing it again.

Viscosity is about the easy way and the right way. When a change can be made two ways, one that keeps the design and one that is a hack: "When the design preserving methods are harder to employ than the hacks, then the viscosity of the design is high. It is easy to do the wrong thing, but hard to do the right thing." Martin also names a viscosity of the environment: when a build takes so long that engineers pick the change that avoids a rebuild, even when it hurts the design.

An Example: One Class That Does Everything

Here is a class you might write early on. OrderProcessor takes an order and does everything that follows from it in one method: it works out the tax, takes the payment, emails the customer, reduces the stock, prints the invoice and records an analytics event. Prices are kept in whole cents, so every language prints the same total.

from dataclasses import dataclass


@dataclass
class Item:
    """One item of an order, priced in whole cents so every language agrees"""
    name: str
    category: str
    price_cents: int


class OrderProcessor:
    """A class that does everything for an order. It works, and it ships on time.
    Every team that needs a change has to edit this one method."""

    def __init__(self):
        self._orders = []

    def process_order(self, customer: str, items: list[Item],
                      payment_type: str) -> None:
        # --- Tax: the finance team's rules ---
        total = 0
        for item in items:
            if item.category == "electronics":
                total += item.price_cents * 115 // 100  # 15% tax
            elif item.category == "food":
                total += item.price_cents * 105 // 100  # 5% tax
            elif item.category == "clothing":
                total += item.price_cents * 110 // 100  # 10% tax
            else:
                total += item.price_cents
        amount = "$" + self.dollars(total)

        # --- Payment: the payments team's code ---
        # A new payment type means editing this class.
        if payment_type == "credit_card":
            print(f"Charging credit card for {amount}")
        elif payment_type == "paypal":
            print(f"Processing PayPal payment for {amount}")
        elif payment_type == "crypto":
            print(f"Processing crypto payment for {amount}")
        else:
            raise ValueError(f"unsupported payment type {payment_type}")

        # --- Email: the marketing team's message ---
        print(f"Email to {customer}: order confirmed, total {amount}")

        # --- Stock: the warehouse ---
        for item in items:
            print(f"Reducing stock of {item.name} by 1")

        # --- Invoice: the legal team's format ---
        print(f"INVOICE for {customer}: {amount}")

        # --- Analytics: the data team's event ---
        print(f"[Analytics] {len(items)} items, {amount}")

        self._orders.append(customer)

    def order_count(self) -> int:
        return len(self._orders)

    @staticmethod
    def dollars(cents: int) -> str:
        """Whole cents as dollars and cents, the same in every locale"""
        return f"{cents // 100}.{cents % 100:02d}"


def main() -> None:
    processor = OrderProcessor()
    processor.process_order("Alice", [
        Item("Laptop", "electronics", 100000),
        Item("Bread", "food", 400),
        Item("T-shirt", "clothing", 2500)], "credit_card")
    try:
        processor.process_order("Bob", [Item("Novel", "books", 1500)], "apple_pay")
    except ValueError as e:
        print(f"Order for Bob refused: {e}")
    print(f"Orders recorded: {processor.order_count()}")


if __name__ == "__main__":
    main()
import java.util.ArrayList;
import java.util.List;

// One item of an order, priced in whole cents so every language agrees
record Item(String name, String category, int priceCents) {
}

// A class that does everything for an order. It works, and it ships on time.
// Every team that needs a change has to edit this one method.
public class OrderProcessor {
    private final List<String> orders = new ArrayList<>();

    public void processOrder(String customer, List<Item> items, String paymentType) {
        // --- Tax: the finance team's rules ---
        int total = 0;
        for (Item item : items) {
            switch (item.category()) {
                case "electronics" -> total += item.priceCents() * 115 / 100; // 15% tax
                case "food" -> total += item.priceCents() * 105 / 100; // 5% tax
                case "clothing" -> total += item.priceCents() * 110 / 100; // 10% tax
                default -> total += item.priceCents();
            }
        }
        String amount = "$" + dollars(total);

        // --- Payment: the payments team's code ---
        // A new payment type means editing this class.
        switch (paymentType) {
            case "credit_card" ->
                    System.out.println("Charging credit card for " + amount);
            case "paypal" ->
                    System.out.println("Processing PayPal payment for " + amount);
            case "crypto" ->
                    System.out.println("Processing crypto payment for " + amount);
            default -> throw new IllegalArgumentException(
                    "unsupported payment type " + paymentType);
        }

        // --- Email: the marketing team's message ---
        System.out.println("Email to " + customer + ": order confirmed, total "
                + amount);

        // --- Stock: the warehouse ---
        for (Item item : items) {
            System.out.println("Reducing stock of " + item.name() + " by 1");
        }

        // --- Invoice: the legal team's format ---
        System.out.println("INVOICE for " + customer + ": " + amount);

        // --- Analytics: the data team's event ---
        System.out.println("[Analytics] " + items.size() + " items, " + amount);

        orders.add(customer);
    }

    public int orderCount() {
        return orders.size();
    }

    // Whole cents as dollars and cents, the same in every locale
    static String dollars(int cents) {
        int rest = cents % 100;
        return cents / 100 + "." + (rest < 10 ? "0" : "") + rest;
    }

    public static void main(String[] args) {
        OrderProcessor processor = new OrderProcessor();
        processor.processOrder("Alice", List.of(
                new Item("Laptop", "electronics", 100000),
                new Item("Bread", "food", 400),
                new Item("T-shirt", "clothing", 2500)), "credit_card");
        try {
            processor.processOrder("Bob", List.of(new Item("Novel", "books", 1500)),
                    "apple_pay");
        } catch (IllegalArgumentException e) {
            System.out.println("Order for Bob refused: " + e.getMessage());
        }
        System.out.println("Orders recorded: " + processor.orderCount());
    }
}
#include <iostream>
#include <stdexcept>
#include <string>
#include <vector>

// One item of an order, priced in whole cents so every language agrees
struct Item {
    std::string name;
    std::string category;
    int priceCents;
};

// A class that does everything for an order. It works, and it ships on time.
// Every team that needs a change has to edit this one method.
class OrderProcessor {
public:
    void processOrder(const std::string& customer, const std::vector<Item>& items,
                      const std::string& paymentType) {
        // --- Tax: the finance team's rules ---
        int total = 0;
        for (const Item& item : items) {
            if (item.category == "electronics") {
                total += item.priceCents * 115 / 100; // 15% tax
            } else if (item.category == "food") {
                total += item.priceCents * 105 / 100; // 5% tax
            } else if (item.category == "clothing") {
                total += item.priceCents * 110 / 100; // 10% tax
            } else {
                total += item.priceCents;
            }
        }
        const std::string amount = "$" + dollars(total);

        // --- Payment: the payments team's code ---
        // A new payment type means editing this class.
        if (paymentType == "credit_card") {
            std::cout << "Charging credit card for " << amount << "\n";
        } else if (paymentType == "paypal") {
            std::cout << "Processing PayPal payment for " << amount << "\n";
        } else if (paymentType == "crypto") {
            std::cout << "Processing crypto payment for " << amount << "\n";
        } else {
            throw std::invalid_argument("unsupported payment type " + paymentType);
        }

        // --- Email: the marketing team's message ---
        std::cout << "Email to " << customer << ": order confirmed, total " << amount
                  << "\n";

        // --- Stock: the warehouse ---
        for (const Item& item : items) {
            std::cout << "Reducing stock of " << item.name << " by 1\n";
        }

        // --- Invoice: the legal team's format ---
        std::cout << "INVOICE for " << customer << ": " << amount << "\n";

        // --- Analytics: the data team's event ---
        std::cout << "[Analytics] " << items.size() << " items, " << amount << "\n";

        orders.push_back(customer);
    }

    int orderCount() const { return static_cast<int>(orders.size()); }

    // Whole cents as dollars and cents, the same in every locale
    static std::string dollars(int cents) {
        const int rest = cents % 100;
        return std::to_string(cents / 100) + "." + (rest < 10 ? "0" : "") +
               std::to_string(rest);
    }

private:
    std::vector<std::string> orders;
};

int main() {
    OrderProcessor processor;
    processor.processOrder("Alice",
                           {{"Laptop", "electronics", 100000},
                            {"Bread", "food", 400},
                            {"T-shirt", "clothing", 2500}},
                           "credit_card");
    try {
        processor.processOrder("Bob", {{"Novel", "books", 1500}}, "apple_pay");
    } catch (const std::invalid_argument& e) {
        std::cout << "Order for Bob refused: " << e.what() << "\n";
    }
    std::cout << "Orders recorded: " << processor.orderCount() << "\n";
}
// One item of an order, priced in whole cents so every language agrees
class Item {
  constructor(
    readonly name: string,
    readonly category: string,
    readonly priceCents: number,
  ) {}
}

// A class that does everything for an order. It works, and it ships on time.
// Every team that needs a change has to edit this one method.
class OrderProcessor {
  private readonly orders: string[] = [];

  processOrder(customer: string, items: Item[], paymentType: string): void {
    // --- Tax: the finance team's rules ---
    let total = 0;
    for (const item of items) {
      if (item.category === "electronics") {
        total += Math.floor((item.priceCents * 115) / 100); // 15% tax
      } else if (item.category === "food") {
        total += Math.floor((item.priceCents * 105) / 100); // 5% tax
      } else if (item.category === "clothing") {
        total += Math.floor((item.priceCents * 110) / 100); // 10% tax
      } else {
        total += item.priceCents;
      }
    }
    const amount = "$" + OrderProcessor.dollars(total);

    // --- Payment: the payments team's code ---
    // A new payment type means editing this class.
    if (paymentType === "credit_card") {
      console.log(`Charging credit card for ${amount}`);
    } else if (paymentType === "paypal") {
      console.log(`Processing PayPal payment for ${amount}`);
    } else if (paymentType === "crypto") {
      console.log(`Processing crypto payment for ${amount}`);
    } else {
      throw new Error(`unsupported payment type ${paymentType}`);
    }

    // --- Email: the marketing team's message ---
    console.log(`Email to ${customer}: order confirmed, total ${amount}`);

    // --- Stock: the warehouse ---
    for (const item of items) {
      console.log(`Reducing stock of ${item.name} by 1`);
    }

    // --- Invoice: the legal team's format ---
    console.log(`INVOICE for ${customer}: ${amount}`);

    // --- Analytics: the data team's event ---
    console.log(`[Analytics] ${items.length} items, ${amount}`);

    this.orders.push(customer);
  }

  orderCount(): number {
    return this.orders.length;
  }

  // Whole cents as dollars and cents, the same in every locale
  static dollars(cents: number): string {
    const rest = cents % 100;
    return `${Math.floor(cents / 100)}.${rest < 10 ? "0" : ""}${rest}`;
  }
}

function main(): void {
  const processor = new OrderProcessor();
  processor.processOrder(
    "Alice",
    [
      new Item("Laptop", "electronics", 100000),
      new Item("Bread", "food", 400),
      new Item("T-shirt", "clothing", 2500),
    ],
    "credit_card",
  );
  try {
    processor.processOrder("Bob", [new Item("Novel", "books", 1500)], "apple_pay");
  } catch (e) {
    console.log(`Order for Bob refused: ${(e as Error).message}`);
  }
  console.log(`Orders recorded: ${processor.orderCount()}`);
}

main();
using System;
using System.Collections.Generic;

// One item of an order, priced in whole cents so every language agrees
public record Item(string Name, string Category, int PriceCents);

// A class that does everything for an order. It works, and it ships on time.
// Every team that needs a change has to edit this one method.
public class OrderProcessor
{
    private readonly List<string> orders = new List<string>();

    public void ProcessOrder(string customer, List<Item> items, string paymentType)
    {
        // --- Tax: the finance team's rules ---
        int total = 0;
        foreach (Item item in items)
        {
            switch (item.Category)
            {
                case "electronics":
                    total += item.PriceCents * 115 / 100; // 15% tax
                    break;
                case "food":
                    total += item.PriceCents * 105 / 100; // 5% tax
                    break;
                case "clothing":
                    total += item.PriceCents * 110 / 100; // 10% tax
                    break;
                default:
                    total += item.PriceCents;
                    break;
            }
        }
        string amount = "$" + Dollars(total);

        // --- Payment: the payments team's code ---
        // A new payment type means editing this class.
        switch (paymentType)
        {
            case "credit_card":
                Console.WriteLine("Charging credit card for " + amount);
                break;
            case "paypal":
                Console.WriteLine("Processing PayPal payment for " + amount);
                break;
            case "crypto":
                Console.WriteLine("Processing crypto payment for " + amount);
                break;
            default:
                throw new ArgumentException("unsupported payment type " + paymentType);
        }

        // --- Email: the marketing team's message ---
        Console.WriteLine("Email to " + customer + ": order confirmed, total "
            + amount);

        // --- Stock: the warehouse ---
        foreach (Item item in items)
        {
            Console.WriteLine("Reducing stock of " + item.Name + " by 1");
        }

        // --- Invoice: the legal team's format ---
        Console.WriteLine("INVOICE for " + customer + ": " + amount);

        // --- Analytics: the data team's event ---
        Console.WriteLine("[Analytics] " + items.Count + " items, " + amount);

        orders.Add(customer);
    }

    public int OrderCount()
    {
        return orders.Count;
    }

    // Whole cents as dollars and cents, the same in every locale
    public static string Dollars(int cents)
    {
        int rest = cents % 100;
        return (cents / 100) + "." + (rest < 10 ? "0" : "") + rest;
    }

    public static void Main(string[] args)
    {
        OrderProcessor processor = new OrderProcessor();
        processor.ProcessOrder("Alice", new List<Item>
        {
            new Item("Laptop", "electronics", 100000),
            new Item("Bread", "food", 400),
            new Item("T-shirt", "clothing", 2500),
        }, "credit_card");
        try
        {
            var bob = new List<Item> { new Item("Novel", "books", 1500) };
            processor.ProcessOrder("Bob", bob, "apple_pay");
        }
        catch (ArgumentException e)
        {
            Console.WriteLine("Order for Bob refused: " + e.Message);
        }
        Console.WriteLine("Orders recorded: " + processor.OrderCount());
    }
}
package main

import "fmt"

// Item is one item of an order, priced in whole cents so every language agrees.
type Item struct {
	Name       string
	Category   string
	PriceCents int
}

// OrderProcessor does everything for an order. It works, and it ships on time.
// Every team that needs a change has to edit this one method.
type OrderProcessor struct {
	orders []string
}

// ProcessOrder runs every step of an order in one method.
// Go has no exceptions: an unsupported payment type comes back as an error.
func (p *OrderProcessor) ProcessOrder(customer string, items []Item,
	paymentType string) error {
	// --- Tax: the finance team's rules ---
	total := 0
	for _, item := range items {
		switch item.Category {
		case "electronics":
			total += item.PriceCents * 115 / 100 // 15% tax
		case "food":
			total += item.PriceCents * 105 / 100 // 5% tax
		case "clothing":
			total += item.PriceCents * 110 / 100 // 10% tax
		default:
			total += item.PriceCents
		}
	}
	amount := "$" + dollars(total)

	// --- Payment: the payments team's code ---
	// A new payment type means editing this type.
	switch paymentType {
	case "credit_card":
		fmt.Println("Charging credit card for " + amount)
	case "paypal":
		fmt.Println("Processing PayPal payment for " + amount)
	case "crypto":
		fmt.Println("Processing crypto payment for " + amount)
	default:
		return fmt.Errorf("unsupported payment type %s", paymentType)
	}

	// --- Email: the marketing team's message ---
	fmt.Println("Email to " + customer + ": order confirmed, total " + amount)

	// --- Stock: the warehouse ---
	for _, item := range items {
		fmt.Println("Reducing stock of " + item.Name + " by 1")
	}

	// --- Invoice: the legal team's format ---
	fmt.Println("INVOICE for " + customer + ": " + amount)

	// --- Analytics: the data team's event ---
	fmt.Printf("[Analytics] %d items, %s\n", len(items), amount)

	p.orders = append(p.orders, customer)
	return nil
}

// OrderCount says how many orders went through.
func (p *OrderProcessor) OrderCount() int {
	return len(p.orders)
}

// dollars writes whole cents as dollars and cents, the same in every locale.
func dollars(cents int) string {
	return fmt.Sprintf("%d.%02d", cents/100, cents%100)
}

func main() {
	processor := &OrderProcessor{}
	alice := []Item{
		{"Laptop", "electronics", 100000},
		{"Bread", "food", 400},
		{"T-shirt", "clothing", 2500},
	}
	if err := processor.ProcessOrder("Alice", alice, "credit_card"); err != nil {
		fmt.Println("Order for Alice refused: " + err.Error())
	}
	bob := []Item{{"Novel", "books", 1500}}
	if err := processor.ProcessOrder("Bob", bob, "apple_pay"); err != nil {
		fmt.Println("Order for Bob refused: " + err.Error())
	}
	fmt.Printf("Orders recorded: %d\n", processor.OrderCount())
}

It prints:

Charging credit card for $1181.70
Email to Alice: order confirmed, total $1181.70
Reducing stock of Laptop by 1
Reducing stock of Bread by 1
Reducing stock of T-shirt by 1
INVOICE for Alice: $1181.70
[Analytics] 3 items, $1181.70
Order for Bob refused: unsupported payment type apple_pay
Orders recorded: 1

Alice's order goes through. Bob's is refused, because the method knows only three ways to pay. Without that refusal, an Apple Pay order would go on to be confirmed, stocked down and invoiced without ever being charged.

The class works, and it ships on time. The trouble starts with the next change. Each row below is a request from a different team, and every one of them lands in the same method:

Change requestWho asksWhere it lands
Add Apple PayPayments teamprocessOrder, its payment part
Tax electronics at 18%Finance teamprocessOrder, its tax part
Send an SMS instead of an emailMarketing teamprocessOrder, its email part
Change the invoice format for the EULegal teamprocessOrder, its invoice part
Add an analytics eventData teamprocessOrder, its analytics part

Five teams wait on one method, and each of them has to understand all six jobs before touching it, because the jobs share one method and one total. A slip in any part can break the others: change the tax rule, and the payment, the email, the invoice and the analytics all print a different amount. That is rigidity and fragility in one class. And the payment code cannot be reused anywhere else, in a refund screen for example, without dragging the tax, the email and the invoice along with it, which is immobility.

Send the Change Requests

Send the five requests and watch where each one lands. Every request is an edit to processOrder, so after each one all six jobs are tested again. Send Finance's tax change and watch the new total travel down the wire into four jobs that nobody edited.

Each team's change request lands in the one method that holds all six jobs; the tax change also moves the total that four other jobs print.

Where the Rot Comes From

Martin does not blame the requirements for changing. They always change, and a design has to live with that: "If our designs are failing due to the constant rain of changing requirements, it is our designs that are at fault."

He traces the rot to one cause: "Each of the four symptoms mentioned above is either directly, or indirectly caused by improper dependencies between the modules of the software." In OrderProcessor those dependencies are easy to see. The payment, the email, the invoice and the analytics all read the total that the tax part works out, inside one method, so a change to the tax rules reaches all four, and nothing in the design keeps the parts apart. Design principles are about where such lines of dependency should run.

What Design Principles Are

Design principles are guidelines for organizing code so that it stays easy to change as it grows. They come from people who maintained large systems and noticed which decisions made later changes cheap and which made them expensive.

They help with questions you meet every day. Should this logic go in this class or in a new one? Should these two classes know about each other? How can a feature be added without editing code that already works? How will someone else, or you in a year, find their way around?

They are not laws. A thirty-line script does not need its parts split into classes, and the value of a principle grows with the size of the code and the time it has to live.

The Five SOLID Principles

The best-known set of principles for object-oriented design is SOLID: five principles whose first letters spell the word. The picture sets them beside the four signs of rot:

How a design rots, and the SOLID principles. Across the top, the four signs that a design is rotting, each drawn. Rigidity: six modules, an edit in each, arrows carrying the first edit along the top row and back along the bottom one; one change forces edits across many files. Fragility: a grid of nine modules, an edit in one corner and a crack in the far corner, nothing joining them; a change here breaks something unrelated there. Immobility: a useful module roped to three others it drags along, its way to another project crossed out; useful code can't be reused, because it is too tangled. Viscosity: from a start to a flag, a short dashed line marked hack and a long winding line marked keeps the design; the hack is easier than the change that keeps the design. A line says all four grow from tangled dependencies between modules, and five principles keep them in check: S, Single Responsibility, a class has one reason to change; O, Open and Closed, open to extend and closed to modify; L, Liskov Substitution, subtypes must stand in for their base; I, Interface Segregation, no client depends on methods it ignores; D, Dependency Inversion, depend on abstractions rather than details.

Martin stated four of them in his 2000 paper, each in one line. The Open/Closed Principle: "A module should be open for extension but closed for modification." He credits it to the work of Bertrand Meyer. The Liskov Substitution Principle: "Subclasses should be substitutable for their base classes." It comes from Barbara Liskov's work on data abstraction. The Interface Segregation Principle: "Many client specific interfaces are better than one general purpose interface". The Dependency Inversion Principle: "Depend upon Abstractions. Do not depend upon concretions." The fifth, the Single Responsibility Principle, says that a class should have one reason to change; it is not in that paper, and S — Single Responsibility Principle covers it in full.

Each principle has a page of its own, in this order: S — Single Responsibility Principle, O — Open/Closed Principle, L — Liskov Substitution Principle, I — Interface Segregation Principle and D — Dependency Inversion Principle. SOLID in Action — Refactoring a Bad Design then applies all five to one design.

The order processor already shows how two of them connect. Give each job a class of its own and let OrderProcessor only call them: that is the Single Responsibility Principle, and the finance team now edits the tax class and nothing else. Then put the payment behind an interface, with one class for each way to pay, and Apple Pay becomes a new class added beside the others, with no edit to the code that already works: that is the Open/Closed Principle.

More Principles After SOLID

Common Misconceptions

"Principles are rules to follow every time." They are guidelines. A small script or a quick prototype gains nothing from five layers of classes, and splitting it costs more than it saves. The bigger the code and the longer it must live, the more the principles pay.

"More classes make the program slower." A design with more, smaller classes is not slower by any rule. When speed matters, measure it, and change the design where the measurement points. What the principles save is people's time: reading the code, changing it and testing it.

"Apply every principle before writing any code." Many good designs take their shape while they are being built. Martin Fowler, writing about evolutionary design in "Is Design Dead?", says that "designers need to learn how to do a simple design, how to use refactoring to keep a design clean, and how to use patterns in an evolutionary style." Start simple, and reach for a principle when a change starts to hurt: the same edit spreading through many files, or a fix that breaks something far away. Code Smells — Recognizing Bad Design lists the signs to watch for.

"SOLID is only for object-oriented code." Martin wrote the principles for object-oriented design, in terms of classes and modules. Some of the ideas reach further: a function that takes another function as a parameter depends only on that function's signature, whatever implementation is passed in, much as the Dependency Inversion Principle asks a class to depend on an abstraction.

Key Takeaways

  • A design rots in four ways that Martin named: rigidity, fragility, immobility and viscosity.
  • He traces all four to dependencies between modules, and holds the design responsible when changing requirements break it.
  • Design principles are guidelines for where those dependencies run; their value grows with the size and the life of the code.
  • SOLID is five of them, single responsibility, open/closed, Liskov substitution, interface segregation and dependency inversion, each with a page of its own.

The two measures behind all of this, coupling and cohesion, come next in Coupling and Cohesion — The Two Measures of a Design.