I'll Be Backend
Principles

Single Responsibility: Split Calculation from Formatting

The Single Responsibility Principle says a class should have one reason to change. An invoice report that both adds up the money and writes the text answers to the finance team and to its readers, so a second output copies the tax math. These lessons split the calculation from the formatting, one small refactoring at a time, until the CSV export is one line.

Pick your language

When to use it

Use it when

One method computes values and turns them into text, and a second output needs the same values.

Skip it when

A one-off script prints one report once and nobody else needs the numbers.

Spot it by

Arithmetic between string appends, and a second output method that copies the math.