Introduction to Ada: A Project-Based Exploration with Rosettas By Romain Gora, Sep 2, 2025 --- Context This tutorial is a practical, project-based introduction to Ada, created upon joining AdaCore as a Field Engineer. It complements the concept-based approach of the Ada learning portal learn.adacore.com by building an end-to-end Ada program. The project generates animated rosetta patterns (hypotrochoid curves, like Spirograph™) as SVG files. Although Ada is known for safety-critical systems, this explores Ada as a modern, general-purpose language using features from Ada 2022. --- A Brief Note on Ada Created in late 1970s for U.S. Department of Defense to unify diverse software. Known for use in mission-critical domains: Embedded and real-time systems Aerospace, defense, rail, automotive, aviation Systems where failure carries serious risk Strong compile-time checking, safety features, and readability-focused design. Key principles: Readability over conciseness: Full keywords, clear naming. Strong, explicit typing with little inference. Explicit rather than implicit programming. Defined semantics with minimal undefined behavior. Compiler as a partner to enforce correctness and clarity. --- How the Program Works Command-line tool generating an SVG file containing rosetta curves. Run with: ./bin/rosetta SVG chosen for portability and simplicity; no external graphic libraries required. Immediate visual output makes learning fun and rewarding. --- Tooling & Setup Uses Alire, Ada’s package manager (like Cargo for Rust or npm for JavaScript). Development options: GNAT Studio IDE (official Ada IDE) Visual Studio Code with Ada & SPARK extension Recommended resource: learn.adacore.com, which offers clear tutorials and an ebook version. --- Entry Point (Main Procedure) with clause declares dependency on the RosettaRenderer package, checked at compile time. Procedure performs action, no return value. Clear and readable syntax with explicit begin/end blocks. Uses descriptive PascalSnakeCase naming style. --- Geometry and Computation (Package Rosetta) Packages in Ada group related types and procedures, split into: Specification file (.ads), defining interface Implementation file (.adb), containing the code Rosetta package defines: Hypotrochoid record type describing rosetta geometry (outer/inner radius, pen offset, steps). Coordinate type for 2D points. CoordinateArray for arrays of points. ComputePoints function that returns points forming the rosetta curve. Design Highlights Records are user-defined types grouping related fields, enhancing clarity and safety. Uses unconstrained arrays to flexibly store points. Defines subtypes like Natural (non-negative integers) for safer typing. Implementation Notes Functions like GeneratePoint and ComputePoints are pure, deterministic, and modular. Compiler enforces safe array bounds, catching out-of-range errors. Constants (e.g., Pi, RDiff) are immutable, reducing bugs. Example core calculation uses parametric hypotrochoid equations. --- Strict and Predictable Style Ada enforces strict coding standards via compiler switches (e.g., -gnaty). Rules include no trailing whitespace, consistent indentation, spacing conventions, and casing. This integrated style checking ensures uniform, readable, maintainable code. Tools like GNATcheck and GNATformat add further style enforcement (beyond scope here). --- Outputting SVG (Package RosettaRenderer) Handles rendering rosettas as SVG files. Top-level procedure PutSVG_Rosettas constructs SVG with headers, shapes, animations, and footers. Separates math