psitta

Documentation Index

docs/architecture/exercises.md

Purpose

Describe the role of exercises in the learning engine.

This document specifies:

Temporal aspects and orchestration are described in sessions.md.


Role of an Exercise

An Exercise is a stateful runtime object.

It represents:

An exercise:


Conceptual Diagram

%%{init: {"class": {"hideEmptyMembersBox": true}} }%%
classDiagram
  class Exercise
  namespace Exercises {
    class WordExercise
    class SentenceExercise
  }

    class SentenceState
    class ExercisePrompt

  namespace Answer {
    class ExerciseAnswer
    class RealExerciseAnswer
    class PreviewExerciseAnswer
  }

  namespace Contents {
    class Content
    class Field
  }

  namespace Other {
    class SRSState
    class ExerciseStatus
  }

  namespace Sentences {
    class SentenceGroup
    class SentenceInstance
  }
  



    Exercise <|-- WordExercise
    Exercise <|-- SentenceExercise

    Exercise "1" --> "1" ExerciseStatus : status
    Exercise "1" --> "1" SRSState : srsState


    SentenceInstance "1" --> "1..*" SentenceState : updates
    SentenceExercise "1" --> "1" SentenceGroup
    SentenceGroup "1" --> "1..*" SentenceInstance

    ExerciseAnswer <|-- RealExerciseAnswer
    ExerciseAnswer <|-- PreviewExerciseAnswer

    Exercise ..> ExerciseAnswer : submit / preview answer
    Exercise ..> ExercisePrompt : getPrompt()

    Content "1" --> "1..*" Field

    WordExercise "1" --> "1" Content
    SentenceInstance "1" --> "1" Content



General Structure of an Exercise

An Exercise encapsulates:

It knows nothing about:


ExerciseStatus

ExerciseStatus describes the current state of an exercise during the session.

It is used by:

Typical status examples: not yet attempted, new exercise, already answered, completed.


User Interaction: ExerciseAnswer

User interactions are modelled by the ExerciseAnswer type.

An exercise can receive:

The exercise is responsible for:


Exercise Specialisations

WordExercise

A WordExercise:

It does not manipulate any SentenceState.

SentenceExercise

A SentenceExercise:

Using a group of sentences allows:


Content and Exercise Projection

Content

Each Words and Sentences have their own Content.

A Content can have as many Field as needed :

The name of the Field doesn’t need to be unique, but it is recommended to have an explicit name.

Exercise Projection

An exercise can produce an immutable snapshot of its state via Exercise.getPrompt().

This projection (ExercisePrompt):

The Projection is composed of every field that the UI need.


Core Invariants


What the Exercise Intentionally Ignores

An exercise ignores: