docs/architecture/exercises.mdDescribe the role of exercises in the learning engine.
This document specifies:
Exercise is,Temporal aspects and orchestration are described in sessions.md.
An Exercise is a stateful runtime object.
It represents:
An exercise:
%%{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
An Exercise encapsulates:
ExerciseStatus),SRSState),It knows nothing about:
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 interactions are modelled by the ExerciseAnswer type.
An exercise can receive:
SubmittedExerciseAnswer):
PreviewExerciseAnswer):
The exercise is responsible for:
A WordExercise:
Content,SRSState.It does not manipulate any SentenceState.
A SentenceExercise:
SRSState (at the group level),SentenceGroup),SentenceGroup is composed of a list of SentenceInstanceSentenceInstance Have:
ContentSentenceState updated by the SentenceExerciseUsing a group of sentences allows:
Each Words and Sentences have their own Content.
A Content can have as many Field as needed :
Field can store any value (Text, Audio, Image, …)Field have name.The name of the
Fielddoesn’t need to be unique, but it is recommended to have an explicit name.
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.
An exercise ignores: