Skip to content

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

Merged
merged 3 commits into from
Aug 10, 2018

Conversation

7agustibm
Copy link
Contributor

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?

Copy link
Owner

@iluwatar iluwatar left a 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 and LotteryAdministration) should have interfaces. In this implementation only LotteryService 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);
Copy link
Owner

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 {
Copy link
Owner

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.

@iluwatar
Copy link
Owner

iluwatar commented Jul 8, 2018

Please comment when you've done the changes and are ready for another review.

@iluwatar
Copy link
Owner

iluwatar commented Aug 1, 2018

@7agustibm any updates?

@7agustibm
Copy link
Contributor Author

Sorry. Yes, you have a new version.
What do you think?

@iluwatar
Copy link
Owner

@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.

@iluwatar iluwatar merged commit c34004b into iluwatar:master Aug 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants