-
-
Notifications
You must be signed in to change notification settings - Fork 27k
First proposal for #586 Hexagonal Architecture primary ports should have interfaces #763
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @7agustibm for looking into this! Your first implementation is definitely a step into the right direction. My comments below.
- The build is failing due to Checkstyle issues
- Both primary ports (
LotterService
andLotteryAdministration
) should have interfaces. In this implementation onlyLotteryService
has.
WireTransfers bank = injector.getInstance(WireTransfers.class); | ||
try (final Scanner scanner = new Scanner(System.in)) { | ||
boolean exit = false; | ||
while (!exit) { | ||
printMainMenu(); | ||
String cmd = readString(scanner); | ||
LotteryService lotteryService = new LotteryServiceImpl(LOGGER); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LotteryService has already been injected above so we should use that
|
||
import java.util.Scanner; | ||
|
||
public interface LotteryService { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Public interfaces and methods need JavaDocs. See elsewhere too.
Please comment when you've done the changes and are ready for another review. |
@7agustibm any updates? |
Sorry. Yes, you have a new version. |
@7agustibm the changes look good and implement the task as requested. Good job 👍 The next step is to modify the blog post http://java-design-patterns.com/blog/build-maintainable-systems-with-hexagonal-architecture/ accordingly. Please make another pull request for that. You need to modify the gh-pages branch, see instructions here https://github.com/iluwatar/java-design-patterns/wiki/01.-How-to-contribute. |
It's a first proposal add interface primary ports for this issue #586.
I have adapted the ConsoleLottery with LotteryService Interface and implemented this. The ConsoleLottery create a new instance of LotteryServiceImpl and move this logic in the LotteryServiceImpl.
Maybe it's not a the best name for this class, but if you like the implementation, I will adapt the names of the classes and do the same with ConsoleAdministration.
@iluwatar Do you like this adaptation for Hexagonal Architecture with interface?