How vkhorikov/dddinaction works
Main Components
a. Domain/Business Logic Layer (DddInPractice.Logic)
• Contains sub-modules such as:
• Atms: Contains domain entities like Atm, AtmDto, repository, mapping, and domain events.
• SnackMachines: Similar structure with SnackMachine, Snack, Slot, SlotMap, SnackPile, etc.
• Management: Handles higher-level management processes involving BalanceChangedEventHandler and HeadOffice.
• Common and SharedKernel: Provides base classes (e.g., AggregateRoot, Entity, ValueObject) and domain events support which are used across the domains.
• Utils: Infrastructure utilities like EventListener, SessionFactory, and Initer.
b. Presentation Layer (DddInPractice.UI)
• Contains application configuration files (App.xaml, App.xaml.cs) and multiple UI modules:
• Atms: Contains AtmViewModel and its associated XAML view.
• SnackMachines: Contains SnackMachineViewModel, SnackPileViewModel, etc.
• Management: Contains the DashboardViewModel (with its XAML view).
• Common UI elements like commands, custom windows, dialog utilities, and resource files.
c. Testing Suite (DddInPractice.Tests)
• Contains unit tests for various domain functionalities (e.g., AtmSpecs, SnackMachineSpecs, MoneySpecs) to validate business logic.
d. Infrastructure / Configuration Files
• Includes the database creation script (DBCreationScript.txt) and project solution files.
• Git-related configuration and package references.
Relationships and Interactions Between Components
• The Presentation Layer (UI) acts as the front door and communicates with the Domain Layer to perform business operations. For instance, user actions in an Atm or SnackMachine UI view would trigger operations in their respective domain contexts.
• The Domain Layer is the core that encapsulates the business logic. Domain entities, repositories, domain events, and services (such as PaymentGateway) are defined here and are consumed by the UI.
• Domain events and their handlers (e.g., BalanceChangedEvent and its handler) create interactions within the business logic, promoting decoupling.
• The testing suite interacts with the domain layer to simulate user interactions and verify business rules.
Architectural Patterns & Design Principles
• Domain-Driven Design (DDD): Emphasizes separation of concerns with Organizing code into subdomains (Atms, SnackMachines, Management) and shared kernel elements.
• Layered Architecture: Different concerns are isolated (Domain, UI, Tests).
• Repository Pattern: Evident from repository classes in Atms, SnackMachines, and Management.
• Event-Driven Architecture: Noticeable through domain events and event listeners.
• MVVM (Model-View-ViewModel): The UI components (e.g., XAML files and their corresponding ViewModels) suggest an MVVM pattern in the presentation layer.
Final Checklist
• All Main Components (Domain Logic, UI, Testing, Infrastructure) are clearly labeled.