How osoco/pharo-eda works
Main Components
• Framework Core & Baseline:
– The “src/BaselineOfPharoEDA” serves as the baseline that ties together the overall configuration.
• Domain Layer:
– “src/EDA-Domain” and “src/EDA-Domain-GT-Extensions” represent the central domain logic and any extensions that enhance the Domain-Driven Design aspects (e.g., aggregates and domain events).
• Application Layer:
– “src/EDA-Application” and related tests (“src/EDA-Application-Tests”) illustrate how commands are handled on the application level, coordinating between inbound commands and domain operations.
• Commands and Events:
– “src/EDA-Commands” and “src/EDA-Commands-Tests” show the dedicated handling of commands.
– “src/EDA-Events” manages event definitions.
• Event Store:
– “src/EDA-EventStore” as well as “src/EDA-Voyage-EventStore” reflect the event sourcing mechanism where events are persisted.
• Messaging Infrastructure:
– “src/EDA-Messaging” (and “src/EDA-StompMessaging”) indicate the components responsible for message encoding/decoding and handling the messaging protocols.
• Projections, Logging, and Serializers:
– “src/EDA-Projections” and its related test modules manage the read models or projectors.
– “src/EDA-Logging” is dedicated to logging concerns.
– “src/EDA-Serializers” likely deals with converting domain objects to/from other representations.
• Tools and Traits:
– “src/EDA-Tools” and “src/EDA-Traits” provide helpful behaviors, patterns, and common utilities.
• Migration & Testing:
• Documentation Stories:
– The “stories/modularization” directory offers narrative chapters that help explain how the system is modularized, which can be useful for understanding overall interactions.
Relationships and Interactions
• Next, the “EDA-Commands” component receives the command which is then handed over to the “Application Layer” (EDA-Application), which in turn routes it to the appropriate domain aggregate in “EDA-Domain”.
• The aggregate processes the command, “applies” the resulting event(s) (as indicated in the README’s sample apply methods), and then these events are stored via the “EDA-EventStore”.
• Finally, events can be republished to an exchange (again noted in the README), handled by the messaging components (EDA-Messaging/EDA-StompMessaging), and optionally projected into read models (EDA-Projections).
– Additionally, highlight auxiliary interactions:
• Logging is interwoven across modules (EDA-Logging).
• Serializers (EDA-Serializers) ensure that commands and events have a standard JSON or BSON representation.
• Domain extensions and traits (EDA-Domain-GT-Extensions, EDA-Traits) provide a layer of abstraction and standard behaviors common across modules.
Important Architectural Patterns and Design Principles
– Domain-Driven Design: The separation of concerns between Domain, Application, and Infrastructure is baked into the framework. Represent the aggregates (domain models), repositories (via event store adapters), and command handlers as distinct modules.
– Event Sourcing: Illustrate how commands are received and translated into events, which then reconstruct the domain state.
– Code Generation: The README mentions generators (like MyDomainGenerator) that help bridge command names with event names. You may note this as an auxiliary “Generator” or “Adapter” component that automates some wiring between the layers.
Relevant Technologies, Frameworks, and Libraries
– Pharo Smalltalk is the base language/platform.
– RabbitMQ (for messaging) and MongoDB (via Voyage) for event storage are key external systems.
– Gradle build configuration files indicate that Gradle is used to manage builds and possibly dependency resolution.
• Each module should be represented as a clearly labeled component (e.g., “EDA-Commands”, “EDA-Domain”, “EDA-EventStore”, “EDA-Messaging”, etc.).
– Command flow from external systems (RabbitMQ) into the Application layer,
– The subsequent invocation of domain aggregates,
– The event creation and persistence in the Event Store,
– The publishing of events via messaging channels.
• Where configuration (build.gradle, gradle files) and code generation (EDAGenerator descendant) come into play.
Final Reminders
– Avoid oversimplification: since the project is highly modular, it is best to break it into as many meaningful components as possible.
Happy diagramming!