How ohyeahyao/2024-interview works
• Outer (Infrastructure) Layer: This includes web and application entry points such as:
• The HTTP layer under app/Http (with controllers like CheckAndTransformOrderController).
• Service Providers under app/Providers (e.g. OrderServiceProvider that inject dependencies into the domain).
• Configuration files (config/*) and environment definitions (.env.example).
• Docker configuration located in docker/php for deployment/containerization.
• Middle (Application) Layer: Represents orchestration and use case implementations:
• Located primarily in modules/Order/UseCases (e.g., CurrencyConverter) and additional controllers orchestrating business logic.
• It serves as a mediator between the delivery of HTTP requests and the inner domain logic.
• Core (Domain) Layer: Contains the essential business logic and domain rules:
• Modules/Order contains Entities (Order), Value Objects (Address), Enums (Currency) and Exceptions.
• Conversion strategies (modules/Order/ConversionStrategies) are implemented here using design patterns (abstract factory for CurrencyStrategyFactory and strategy pattern for OrderFormatValidator).
• Shared rules and validations (modules/Shared/Rules) used across modules.
• Supporting (Testing) Layer: Testing directories (tests/Feature, tests/Unit) ensure quality and validate domain behavior.
Establish Relationships and Flow
• Dependency Injection: Indicate that the Controller utilizes the CurrencyConverter, which in turn relies on the CurrencyStrategyFactory and validator interfaces to perform currency conversion and order validation.
• Domain Isolation: Emphasize that the Domain model (Order entity, conversion strategies, validators) is insulated from external dependencies, following the principles of Onion Architecture.
Architectural Patterns and Design Principles
• Implementation of the design patterns:
• Abstract Factory Pattern in CurrencyStrategyFactory.
• Strategy Pattern in OrderFormatValidator.
• That dependency injection (e.g., via the OrderServiceProvider) is used to pass concrete implementations of interfaces into consuming classes.
Incorporate Technological and External Elements
• Web Server & Docker: Represent the deployment container (docker/php) integrated with the Laravel public/index.php as the entry point.
• Database & External Services: Although not explicitly detailed in the README, include a database component as guided by the presence of migrations and seeders. If the project involves queues or external APIs (as hinted in config/queue and config/services), show those dependencies.
• That the Build and CI tools (GitHub Actions workflows, phpunit for testing, and Code Coverage reports) are part of the development infrastructure.
Detailed Element Inclusions
• For a full-stack API project like this:
• That the Controllers in app/Http are part of the entry point handling HTTP requests.
• In the Domain, include elements such as Entities (Order), Value Objects (Address), Enums (Currency), and the conversion strategies and validators.
• Dependency injection flow from outer providers to domain services.
• Mention the Docker and CI/CD pipelines to show deployment and quality assurance aspects, even though they reside outside the core application logic.