psitta

Documentation Index

docs/architecture/application.md

Purpose

Describe the Application / Controllers layer, which coordinates:

This diagram does not describe the UI or SQL details — only the structural dependencies.


Diagram

%%{init: {"class": {"hideEmptyMembersBox": true}} }%%
classDiagram

namespace Application {
  class HomeController
  class SessionController
  class StatsController
  class SettingsController
}

namespace Domain {
  class Session
  class Exercise
  class WordExercise
  class SentenceExercise
  class ExercisePrompt
}


%% Domain inheritance
Exercise <|-- WordExercise
Exercise <|-- SentenceExercise

%% Application -> Domain
HomeController --> SessionController : starts sessions
SessionController --> Session : manages
SessionController --> Exercise : produces/consumes
SessionController --> ExercisePrompt : get projection

%% Application -> Persistence
SessionController --> Repository : **load**<br/> words, groups
SessionController --> Repository : **load/save** SRS

StatsController --> Repository: read

SettingsController --> Repository : read/write config

Reading the Diagram

Controllers (Application)

Domain

Persistence

Controllers access data through repositories:

SQL, DB mapping, and table definitions are confined to the Persistence diagram.


Architecture Rules


Note on Controller Lifecycle

Controllers are long-lived objects, created at application startup and shared across screens.

Sessions are ephemeral objects, scoped to the duration of a single learning session.

This decoupling allows multiple sessions to be run sequentially without recreating controllers, and ensures a clear lifecycle management.