How system-sekkei/isolating-the-domain works
Main Components
• Frontend/Presentation Layer – This is implemented primarily in the “src/main/java/example/presentation” package for controllers and views (with templates under “src/main/resources/templates”). Use Thymeleaf for the rendering of HTML pages.
• Application Layer – Contains coordinators and services that orchestrate business processes (found under “src/main/java/example/application”). This layer manages operations related to employees, payroll, timerecords, attendance, and wages.
• Domain Layer – This holds the core business logic and domain models (under “src/main/java/example/domain”). It includes packages for different domain objects (employee, contract, timerecord, payroll, wage, and supporting types and validation).
• Infrastructure Layer – Provides the integration with external systems such as persistence. This is implemented in “src/main/java/example/infrastructure” where data sources and MyBatis mappers are defined, as well as transfer objects.
• External Elements – Include database components (implied by the presence of schema files, MyBatis configuration “mybatis.xml”, SQL scripts “schema.sql”, and data seed “data.sql”), and continuous integration (CircleCI configuration) and deployment files (Procfile, gradle build files).
Relationships and Interactions
• The Presentation layer (controllers in “presentation/controller”) receives requests (for dashboard, employee management, payroll, time records, etc.) and delegates requests to the Application layer.
• The Application layer (with “coordinator” and “service” subpackages) handles business logic, calling the Domain layer for business rules and computations and relying on the Infrastructure layer (repositories, data sources, mappers) for persistence operations.
• The Domain layer encapsulates the business entities, rules, and validations. It remains independent and is referenced by both the Application and Infrastructure layers to ensure consistency in business logic.
• The Infrastructure layer acts as a bridge between the Application/Domain layers and the database (via MyBatis). It also handles any other external systems or data integration.
Architectural Patterns Highlight
• Domain-Driven Design (DDD) / Isolating the Domain – The project clearly separates domain models and business logic from presentation and infrastructure concerns.
• MVC Pattern – The use of Spring MVC for web presentation (controllers and Thymeleaf templates) follows the classic Model-View-Controller separation.
• Layered Architecture – With distinct layers for presentation, application coordination, domain logic, and data access.
• MyBatis SQL Mapping – For data persistence with custom SQL queries, as seen in “ContractMapper.xml”, “EmployeeMapper.xml”, etc.
Relevant Technologies
• Java 11
• Spring Boot 2.x & Spring MVC
• Thymeleaf
• MyBatis SQL Mapper
• Gradle (for build and dependency management)
• CI/CD using CircleCI (from the .circleci configuration)
Final Advice
• Be very detailed in capturing the separation of concerns. While a high-level overview is useful, ensure each layer is represented and the main packages/components (as noted in the file tree) are clearly visible.