๐Ÿงฑ
๐Ÿ“ Building with the Larz Stack ยท STK-101 ยท Assignments

Building with the Larz Stack โ€” Assignments

Work each problem yourself first, then open the worked solution to check your thinking. This is where the course sticks.

๐Ÿ“ 4 problemsโœ๏ธ Worked solutions
Problem 1

Explain the zero-dependency philosophy and give three concrete advantages over a normal dependency tree.

Show worked solution

A strong answer states that each Larz library depends only on the standard library, and gives advantages such as: no dependency hell / version conflicts; a far smaller supply-chain surface to audit or be compromised; tiny, portable installs you can even vendor by copying the module; and code you can actually read end to end. Bonus: notes it's a deliberate trade of some convenience for control, security and longevity.

Problem 2

Why must money never be stored as a float? Explain how larzmoney avoids the problem and keeps splits exact.

Show worked solution

Floats can't represent most decimal amounts exactly (0.1 + 0.2 != 0.3), so errors accumulate until books don't balance. larzmoney stores money as integer minor units (cents) plus a currency, making arithmetic exact, and its split()/allocate() distribute amounts so the parts always reconcile to the whole with no lost or invented penny. It also refuses invalid operations like adding two different currencies.

Problem 3

Explain how larzsql prevents SQL injection 'by construction' rather than by discipline.

Show worked solution

larzsql never concatenates a value into the SQL text โ€” it emits a placeholder (?) in the SQL plus a separate list of bound parameters. Because user input only ever travels in the params list and never becomes part of the executable SQL string, there is no way for it to be interpreted as SQL. Safety is a property of the tool itself, so it doesn't depend on the developer remembering to escape anything.

Problem 4

Describe how a stack library plus the framework combine to deliver one feature end to end (your choice).

Show worked solution

Any concrete pairing works. Example โ€” 2FA: the framework handles the account/route, larztotp generates and verifies the TOTP codes and the provisioning URI, and larzqr turns that URI into a scannable enrollment QR with no image library. Another โ€” invoicing: the framework triggers it, larzmoney supplies exact totals, larzpdf renders the PDF. A good answer shows the division of labour and that the framework opts into the library as an extra without losing its zero-dependency core.

More in this course

Course home → · Browse all courses →