Workshop checks passed0 / 7

Python Design and Type Hints

A program becomes harder to change when its rules are scattered or its inputs are unclear. Learn how names, function boundaries and type hints make those decisions explicit. Reuse a rule when it needs to stay consistent, and keep different responsibilities separate.

Functions and shared rules

A function needs a clear purpose and an agreement with its callers. Descriptive names make that agreement easier to follow. When several operations depend on the same rule, keeping one definition prevents their behavior from drifting apart.

  1. 01
    Names, Units, and Readable Code

    A calculation can run correctly while leaving its meaning difficult to follow. Names, explicit units and useful documentation help another reader understand the assumptions they need to preserve.

    • Built: not completed
    • Changed inputs: not completed
    • Exercises: not completed
  2. 02
    Functions with Clear Responsibilities

    A function is easier to reuse when its inputs and result describe one coherent job. Keeping calculations separate from display and external effects makes changes easier to reason about and test.

    • Built: not completed
    • Changed inputs: not completed
    • Exercises: not completed
  3. 03
    DRY and Shared Rules

    Copies of the same rule can drift apart as requirements change. DRY keeps that knowledge in one place, while leaving unrelated operations separate when their reasons for changing differ.

    • Built: not completed
    • Changed inputs: not completed
    • Exercises: not completed

Types and data boundaries

Type hints describe the values a program expects. Missing information still needs a deliberate representation, and an annotation does not check incoming data by itself. Distinguish the agreement written for readers and tools from the validation that actually runs.

  1. 04
    Type Hints and Function Contracts

    Type hints describe the values an interface expects and returns. Static tools can use that information to find incompatible uses, while runtime checks still decide whether external data is acceptable.

    • Built: not completed
    • Changed inputs: not completed
    • Exercises: not completed
  2. 05
    Missing Values, Defaults, and None

    An absent setting, an explicit None and a measured zero can mean different things. Defaults and optional types need to preserve those distinctions so the program applies the intended policy.

    • Built: not completed
    • Changed inputs: not completed
    • Exercises: not completed

Objects and interchangeable components

A named record keeps related values together. An interface describes the behavior another part of the program needs. Combining small components can let us change one implementation without making its callers depend on its internal details.

  1. 06
    Dataclasses and Record Ownership

    A dataclass gives a recurring record a named Python type and generates common methods. Validation and ownership of mutable fields remain explicit design decisions.

    • Built: not completed
    • Changed inputs: not completed
    • Exercises: not completed
  2. 07
    Composition and Interchangeable Components

    A program can combine small components through clear interfaces. Passing a dependency explicitly lets callers replace where data comes from or where results go without rewriting the calculation.

    • Built: not completed
    • Changed inputs: not completed
    • Exercises: not completed