(Abstract Factory) Add factory of factories#665
Merged
Conversation
Contributor
Author
|
Sorry, I had problems with the checkstyle on the first commit. I have since configured it properly and made changes (3634b33) to my code so that it would follow the style guidelines. After that I had troubles with the correct command for running the maven checkstyle, so I needed an extra commit (933c84f). My code is now running locally with build success on |
iluwatar
requested changes
Nov 19, 2017
Owner
iluwatar
left a comment
There was a problem hiding this comment.
The change looks good in general. Can you also revise the explanation text in README.md so it is in sync with the new code?
Contributor
Author
|
Done, @iluwatar |
Owner
|
Thank you @Tschis for this improvement, much appreciated 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The explanation for the pattern mentions that it is "a factory of factories", but the example does not have any factory class that returns the concrete classes of KingdomFactory.
This commit removes the direct instantiation of ElfKingdomFactory and OrcKingdomFactory from App.main() and delegates their creation to a new (factory of factories) FactoryMaker inner class of App.
Even though the pattern itself does not necessarily need this, it helps to synchronize the explanation text with the coding example, making it easier to understand that statement.