liveBook · Manning

YAGNI principle

As explained in Build Financial Software with Generative AI (From Scratch)

YAGNI is the software-development principle of avoiding functionality and complexity until they are actually needed.

YAGNI means “You aren’t going to need it.” Avoid functionality and complexity until they are needed, reducing unused code, maintenance, and future changes. section 3.2.2

Apply YAGNI by asking what the project needs now:

  • Prefer the smallest useful implementation over speculative features. section 3.2.2
  • Question infrastructure that is not yet required; file storage or in-memory data may be enough when a database is unnecessary. section 3.2.2
  • Keep an existing PostgreSQL requirement when it already belongs to the application, even if the current feature set is small. section 3.2.2

A deliberately small database setup

An ACH-processing project may eventually store ACH files and related data in PostgreSQL. Instead of adding every possible service, start with a simple PostgreSQL container and connect to it with CloudBeaver. Add data loading and further services only when the workflow needs them. section 3.2.2

Listing 3.4 Multiple containers generated by ChatGPT
version: '3.8'
services:
  cloudbeaver:
    image: dbeaver/cloudbeaver:latest
    container_name: cloudbeaver
    depends_on:
      - postgres
    ports:
      - "8080:8978"
    environment:
      - CB_DATABASE_URL=jdbc:postgresql://postgres:5432/postgres
      - CB_DATABASE_USERNAME=postgres
      - CB_DATABASE_PASSWORD=postgrespwd

  postgres:
    image: postgres:latest
    container_name: postgres
    environment:
      POSTGRES_DB: postgres
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgrespwd
    volumes:
      - postgres_data:/var/lib/postgresql/data
    ports:
      - "5432:5432"

volumes:
  postgres_data

Compare the generated multi-container configuration with a smaller setup to identify infrastructure that YAGNI would defer. section 3.2.2

How Build Financial Software with Generative AI (From Scratch) covers it

How deep it goes
Defines the principle and applies it to database setup, but stops short of a formal decision checklist.
Examples
Uses ACH-file storage, PostgreSQL, CloudBeaver, file or in-memory alternatives, and generated Docker Compose configurations.
What it assumes
Assumes a coding project and teaches the YAGNI acronym, its rationale, and its relationship to MVP from the definition onward.
What you can do after
Evaluate proposed features and infrastructure, then implement only the complexity justified by current project requirements.
How it connects
Connects YAGNI to Agile principles, minimum viable product, static code analysis, Docker containers, and PostgreSQL.

Also explained in

Compare how 3 books explain YAGNI principle →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build Financial Software with Generative AI (From Scratch). The section links point to the parts of the book it draws on.