Code Story

Code Story Prologue

motivation, getting started, chapter index, references

0.0  Prologue

Code Track documents project work - building tools, comparing implementations across languages, and measuring what actually happens at runtime. The story walks through setting up a productive code workspace, then explores two multi-language projects: TextFinder and PageValidator.
Why multi-language project comparison?
  1. Each language makes different trade-offs - type safety, ownership vs. garbage collection, compiled vs. interpreted - and seeing those trade-offs applied to the same problem makes them concrete rather than abstract.
  2. The same architecture expressed in four languages reveals which design choices are universal and which are forced by the language.
  3. Performance results on real workloads surprise even experienced developers. TextFinder is I/O-bound, so Python’s C-extension hot path wins. PageValidator is CPU-bound, so C++ wins. Measuring replaces assumptions.
  4. AI code-generation tools produce better results when you can review what they generate. Knowing multiple languages makes you a more effective reviewer.
TextFinder and PageValidator are early examples in what will grow into a larger collection. Each is implemented in Rust, C++, C#, and Python, with the same architecture and measurable performance results across all four.

0.1  Getting Started

Install these tools before working through the chapters. Each chapter builds on the setup from the previous one.
  1. VS Code with language extensions:
    rust-analyzer (Rust), clangd or the C/C++ extension (C++), C# Dev Kit (C#), Pylance (Python), Error Lens and GitLens (all languages).
  2. Language toolchains - install any or all:
    Rust (rustup), a C++ compiler (MSVC, GCC, or Clang), .NET SDK for C#, Python 3.10+.
  3. Code metrics and timing tools (Chapter 2):
    hyperfine for command-line benchmarking, tokei or scc for code metrics.
  4. Git and a GitHub account.

0.2  Story Content

Each chapter is readable on its own, but they are ordered to build vocabulary and tools used in subsequent chapters.
  1. Prologue

    Motivation, getting started, chapter index, and references.
  2. Dev Tools

    VS Code setup and extensions, CMake, MSBuild, Clang tooling, dotnet CLI, and Python virtual environments - the toolchain used across all projects.
  3. TextFinder

    A regex directory-search tool implemented in Rust, C++, C#, and Python. Three-component architecture (CommandLine, DirNav, Output), CLI options, skip lists, performance comparison, and a key optimization in the Rust build.
  4. PageValidator

    An HTML structural validator implemented in Rust, C++, C#, and Python. Four-component pipeline (Tokenizer → Lexer → Validator → EntryPoint), eight validation rules, performance comparison, and a language feature comparison for the Token type across all four implementations.
  5. Code Track Map

    Directory layout and purpose of each section in the Code track - root HTML pages, top-level directories, and AI/ subdirectories in detail.
  6. Experiment Arena

    Building a scratch workspace with real tools: code metrics (tokei, scc, radon, clippy, cppcheck), performance timers (hyperfine, cProfile, cargo flamegraph, BenchmarkDotNet), and visualizers (snakeviz, cargo doc, graphviz).

0.3  References

Resource Description
The Rust Book Authoritative introduction to Rust ownership, types, and tooling.
cppreference.com Comprehensive C++ language and standard library reference.
C# Docs Microsoft’s C# language reference and .NET SDK guides.
Python Docs Python 3 language reference, library, and tutorial.
hyperfine Command-line benchmarking tool used throughout Chapter 2.
tokei Fast code metrics tool: lines of code, blanks, comments by language.
JimFawcett on GitHub Source repositories for all TextFinder and PageValidator implementations.
CodeBites Introduction Companion bite-sized topics: AI tools, prompt patterns, spec-driven dev.