Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: CodelyTV/php-finder_refactoring-kata
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: CodelyTV/php-finder_refactoring-kata
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 02-oop
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 10 commits
  • 15 files changed
  • 1 contributor

Commits on Aug 20, 2016

  1. Rename classes, interfaces, attributes and variables in src/ in order…

    … to provide Persons semantics
    JavierCane committed Aug 20, 2016
    Configuration menu
    Copy the full SHA
    0c3f14c View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    99b77f9 View commit details
    Browse the repository at this point in the history
  3. * Make Person and PersonsPair 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`
    JavierCane committed Aug 20, 2016
    Configuration menu
    Copy the full SHA
    ad0aa8a View commit details
    Browse the repository at this point in the history
  4. Moderate FinderCriteria as a Value Object instead of a plain `inter…

    …face` with two `const`
    JavierCane committed Aug 20, 2016
    Configuration menu
    Copy the full SHA
    d5397c6 View commit details
    Browse the repository at this point in the history
  5. 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
    JavierCane committed Aug 20, 2016
    Configuration menu
    Copy the full SHA
    e7cd505 View commit details
    Browse the repository at this point in the history
  6. 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`.
    JavierCane committed Aug 20, 2016
    Configuration menu
    Copy the full SHA
    8fba6ef View commit details
    Browse the repository at this point in the history
  7. Move the $allPersons input array from the Finder 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
    JavierCane committed Aug 20, 2016
    Configuration menu
    Copy the full SHA
    5974576 View commit details
    Browse the repository at this point in the history
  8. 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
    JavierCane committed Aug 20, 2016
    Configuration menu
    Copy the full SHA
    4b014cb View commit details
    Browse the repository at this point in the history
  9. 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
    JavierCane committed Aug 20, 2016
    Configuration menu
    Copy the full SHA
    097b1b9 View commit details
    Browse the repository at this point in the history
  10. Rename PersonsPairer::pair method to PersonsPairer::__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
    JavierCane committed Aug 20, 2016
    Configuration menu
    Copy the full SHA
    178f30d View commit details
    Browse the repository at this point in the history
Loading