Separation of Concerns — One Job per Part
Introduction
A small shop prints a receipt for every order. The code that does it reads the order, works out the prices and a discount, and prints the lines, all in one function. It works. Then the orders start arriving with semicolons between the fields, the shop moves the point where its discount begins, and the receipt needs a currency sign. These are three unrelated changes, and every one of them means opening the same function, reading all of it, and checking that the other jobs still work.
Separation of concerns is the habit of keeping such jobs apart, so that each part of a program deals with one concern and knows as little as it can about the others. A concern here means one aspect of the problem: where the data comes from, which rule applies to it, or how the result is shown.
The picture shows the receipt program written both ways, with each line of code drawn as a bar in the colour of the job it does:

Where the Idea Comes From
The phrase comes from Edsger Dijkstra, who used it in a 1974 essay and said he had sometimes called the idea that before. He was describing what he saw as the mark of all intelligent thinking: that "one is willing to study in depth an aspect of one's subject matter in isolation for the sake of its own consistency, all the time knowing that one is occupying oneself only with one of the aspects." His example was a program, which must be correct and should be efficient, and the two can be studied on different days. He called this the separation of concerns, which he admitted can never be done completely, and yet it was, in his words, "the only available technique for effective ordering of one's thoughts, that I know of." He added that focusing on one aspect "does not mean ignoring the other aspects".
Two years earlier, David Parnas had made a related point about dividing programs. His 1972 paper took one small program and divided it into modules in two ways. The usual way, in his words, was "to make each major step in the processing a module", the way a flowchart reads. His way gave each module one design decision to keep to itself. Then he listed changes the program might meet. A new input format stayed inside one module in both designs, but a change to how the lines are kept in memory reached every module of the first. His conclusion, as Robert Martin quotes it: "We propose instead that one begins with a list of difficult design decisions or design decisions which are likely to change. Each module is then designed to hide such a decision from the others."
Martin counts these papers among the roots of the Single Responsibility Principle, and puts the everyday version plainly: "This is the reason we do not generate HTML in the modules that compute results."
One Function, Three Jobs
Here is the receipt program with its three jobs in one function. The order is a few lines of text, one product a line: its name, how many, and the price of one in cents. Orders of 100.00 or more get 10% off.
# One function with three jobs: it reads the order from text, applies the
# pricing rule, and prints the receipt, all in the same loop.
ORDER = """
Notebook,3,450
Pen,10,120
Backpack,1,8900
"""
def print_receipt(order_text: str) -> None:
print("Receipt")
subtotal = 0
for row in order_text.strip().splitlines():
name, quantity, price = row.split(",")
cost = int(quantity) * int(price)
subtotal += cost
print(f"{name} x{quantity}: {cost // 100}.{cost % 100:02d}")
discount = subtotal // 10 if subtotal >= 10000 else 0
total = subtotal - discount
print(f"Discount: {discount // 100}.{discount % 100:02d}")
print(f"Total: {total // 100}.{total % 100:02d}")
if __name__ == "__main__":
print_receipt(ORDER)import java.util.Locale;
// One method with three jobs: it reads the order from text, applies the
// pricing rule, and prints the receipt, all in the same loop.
public class Receipt {
static final String ORDER = """
Notebook,3,450
Pen,10,120
Backpack,1,8900
""";
static void printReceipt(String orderText) {
System.out.println("Receipt");
int subtotal = 0;
for (String row : orderText.strip().split("\n")) {
String[] fields = row.split(",");
int quantity = Integer.parseInt(fields[1]);
int cost = quantity * Integer.parseInt(fields[2]);
subtotal += cost;
System.out.println(String.format(Locale.ROOT, "%s x%d: %d.%02d",
fields[0], quantity, cost / 100, cost % 100));
}
int discount = subtotal >= 10000 ? subtotal / 10 : 0;
int total = subtotal - discount;
System.out.println(String.format(Locale.ROOT, "Discount: %d.%02d",
discount / 100, discount % 100));
System.out.println(String.format(Locale.ROOT, "Total: %d.%02d",
total / 100, total % 100));
}
public static void main(String[] args) {
printReceipt(ORDER);
}
}#include <cstdio>
#include <sstream>
#include <string>
// One function with three jobs: it reads the order from text, applies the
// pricing rule, and prints the receipt, all in the same loop.
const std::string ORDER = R"(
Notebook,3,450
Pen,10,120
Backpack,1,8900
)";
void printReceipt(const std::string& orderText) {
std::printf("Receipt\n");
int subtotal = 0;
std::istringstream rows(orderText);
std::string row;
while (std::getline(rows, row)) {
if (row.empty()) {
continue;
}
std::istringstream fields(row);
std::string name, quantity, price;
std::getline(fields, name, ',');
std::getline(fields, quantity, ',');
std::getline(fields, price, ',');
int cost = std::stoi(quantity) * std::stoi(price);
subtotal += cost;
std::printf("%s x%s: %d.%02d\n", name.c_str(), quantity.c_str(), cost / 100,
cost % 100);
}
int discount = subtotal >= 10000 ? subtotal / 10 : 0;
int total = subtotal - discount;
std::printf("Discount: %d.%02d\n", discount / 100, discount % 100);
std::printf("Total: %d.%02d\n", total / 100, total % 100);
}
int main() {
printReceipt(ORDER);
}// One function with three jobs: it reads the order from text, applies the
// pricing rule, and prints the receipt, all in the same loop.
const ORDER = `
Notebook,3,450
Pen,10,120
Backpack,1,8900
`;
function printReceipt(orderText: string): void {
const money = (cents: number) =>
`${Math.floor(cents / 100)}.${String(cents % 100).padStart(2, "0")}`;
console.log("Receipt");
let subtotal = 0;
for (const row of orderText.trim().split("\n")) {
const [name, quantity, price] = row.split(",");
const cost = Number(quantity) * Number(price);
subtotal += cost;
console.log(`${name} x${quantity}: ${money(cost)}`);
}
const discount = subtotal >= 10000 ? Math.floor(subtotal / 10) : 0;
const total = subtotal - discount;
console.log(`Discount: ${money(discount)}`);
console.log(`Total: ${money(total)}`);
}
printReceipt(ORDER);using System;
// One method with three jobs: it reads the order from text, applies the
// pricing rule, and prints the receipt, all in the same loop.
public class Receipt
{
const string Order = "Notebook,3,450\nPen,10,120\nBackpack,1,8900\n";
static void PrintReceipt(string orderText)
{
Console.WriteLine("Receipt");
int subtotal = 0;
foreach (string row in orderText.Trim().Split('\n'))
{
string[] fields = row.Split(',');
int quantity = int.Parse(fields[1]);
int cost = quantity * int.Parse(fields[2]);
subtotal += cost;
Console.WriteLine(
$"{fields[0]} x{quantity}: {cost / 100}.{cost % 100:D2}");
}
int discount = subtotal >= 10000 ? subtotal / 10 : 0;
int total = subtotal - discount;
Console.WriteLine($"Discount: {discount / 100}.{discount % 100:D2}");
Console.WriteLine($"Total: {total / 100}.{total % 100:D2}");
}
public static void Main()
{
PrintReceipt(Order);
}
}package main
import (
"fmt"
"strconv"
"strings"
)
// One function with three jobs: it reads the order from text, applies the
// pricing rule, and prints the receipt, all in the same loop.
const order = `
Notebook,3,450
Pen,10,120
Backpack,1,8900
`
func printReceipt(orderText string) error {
fmt.Println("Receipt")
subtotal := 0
for _, row := range strings.Split(strings.TrimSpace(orderText), "\n") {
fields := strings.Split(row, ",")
quantity, err := strconv.Atoi(fields[1])
if err != nil {
return err
}
price, err := strconv.Atoi(fields[2])
if err != nil {
return err
}
cost := quantity * price
subtotal += cost
fmt.Printf("%s x%d: %d.%02d\n", fields[0], quantity, cost/100, cost%100)
}
discount := 0
if subtotal >= 10000 {
discount = subtotal / 10
}
total := subtotal - discount
fmt.Printf("Discount: %d.%02d\n", discount/100, discount%100)
fmt.Printf("Total: %d.%02d\n", total/100, total%100)
return nil
}
func main() {
if err := printReceipt(order); err != nil {
fmt.Println(err)
}
}It prints:
Receipt
Notebook x3: 13.50
Pen x10: 12.00
Backpack x1: 89.00
Discount: 11.45
Total: 103.05
Read the function line by line and the jobs take turns: it prints a heading, starts a subtotal, reads a row and splits it, works out a cost, prints a line, and after the loop works out the discount and prints again. Nothing here is wrong, and at this size the function is easy to follow. The cost shows up when things change. A new order format, a new discount rule and a new receipt layout all land in this one function, and whoever makes one of them has to read past the other jobs to do it. The pricing rule cannot even be run on its own: it needs text to read, and it prints a receipt as it goes.
The Same Program, Concerns Apart
Here is the same program with each job in its own function: parse_order reads, price_order prices, and money with format_receipt writes.
# The same program with its three concerns apart: reading the order, pricing
# it, and writing the receipt. Each part can change, or be run, on its own.
from dataclasses import dataclass
ORDER = """
Notebook,3,450
Pen,10,120
Backpack,1,8900
"""
@dataclass(frozen=True)
class Item:
name: str
quantity: int
price_cents: int
@dataclass(frozen=True)
class Line:
name: str
quantity: int
cost_cents: int
@dataclass(frozen=True)
class Bill:
lines: list[Line]
discount: int
total: int
# Reading: text in, items out. It knows the format and nothing about prices.
def parse_order(order_text: str) -> list[Item]:
items = []
for row in order_text.strip().splitlines():
name, quantity, price = row.split(",")
items.append(Item(name, int(quantity), int(price)))
return items
# Pricing: items in, a bill out. It knows the rule and nothing about text.
def price_order(items: list[Item]) -> Bill:
lines = [Line(i.name, i.quantity, i.quantity * i.price_cents) for i in items]
subtotal = sum(line.cost_cents for line in lines)
discount = subtotal // 10 if subtotal >= 10000 else 0
return Bill(lines, discount, subtotal - discount)
# Writing: a bill in, the receipt's text out. It knows the layout.
def money(cents: int) -> str:
return f"{cents // 100}.{cents % 100:02d}"
def format_receipt(bill: Bill) -> str:
rows = ["Receipt"]
for line in bill.lines:
rows.append(f"{line.name} x{line.quantity}: {money(line.cost_cents)}")
rows.append(f"Discount: {money(bill.discount)}")
rows.append(f"Total: {money(bill.total)}")
return "\n".join(rows)
def main() -> None:
bill = price_order(parse_order(ORDER))
print(format_receipt(bill))
# The pricing rule run on its own: no text to read, nothing printed by it
small = price_order([Item("Pen", 2, 120)])
print(f"Pricing alone, 2 pens: total {money(small.total)}, "
f"discount {money(small.discount)}")
if __name__ == "__main__":
main()import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
// The same program with its three concerns apart: reading the order, pricing
// it, and writing the receipt. Each part can change, or be run, on its own.
record Item(String name, int quantity, int priceCents) {}
record Line(String name, int quantity, int costCents) {}
record Bill(List<Line> lines, int discount, int total) {}
public class Shop {
static final String ORDER = """
Notebook,3,450
Pen,10,120
Backpack,1,8900
""";
// Reading: text in, items out. It knows the format and nothing about prices.
static List<Item> parseOrder(String orderText) {
List<Item> items = new ArrayList<>();
for (String row : orderText.strip().split("\n")) {
String[] fields = row.split(",");
int quantity = Integer.parseInt(fields[1]);
items.add(new Item(fields[0], quantity, Integer.parseInt(fields[2])));
}
return items;
}
// Pricing: items in, a bill out. It knows the rule and nothing about text.
static Bill priceOrder(List<Item> items) {
List<Line> lines = new ArrayList<>();
int subtotal = 0;
for (Item item : items) {
int cost = item.quantity() * item.priceCents();
lines.add(new Line(item.name(), item.quantity(), cost));
subtotal += cost;
}
int discount = subtotal >= 10000 ? subtotal / 10 : 0;
return new Bill(lines, discount, subtotal - discount);
}
// Writing: a bill in, the receipt's text out. It knows the layout.
static String money(int cents) {
return String.format(Locale.ROOT, "%d.%02d", cents / 100, cents % 100);
}
static String formatReceipt(Bill bill) {
List<String> rows = new ArrayList<>(List.of("Receipt"));
for (Line line : bill.lines()) {
String cost = money(line.costCents());
rows.add(line.name() + " x" + line.quantity() + ": " + cost);
}
rows.add("Discount: " + money(bill.discount()));
rows.add("Total: " + money(bill.total()));
return String.join("\n", rows);
}
public static void main(String[] args) {
Bill bill = priceOrder(parseOrder(ORDER));
System.out.println(formatReceipt(bill));
// The pricing rule run on its own: no text to read, nothing printed by it
Bill small = priceOrder(List.of(new Item("Pen", 2, 120)));
System.out.println("Pricing alone, 2 pens: total " + money(small.total())
+ ", discount " + money(small.discount()));
}
}#include <iostream>
#include <sstream>
#include <string>
#include <vector>
// The same program with its three concerns apart: reading the order, pricing
// it, and writing the receipt. Each part can change, or be run, on its own.
const std::string ORDER = R"(
Notebook,3,450
Pen,10,120
Backpack,1,8900
)";
struct Item {
std::string name;
int quantity;
int priceCents;
};
struct Line {
std::string name;
int quantity;
int costCents;
};
struct Bill {
std::vector<Line> lines;
int discount;
int total;
};
// Reading: text in, items out. It knows the format and nothing about prices.
std::vector<Item> parseOrder(const std::string& orderText) {
std::vector<Item> items;
std::istringstream rows(orderText);
std::string row;
while (std::getline(rows, row)) {
if (row.empty()) {
continue;
}
std::istringstream fields(row);
std::string name, quantity, price;
std::getline(fields, name, ',');
std::getline(fields, quantity, ',');
std::getline(fields, price, ',');
items.push_back({name, std::stoi(quantity), std::stoi(price)});
}
return items;
}
// Pricing: items in, a bill out. It knows the rule and nothing about text.
Bill priceOrder(const std::vector<Item>& items) {
std::vector<Line> lines;
int subtotal = 0;
for (const Item& item : items) {
int cost = item.quantity * item.priceCents;
lines.push_back({item.name, item.quantity, cost});
subtotal += cost;
}
int discount = subtotal >= 10000 ? subtotal / 10 : 0;
return {lines, discount, subtotal - discount};
}
// Writing: a bill in, the receipt's text out. It knows the layout.
std::string money(int cents) {
std::string rest = std::to_string(cents % 100);
return std::to_string(cents / 100) + "." + (rest.size() < 2 ? "0" : "") + rest;
}
std::string formatReceipt(const Bill& bill) {
std::string out = "Receipt";
for (const Line& line : bill.lines) {
out += "\n" + line.name + " x" + std::to_string(line.quantity) + ": " +
money(line.costCents);
}
out += "\nDiscount: " + money(bill.discount);
out += "\nTotal: " + money(bill.total);
return out;
}
int main() {
Bill bill = priceOrder(parseOrder(ORDER));
std::cout << formatReceipt(bill) << "\n";
// The pricing rule run on its own: no text to read, nothing printed by it
Bill small = priceOrder({{"Pen", 2, 120}});
std::cout << "Pricing alone, 2 pens: total " << money(small.total)
<< ", discount " << money(small.discount) << "\n";
}// The same program with its three concerns apart: reading the order, pricing
// it, and writing the receipt. Each part can change, or be run, on its own.
const ORDER = `
Notebook,3,450
Pen,10,120
Backpack,1,8900
`;
interface Item {
name: string;
quantity: number;
priceCents: number;
}
interface Line {
name: string;
quantity: number;
costCents: number;
}
interface Bill {
lines: Line[];
discount: number;
total: number;
}
// Reading: text in, items out. It knows the format and nothing about prices.
function parseOrder(orderText: string): Item[] {
return orderText
.trim()
.split("\n")
.map((row) => {
const [name, quantity, price] = row.split(",");
return { name, quantity: Number(quantity), priceCents: Number(price) };
});
}
// Pricing: items in, a bill out. It knows the rule and nothing about text.
function priceOrder(items: Item[]): Bill {
const lines = items.map((item) => ({
name: item.name,
quantity: item.quantity,
costCents: item.quantity * item.priceCents,
}));
const subtotal = lines.reduce((sum, line) => sum + line.costCents, 0);
const discount = subtotal >= 10000 ? Math.floor(subtotal / 10) : 0;
return { lines, discount, total: subtotal - discount };
}
// Writing: a bill in, the receipt's text out. It knows the layout.
function money(cents: number): string {
return `${Math.floor(cents / 100)}.${String(cents % 100).padStart(2, "0")}`;
}
function formatReceipt(bill: Bill): string {
const rows = ["Receipt"];
for (const line of bill.lines) {
rows.push(`${line.name} x${line.quantity}: ${money(line.costCents)}`);
}
rows.push(`Discount: ${money(bill.discount)}`);
rows.push(`Total: ${money(bill.total)}`);
return rows.join("\n");
}
function main(): void {
const bill = priceOrder(parseOrder(ORDER));
console.log(formatReceipt(bill));
// The pricing rule run on its own: no text to read, nothing printed by it
const small = priceOrder([{ name: "Pen", quantity: 2, priceCents: 120 }]);
console.log(
`Pricing alone, 2 pens: total ${money(small.total)}, ` +
`discount ${money(small.discount)}`,
);
}
main();using System;
using System.Collections.Generic;
// The same program with its three concerns apart: reading the order, pricing
// it, and writing the receipt. Each part can change, or be run, on its own.
public record Item(string Name, int Quantity, int PriceCents);
public record Line(string Name, int Quantity, int CostCents);
public record Bill(List<Line> Lines, int Discount, int Total);
public class Shop
{
const string Order = "Notebook,3,450\nPen,10,120\nBackpack,1,8900\n";
// Reading: text in, items out. It knows the format and nothing about prices.
public static List<Item> ParseOrder(string orderText)
{
var items = new List<Item>();
foreach (string row in orderText.Trim().Split('\n'))
{
string[] fields = row.Split(',');
items.Add(new Item(fields[0], int.Parse(fields[1]), int.Parse(fields[2])));
}
return items;
}
// Pricing: items in, a bill out. It knows the rule and nothing about text.
public static Bill PriceOrder(List<Item> items)
{
var lines = new List<Line>();
int subtotal = 0;
foreach (Item item in items)
{
int cost = item.Quantity * item.PriceCents;
lines.Add(new Line(item.Name, item.Quantity, cost));
subtotal += cost;
}
int discount = subtotal >= 10000 ? subtotal / 10 : 0;
return new Bill(lines, discount, subtotal - discount);
}
// Writing: a bill in, the receipt's text out. It knows the layout.
public static string Money(int cents) => $"{cents / 100}.{cents % 100:D2}";
public static string FormatReceipt(Bill bill)
{
var rows = new List<string> { "Receipt" };
foreach (Line line in bill.Lines)
{
rows.Add($"{line.Name} x{line.Quantity}: {Money(line.CostCents)}");
}
rows.Add($"Discount: {Money(bill.Discount)}");
rows.Add($"Total: {Money(bill.Total)}");
return string.Join("\n", rows);
}
public static void Main()
{
Bill bill = PriceOrder(ParseOrder(Order));
Console.WriteLine(FormatReceipt(bill));
// The pricing rule run on its own: no text to read, nothing printed by it
Bill small = PriceOrder(new List<Item> { new Item("Pen", 2, 120) });
Console.WriteLine($"Pricing alone, 2 pens: total {Money(small.Total)}, "
+ $"discount {Money(small.Discount)}");
}
}package main
import (
"fmt"
"strconv"
"strings"
)
// The same program with its three concerns apart: reading the order, pricing
// it, and writing the receipt. Each part can change, or be run, on its own.
const order = `
Notebook,3,450
Pen,10,120
Backpack,1,8900
`
type Item struct {
Name string
Quantity int
PriceCents int
}
type Line struct {
Name string
Quantity int
CostCents int
}
type Bill struct {
Lines []Line
Discount int
Total int
}
// parseOrder is the reading: text in, items out. It knows the format and
// nothing about prices.
func parseOrder(orderText string) ([]Item, error) {
var items []Item
for _, row := range strings.Split(strings.TrimSpace(orderText), "\n") {
fields := strings.Split(row, ",")
quantity, err := strconv.Atoi(fields[1])
if err != nil {
return nil, err
}
price, err := strconv.Atoi(fields[2])
if err != nil {
return nil, err
}
items = append(items, Item{fields[0], quantity, price})
}
return items, nil
}
// priceOrder is the pricing: items in, a bill out. It knows the rule and
// nothing about text.
func priceOrder(items []Item) Bill {
var lines []Line
subtotal := 0
for _, item := range items {
cost := item.Quantity * item.PriceCents
lines = append(lines, Line{item.Name, item.Quantity, cost})
subtotal += cost
}
discount := 0
if subtotal >= 10000 {
discount = subtotal / 10
}
return Bill{lines, discount, subtotal - discount}
}
// money and formatReceipt are the writing: a bill in, the receipt's text out.
// They know the layout.
func money(cents int) string {
return fmt.Sprintf("%d.%02d", cents/100, cents%100)
}
func formatReceipt(bill Bill) string {
rows := []string{"Receipt"}
for _, line := range bill.Lines {
cost := money(line.CostCents)
row := fmt.Sprintf("%s x%d: %s", line.Name, line.Quantity, cost)
rows = append(rows, row)
}
rows = append(rows, "Discount: "+money(bill.Discount))
rows = append(rows, "Total: "+money(bill.Total))
return strings.Join(rows, "\n")
}
func main() {
items, err := parseOrder(order)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(formatReceipt(priceOrder(items)))
// The pricing rule run on its own: no text to read, nothing printed by it
small := priceOrder([]Item{{"Pen", 2, 120}})
fmt.Printf("Pricing alone, 2 pens: total %s, discount %s\n",
money(small.Total), money(small.Discount))
}It prints:
Receipt
Notebook x3: 13.50
Pen x10: 12.00
Backpack x1: 89.00
Discount: 11.45
Total: 103.05
Pricing alone, 2 pens: total 2.40, discount 0.00
The receipt is the same, line for line. Each function now has one concern. parse_order knows the order's format and nothing about prices, price_order knows the discount rule and nothing about text, and format_receipt knows the layout and does no arithmetic. They hand plain values to each other, a list of items and then a bill with every line's cost already worked out, and main connects them.
Now each change has one home. Semicolons change only parse_order. A discount that starts at 150.00 changes one line in price_order. A currency sign changes only money. The last line of the output shows something the first program could not do: price_order runs on its own, given two pens and no text at all, and its answer can be checked with no text to read and no receipt to print.
Concerns at Every Size
The same idea works at every size of a design. Inside a function, it is the difference between the two programs above. For classes, S — Single Responsibility Principle turns it into a test you can apply, and Martin's other wording of that principle reads almost like a definition of separation of concerns: "Gather together the things that change for the same reasons. Separate those things that change for different reasons." For a whole application, the usual split is into layers, one for what the user sees, one for the business rules and one for storing the data, which Layered Architecture — Presentation, Service, Repository covers; MVC — Model, View, Controller divides a user interface in the same spirit.
Coupling and Cohesion — The Two Measures of a Design measures the same thing from two sides. A part that handles one concern is cohesive, because everything in it serves one purpose. Parts that keep their concerns to themselves are loosely coupled, because they share only plain values, like the items and the bill above, and none of them needs to know how another does its work.
Common Mistakes
Splitting by steps instead of by decisions. Cutting a long function into step_one, step_two and step_three makes the pieces shorter, but if every piece still knows the order's format, a format change still reaches all of them. This is the trap Parnas described: a split that follows the order of processing can leave one decision spread across every module. Ask what each part knows, and keep each decision in one part.
Letting one concern leak into another. If price_order returned the amounts already written out, "11.45" instead of 1145, the pricing code would be deciding how money is shown, and adding a currency sign would mean changing it. Each part should hand over plain values and leave the showing to the part whose job it is, which is Martin's rule about HTML again.
Splitting too far. Three functions for three jobs make this program clearer. A class for every line, with interfaces between them, would only spread the same few steps over more places, and KISS — Keep It Simple, Stupid applies: separate the concerns the program really has, at the size that makes it easier to read and change.
Law of Demeter (Principle of Least Knowledge) comes next, and takes the idea of knowing as little as possible about other parts down to a single method call.
Key Takeaways
- Separation of concerns means each part of a program handles one concern, one aspect of the problem, and knows as little as it can about the others.
- Divide a program by the decisions likely to change, such as the input format, a business rule or the layout of the output, so that each change opens one part.
- Parts hand each other plain values; a part that reads, prices or formats something that belongs to another part has let a concern leak.
- The idea applies at every size, from functions to classes to layers, and the split should follow the concerns the program really has.