Repository navigation
Architectural Remarks
ntduck edited this page Dec 12, 2024
·
16 revisions
- The user interacts with the View.
- The View collects it into a RequestObject which is passed to the Controller.
- The Controller converts the RequestObject into a RequestModel which is passed to the Use Case interactor.
- The Use Case interactor processes the RequestModel and, if no exceptions were thrown, returns a ResponseModel which is passed to the Controller.
- The Controller converts the ResponseModel into a ViewModel which is passed back to the View.
- The View might pass the ViewModel to a Presenter for conversion-heavy operations.
- The user sees the result of their interaction in the View.
Note that RequestObjects, RequestModels, ResponseModels, and ViewModels are DTOS and should not contain any logic.
RequestModels and ResponseModels are defined by the respective Use Case interactors. RequestObjects and ViewModels are defined by the respective *Controllers.
An Use Case interactor might require no RequestModels and might return no ResponseModels. Controllers behave likewise.
- The graphical user interface version of the application is currently using Singleton (which is not recommended). The application has a unique instance of a StageManager, which keeps only one stage (window) on the screen, and loads the proper UI (fxml file) for each use case.
- This version follows the MVC pattern, but not strictly. In some occasions a presenter is added for easier implementation or simpler code.
- This version is an implementation of
Clean Architecture
- Borrows ideas from Clean Architecture, which involves multiple well-known others like DDD, Repository Pattern, Hexagonal/Onion/Layered Architecture, etc.
- Manual Dependency Injection with the Repository Pattern
- The Builder Pattern aids DTOs construction
- Asynchronous Programming (with
CompletableFuture<T>) & Multithreading (withExecutorService) -
ApplicationContextssimulate the Facade Pattern - Reflection
- Trie, Directed Acyclic Subsequence Graph, etc.
- Decoupling of controllers and presenters for better encapsulation
- SoC of
SynchronizedGeneratorsfor less intensive, asynchronous near real-time synchronization over batch synchronization