-
Notifications
You must be signed in to change notification settings - Fork 11
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
pattern application #1
Open
eunsdaily
wants to merge
29
commits into
Starfoil:master
Choose a base branch
from
eunsdaily:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains 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
Collision Facade pattern
un-uploaded file added
2. GameManager.java, State.java, StateZero, StateOne, StateTwo, StateThree, StateFour 3. Because the updateStatus () and perform Status () of the GameManager divide the state by the conditional statement, the state pattern is applied
State Pattern applyed
2. Refactoring applies to Boss, EnemyEntity, EnemyUnit. 3. Boss and EnemyUnit have same code.
GameManager.java, State.java, StateAllEnemiesDead.java, StateAllPlayersDead.java, StateMovingPlayerintoPosition.java, StateOngoingGame.java, StateStart.java Because the updateStatus () and perform Status () of the GameManager divide the state by the conditional statement, the state pattern is applied
2. The refactoring target is Boss class. 3. The condition is long(bad smell)
2. The refactoring target is Boss class. 3. The previous function updateBullets has two functions, which violates the SRP.
2. GameManager.java, State.java, StateAllEnemiesDead.java, StateAllPlayersDead.java, StateMovingPlayerintoPosition.java, StateOngoingGame.java, StateStart.java, StateMethods.java 3. Because the updateStatus () and perform Status () of the GameManager divide the state by the conditional statement, the state pattern is applied
2. Refactoring was conducted for Boss, EnemyEntity, EnemyUnit. 3. in draw, Boss and EnemyUnit has same code.
Refactoring
2. SingleplayerBoard.java, GameManager.java 3. There should be only one gameManager in a game. You can add the game you were doing, and the return function. The determination of the game was improved.
singleton
2. mainGUI -> enemyPenel, enemyUpdateList, skinPanel, skinUpdatePanel, GUIPanel, UpdateList 3. this pattern guarantee 'updateList' function's encapsulation and Flexibility. thus extendability increase.
2. mainGUI/FontData 3. In enermyPanel, skinPanel, and onlinePanel, we use the Font variable, which creates a new instance each time. we also use the Font variable for other classes. Because it is not a good idea to call instances often, I applied the Singleton pattern.
2. main/SingleplayerBoard 3. It does several things in one method. So I extract method.
2. mainGUI/playerData 3. It does two things in one method. So I extract method.
2. mainGUI/MainMenu 3. It does several things in one method. So I extract method.
2. mainGUI/onlinePanel 3. It does several things in one method. So I extract method.
2. The refactoring target is EnemyUnit class. 3. The condition is long
refactoring
refactoring(Abstract class)
2. The refactoring targets are StateMehods, StateAllPlayersDead, StateAllEnemiesDead, StateOngoingGame. 3. duplicated method.
2. enemyPanel, GUIPanel, skinPanel 3. add setUpdateListStrategy to GUIPanel for encapsulation.
1. no pattern just refactoring(extra method and pull up)
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.
We applied the software pattern to your project and code refactoring as a school assignment.