Posted application framework, it seems to me, following the principles of clean architecture. There was a question - how to combine parts of the application without using dagger2 and similar tools? This is how I see the structure of the application.
// Layer UI public class Activity implements IView { Presenter presenter; // Кто передает презентер в активити? Или пускай сама и создаёт? } // Layer Presenters public class Presenter implements IPresentation{ interface IView { // ... } Presenter(IView view, Command cmd1, Command cmd2) { // Кто ещё, кроме презентера, может знать о вьюхах и кейсах (точнее об их интерфейсах)? } } // Layer Use Cases interface IPresentation { // ... } public interface Command { void execute(); } public class Start implements Command { public Start(IPresentation presentation, Entity entity) { // Кто создает экземпляр этого класса? } public void execute() { // ... } } public class Stop implements Command { public Stop(IPresentation presentation, Entity entity) { // ... } public void execute() { // ... } } // Layer Repository public class Repository { // В принципе, можно сделать методы статичными public Entity getEntity() { // ... return entity; } public void updateEntity(Entity entity) { // ... } } // Layer Entities public class Entity { // Ну тут вопросов нет. Ничего не знает и знать не хочет о нашем приложении }
daggeror how to make it work on a different principle? - JuriySPb ♦