Ages 15–18 · Grades 9–12 · Computer Science

LibraryForge

Read the package before you trust it.

You will spend far more of your coding life reading code than writing it — and an assistant now pulls in dependencies by the dozen. Here a small helper arrives from an open-source package. Read its doc-comment and its code, predict what a call prints, run it — then answer the question the assistant never will: what breaks if a teammate changes one line? Sometimes the doc and the code disagree; the code is what runs.

The code is a teaching subset of the Swift language; the snippets are original teaching examples. Runs on your device — nothing leaves it.

Loading the reading lab…

A case · you decide

Omar and the date helper

Omar, 17 — adding a small open-source date-formatting helper to his club website

The idea in play: before you depend on someone else's code, read its doc-comment and its code and ask what breaks if one line changes.

The helper's doc-comment says it 'formats any date as DD/MM/YYYY'. Omar's site shows event dates from a feed. The helper is twenty lines long and has 3,000 stars, so he almost skips reading it.

Stars tell you a lot of people use it. They do not tell you it fits your case.

Twenty lines takes two minutes to read. Line 9 builds the date in the computer's local time zone.

What should Omar do before shipping?

He finds the time-zone line. What is the safest change?

Read a helper →

What next? Pick a door

Chosen from what this app is about. What you open is remembered on this device only.