Turn repeated reasoning into small components · 3 Lessons
English

Ada Engineering

Module 3 – Turn repeated reasoning into small components

Page 3 of 3 · About 15 minutes per lesson, including practice.

Test the contract at its edge

Build a table of total, done, and expected remaining values. Include no lessons, no completed work, one remaining lesson, equality, and a completed count above the total. Explain why the final case returns zero in this exercise; another application might reject it instead, so the policy belongs in the specification.

Ask a reviewer to propose a case you missed. If you change the policy, revise the tests and explanation together. As an extension, move the function into a package and show that the same tests still pass. Keep the calculation separate from printing so it is easy to reuse in another interface.

Example code on Agila Forge ↗

Complete this lesson

Answer every check correctly to earn your lesson certificate. Feedback helps you review and try again.

Sign in · Save your progress and earn a certificate for this lesson.