Assembling via Plain Code
There are several ways to implement a configuration component responsible for assembling the application. If we are building an application without the support of a dependency injection framework, we can create such a component with plain code:
package copyeditor.configuration;
class Application {
public static void main(String[] args) {
AccountRepository accountRepository = new AccountRepository();
ActivityRepository activityRepository = new ActivityRepository();
AccountPersistenceAdapter accountPersistenceAdapter =
new AccountPersistenceAdapter(accountRepository, activityRepository);
SendMoneyUseCase sendMoneyUseCase =
new SendMoneyUseService(
accountPersistenceAdapter, ...