-
Notifications
You must be signed in to change notification settings - Fork 57
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
Refactoring and DesignPattern #78
Open
hj0202
wants to merge
67
commits into
SecUSo:master
Choose a base branch
from
hj0202:refactoring-and-design-pattern
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
- Refactoring Part: hiddenPairInRow(), hiddenPairInColumn(), hiddenPairInSection() in QQWing.java - Refactoring Operation: Extract Method - Refactoring Reason: To make the code simpler and shorter by reduce duplicate code
rename ID to id to match the regular expression '^[a-z][a-zA-Z0-9]*$' extract field("The string must be ", " characters long.") extract method(parseValues) merge if statements and extract variable
extract method(parse), corrected a typo
corrected typos
rename UnDo to unDo and ReDo to redo to match the regular expression '^[a-z][a-zA-Z0-9]*$'
the result of renaming to match the regular expression '^[a-z][a-zA-Z0-9]*$'
rename to match the regular expression '^[a-z][a-zA-Z0-9]*$' merge if statements, extract method(updateNotes)
rename(overlapping level), extract method to reduce complexity
- Refactoring Part: generatePuzzleSymmetry() in QQWing.java - Refactoring Operation: Extract Method - Refactoring Reason: To make the code simpler and shorter by reduce duplicate code
Refactoring with extract method on GameActivity.java, LoadGameActivity.java, MainActivity.java, SettingsActivity.java, StatsActivity.java because of duplicated codes.
Refactoring with extract method on CreateSudokuActivity.java because of long method. And I rewrited conditional statement depending on the refactoring.
Create class about file input/output because there are duplicate codes in many classes. FileInputOuput Class has two field and two function.
Extract Method and Using other class's functions to remove duplicate code about file Input/Ouput Extract Constant "SAVES_CHANGED" refer to SonarLint Extract Method "fillGic" "removeGic" to reduce complexity
Rename from "puzzle" to "level" because function return value means puzzle Extract variable "gameTypeLocal" to clean code Rename from "errorList" to "errorListLocal" to conflict with global variable Combine if statment and extract variable for understandability Extract constant "LAST_GAME_ID" refer to SonarLint Extract variable "day" "month" "year" for understandability Rename from "c" to "cell" to express meaning well
Extract Method and Using other class's method about file Input/Output to remove duplicate code
Extract Method and Using other class's method about file Input/Ouput to remove duplicate code Remove not using variable Extract method "getHighscoreInfoContainer" to remove duplicate code and this method overoaded.
- Refactoring Part: colBoxReduction(), rowBoxReduction() in QQWing.java - Refactoring Operation: Extract Method - Refactoring Reason: By extracting long method, it becomes to understand and maintain it.
- Refactoring Part: QQWing.java, QQWingController.java - Refactoring Operation: Remove Dead Code - Refactoring Reason: To reduce code size
Refactoring and design pattern
Refactoring and design pattern
Fixed an error that occurred in doSomething() and getPosition()
use singleton design pattern about GameController.java SolverTest.java GameControllerTest.java CreateSudokuActivity.java GameActivity.java to increase memory / performance efficiency
…eechaewon21/privacy-friendly-sudoku into refactoring-and-design-pattern
- target class: CreateSudokuActivity.java - design pattern: MVP(google architecture) Apply MVP to the target class to separate UI and business logic. It makes it easy to test UI code.
Apply the template method pattern for CreateSudokuSpecialButtonLayout.java and SudokuSpecialButtonLayout.java to avoid duplicate code and increase reusability.
I'll let you know when I'm done. Thank you |
Input: checkUri valid inputUri -> (inputSudoku, errorMessage) Expected: inputSudoku != null
Input: checkUri invalid inputUri -> (inputSudoku, errorMessage) Expected: inputSudoku == null
Input: isValidInputSudoku valid sudoku Expected: return true
Input: isValidInputSudoku invalid size sudoku Expected: return false
Input: isValidInputSudoku unsolvable sudoku Expected: return false
nput: checkInputError (col, row, value) -> update errorList Expected: valid errorList
…n QQWing class Purpose: When putting a puzzle with single solution in QQWing class, test hasUniqueSolution(). Input: Input puzzle with single solution. Expected: hasUniqueSolution() outputs True.
…s in QQWing class Purpose: When putting a puzzle with multiple solutions in QQWing class, test hasUniqueSolution(). Input: Input puzzle with multiple solutions. Expected: hasUniqueSolution() outputs False.
…QQWing class Purpose: When putting a puzzle with none solution in QQWing class, test hasUniqueSolution(). Input: Input puzzle with none solution. Expected: hasUniqueSolution() outputs False.
…ter than GameType Purpose: When putting a puzzle with the solution shorter than GameType in QQWing class, test whether an exception is raised in hasUniqueSolution(). Input: Input puzzle with the solution shorter than GameType. Expected: ArrayIndexOutOfBoundsException is raised.
…er than GameType Purpose: When putting a puzzle with the solution longer than GameType in QQWing class, test hasUniqueSolution(). Input: Input puzzle with the solution longer than GameType. Expected: hasUniqueSolution() outputs False.
Purpose: When putting null puzzle in QQWing Class, test hasUniqueSolution(). Input: Input null puzzle. Expected: hasUniqueSolution() outputs False.
Make DailySudokuTest.java for DailySudoku Unit Test - setHintsUsed : check setting HintsUsed variable - setTimeNeeded : check setting TimeNeeded variable - getOrderingDataID : check today OrderingDataID value
Create HighscoreInfoContainer.java for HighscoreInfoContainer Unit Test - add : check adding gameController - incHints : check increasing hints - incTime : check increasing time - setInfosFromFile : check setting highScoreInfoConatiner Object from file
Purpose: Test getDifficulty when GameDifficulty is Easy. Input: Input puzzle whose GameDifficulty is Easy. Expected: GameDifficulty.Easy
Purpose: Test getDifficulty when GameDifficulty is Moderate. Input: Input puzzle whose GameDifficulty is Moderate. Expected: GameDifficulty.Moderate
Purpose: Test getDifficulty when GameDifficulty is Hard. Input: Input puzzle whose GameDifficulty is Hard. Expected: GameDifficulty.Hard
Purpose: Test getDifficulty when GameDifficulty is Challenge. Input: Input puzzle whose GameDifficulty is Challenge. Expected: GameDifficulty.Challenge
Purpose: Test getDifficulty when puzzle is none-solution. Input: Input puzzle whose solution is none. Expected: GameDifficulty.Unspecified I think that output is Unspecified when input is invalid. But, this function outputs Challenge.
Merge test cases of fabbitox
Merge test cases of leechaewon21
Added Test Code
Refactored the project for reusability and understandability. I'm done, so please review my pull request and check commits for more details. Thanks. |
Okay. This might take a while 😅 |
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 refactored your project for reusability and understandability.
For more details, please check with commit.
Thanks.