From 8b30c22d6ee5a9f20c10ab3aa68343c4b79da742 Mon Sep 17 00:00:00 2001 From: Chris Beams Date: Thu, 21 Nov 2019 21:31:39 +0100 Subject: [PATCH] Move bisq.core{=>.app}.CoreModule There are two structural / organizational reasons for this move: 1. References from one package to another should always be upward or lateral, never downward, as the latter causes package cycles (aka 'tangles') which damage the suppleness and understandability of a large codebase. Prior to this change the high-level bisq.core.CoreModule class imported many classes from child packages like bisq.core.{btc,dao,user,util}, etc. By moving CoreModule down into the '.app' package, it can reference all these other packages as siblings instead of doing so as a parent. 2. the bisq.core.desktop and bisq.core.app packages are the only locations that reference the CoreModule class. By moving the class into bisq.core.app, greater cohesion is acheived, again making the codebase that much easier to read and understand. --- core/src/main/java/bisq/core/app/BisqHeadlessAppMain.java | 2 -- core/src/main/java/bisq/core/{ => app}/CoreModule.java | 4 +--- desktop/src/main/java/bisq/desktop/app/BisqAppModule.java | 2 +- grpc/src/main/java/bisq/grpc/BisqGrpcServerMain.java | 2 +- 4 files changed, 3 insertions(+), 7 deletions(-) rename core/src/main/java/bisq/core/{ => app}/CoreModule.java (98%) diff --git a/core/src/main/java/bisq/core/app/BisqHeadlessAppMain.java b/core/src/main/java/bisq/core/app/BisqHeadlessAppMain.java index 09e9f45108..e3fe211572 100644 --- a/core/src/main/java/bisq/core/app/BisqHeadlessAppMain.java +++ b/core/src/main/java/bisq/core/app/BisqHeadlessAppMain.java @@ -17,8 +17,6 @@ package bisq.core.app; -import bisq.core.CoreModule; - import bisq.common.UserThread; import bisq.common.app.AppModule; import bisq.common.app.Version; diff --git a/core/src/main/java/bisq/core/CoreModule.java b/core/src/main/java/bisq/core/app/CoreModule.java similarity index 98% rename from core/src/main/java/bisq/core/CoreModule.java rename to core/src/main/java/bisq/core/app/CoreModule.java index 4d921e6501..431dc1555e 100644 --- a/core/src/main/java/bisq/core/CoreModule.java +++ b/core/src/main/java/bisq/core/app/CoreModule.java @@ -15,11 +15,9 @@ * along with Bisq. If not, see . */ -package bisq.core; +package bisq.core.app; import bisq.core.alert.AlertModule; -import bisq.core.app.AppOptionKeys; -import bisq.core.app.BisqEnvironment; import bisq.core.btc.BitcoinModule; import bisq.core.dao.DaoModule; import bisq.core.filter.FilterModule; diff --git a/desktop/src/main/java/bisq/desktop/app/BisqAppModule.java b/desktop/src/main/java/bisq/desktop/app/BisqAppModule.java index 75c389288e..942c49a718 100644 --- a/desktop/src/main/java/bisq/desktop/app/BisqAppModule.java +++ b/desktop/src/main/java/bisq/desktop/app/BisqAppModule.java @@ -19,7 +19,7 @@ package bisq.desktop.app; import bisq.desktop.DesktopModule; -import bisq.core.CoreModule; +import bisq.core.app.CoreModule; import bisq.common.app.AppModule; diff --git a/grpc/src/main/java/bisq/grpc/BisqGrpcServerMain.java b/grpc/src/main/java/bisq/grpc/BisqGrpcServerMain.java index 3059931b96..7776686a7b 100644 --- a/grpc/src/main/java/bisq/grpc/BisqGrpcServerMain.java +++ b/grpc/src/main/java/bisq/grpc/BisqGrpcServerMain.java @@ -18,10 +18,10 @@ package bisq.grpc; import bisq.core.CoreApi; -import bisq.core.CoreModule; import bisq.core.app.BisqExecutable; import bisq.core.app.BisqHeadlessAppMain; import bisq.core.app.BisqSetup; +import bisq.core.app.CoreModule; import bisq.common.UserThread; import bisq.common.app.AppModule;