DPC Zettelkasten Open in the explorer

Plugin Architecture

How the flagship is layered — services over repositories over jOOQ — and the cross-cutting concerns that shape every feature.

Medieval Factions has a consistent internal shape, and once you have seen one feature you have seen them all. This map describes that shape.

The three layers

  1. Commands parse player input and delegate immediately.
  2. Services own the in-memory state and the business rules — Service Layer.
  3. Repositories are interfaces that hide storage — Repository Pattern — implemented against jOOQ Persistence.

A new feature is almost always: a data class, an ID value class (Value Class Identifier), a repository interface, a jOOQ implementation, a service, and a command.

Cross-cutting concerns

Where to attach

If you are writing an Expansion Plugin, the seams that matter are Faction Events (react to things) and the Service Layer (read and change things). If you are integrating an external system, look at how Notification and Map Integration define an interface and swap in an implementation at startup — that is the pattern to copy.

Linked from