Skip to main content
Text ready — video coming soon

Architecture and debt: see the cost of a choice

You've reached the last lesson of Course 1. Well done! You now know the main parts of an app: the frontend people see, the backend that applies the rules, the API they use to talk, and the database that keeps the records. In the last lesson, you also saw that where a rule is checked matters.

In this lesson, you'll learn:

  • what software architecture is;
  • why one rule should live in one place;
  • what technical debt is;
  • what to check when a working app changes.

Why it matters: in Course 2, you'll ask AI to change software. You need to know what else a change can affect.

How the parts fit together​

Software architecture means the big decisions about how an app is built: its main parts, what each part does, and how the parts connect.

Here is our committee app's architecture, in short:

  • The frontend shows the totals and the buttons.
  • The backend checks permissions and works out the totals.
  • The database keeps the records.
  • The API is how the frontend asks the backend for what it needs.

The parts depend on each other. A dependency is something one part needs from another. For example, the frontend depends on the API to send back a total, or a clear error.

Why one rule needs one home​

Imagine the app shows the monthly amount due, 1,000 rupees, in three places: the member page, the organiser page, and an export, which makes a file the organiser can open in a spreadsheet.

There are two ways to build this:

DesignHow it worksWhen the amount changes to 1,500
CopiesEach place has its own copy of "1,000"Someone must find and change all three copies. Miss one, and the places disagree
One homeAll three places ask the backend, which keeps the amount in one placeChange it once, and every place shows the new amount

"One home" sounds better, and it usually is. But it has a cost too: if the backend fails, all three places are affected at once. Every design choice has a benefit and a cost. Good architecture means choosing what fits this app and the changes it is likely to need, not what's fashionable.

Shortcuts create extra work later​

Technical debt is the extra work you'll have later because of a shortcut you take now.

The name comes from borrowing money. A loan lets you buy something today, but later you pay back more than you borrowed. A shortcut works the same way: it saves time today, and costs extra time later, every time that code has to change.

For example, copying "1,000" into three places is quick for a demo. But if the demo becomes a real app, every change to the amount means hunting for every copy. That repeated hunting is the debt.

Not every change is debt, though. If the committee decides it needs something new, building it is normal new work, even when the earlier design was good.

Checking a change​

Say the organiser asks for a clearer label: "Total received" instead of "Total". The calculation shouldn't change. Still, check the result, and check every other place that shows that label.

Now say the organiser wants a different calculation. Then the records, the totals on screen and the export may all need checking. A correct member page doesn't prove the export is correct.

This is where tests help. A test is a check with a known input and an expected result. A good test for our app says: when the payments are 1,000, 1,000 and 500, the total received must be 2,500. A weak test that only checks that "some number appears" would pass even if the app showed 3,000.

Finally, keep a way back. A version is a saved state of the work at one moment. Keeping versions lets you go back to the last good state if a change goes wrong.

Check what you can now explain​

Without looking back:

  1. Name the four main parts of the committee app, and say what each one does.
  2. Give one benefit and one cost of keeping the monthly amount in one home.
  3. Describe a test that would pass even though the app answers the wrong question.

That's the end of Course 1! You know what software is, you can read a small program, and you know the parts of an app. Course 2 brings in AI: what happens when AI writes the code, and how you stay in charge of checking it.