Use types to describe valid data · 3 Lessons
English

Ada Engineering

Module 2 – Use types to describe valid data

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

Model the problem before adding features

Name values by their meaning: Raw_Score and Accepted_Score communicate more than X and Y. Write down which stage of your program knows that the score is valid. Keep external or experimental data separate from values that have already passed validation.

Extend the example to classify an accepted score as ready for review or needing practice, using a threshold you document. Test just below, exactly at, and just above that threshold. Explain why zero remains valid even if it represents no completed work. In your notebook, distinguish an invalid input from a valid result that a learner may be disappointed with.

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.