-
Notifications
You must be signed in to change notification settings - Fork 27
Comparing changes
Open a pull request
base repository: CodelyTV/php-finder_refactoring-kata
base: master
head repository: CodelyTV/php-finder_refactoring-kata
compare: 02-oop
- 10 commits
- 15 files changed
- 1 contributor
Commits on Aug 20, 2016
-
Rename classes, interfaces, attributes and variables in src/ in order…
… to provide Persons semantics
Configuration menu - View commit details
-
Copy full SHA for 0c3f14c - Browse repository at this point
Copy the full SHA 0c3f14cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 99b77f9 - Browse repository at this point
Copy the full SHA 99b77f9View commit details -
* Make
Person
andPersonsPair
attributes private* Create constructor for `Person` and `PersonsPair` classes and remove setters * Remove the get prefix from getters * Move the responsibility of calculating the `birthDaysDistanceInSeconds` from the `Finder` to the `PersonsPair` * Throw an exception `NotEnoughPersonsException` in case of receiving not enough persons in order to find a pair. * Refactor the test in order to expect the new exception instead of an empty/inconsistent `PersonsPair`
Configuration menu - View commit details
-
Copy full SHA for ad0aa8a - Browse repository at this point
Copy the full SHA ad0aa8aView commit details -
Moderate
FinderCriteria
as a Value Object instead of a plain `inter……face` with two `const`
Configuration menu - View commit details
-
Copy full SHA for d5397c6 - Browse repository at this point
Copy the full SHA d5397c6View commit details -
Improve
Finder
class readability:* Extract private methods from the `Finder::find` public one * Replace `$i` and `$j` index by the more semantic ones `$currentPersonIteration` and `$personToPairIteration` * Extract `$currentPerson` and `$personToPair` explanatory variables
Configuration menu - View commit details
-
Copy full SHA for e7cd505 - Browse repository at this point
Copy the full SHA e7cd505View commit details -
Make the Finder OCP (Open/Closed SOLID Principle) compliant
* Refactor the `FinderCriteria` Value Object into an `interface` and implement it from two different models `ClosestBirthDateCriteria` and `FurthestBirthDateCriteria`. This classes implement the logic to determine which `PersonsPair` `hasMorePriority`. So if we want to add another different criteria, we just need to implement the `PersonsPairCriteria` interface and pass it to the `Finder:: find` method without modifying any `switch` nor `if`/`elseif`.
Configuration menu - View commit details
-
Copy full SHA for 8fba6ef - Browse repository at this point
Copy the full SHA 8fba6efView commit details -
Move the
$allPersons
input array from theFinder
constructor to t……he `find` method. This way we don't need to create 2 different `Finder` instances in order to execute the algorithm with 2 different inputs, and more importantly, we leave the constructor ready in order to only receive collaborator as parameters
Configuration menu - View commit details
-
Copy full SHA for 5974576 - Browse repository at this point
Copy the full SHA 5974576View commit details -
Extract the responsibility of pair all the
Person
received as the `……Finder::find` input into the new `PersonsPairer` interface allowing also OCP applications on that end
Configuration menu - View commit details
-
Copy full SHA for 4b014cb - Browse repository at this point
Copy the full SHA 4b014cbView commit details -
Extract the responsibility of constructing the
PersonsPair
from the…… `PersonsPairer` to its own `PersonsPairFactory`. This way we can mix different `PersonsPairer` implementations without repeating the `PersonsPair` construction logic
Configuration menu - View commit details
-
Copy full SHA for 097b1b9 - Browse repository at this point
Copy the full SHA 097b1b9View commit details -
Rename
PersonsPairer::pair
method toPersonsPairer::__invoke
for ……consistency. We don't need the method name semantics. We're doing little pieces so the semantics could be in the interface or class name by its own
Configuration menu - View commit details
-
Copy full SHA for 178f30d - Browse repository at this point
Copy the full SHA 178f30dView commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff master...02-oop