Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Build the right thing

Build the right thing

konrad_126

June 10, 2022
Tweet

More Decks by konrad_126

Other Decks in Programming

Transcript

  1. IT'S USING EXAMPLES TO TALK THROUGH HOW AN APPLICATION BEHAVES...

    AND HAVING CONVERSATIONS ABOUT THOSE EXAMPLES. DAN NORTH
  2. IT'S USING EXAMPLES TO TALK THROUGH HOW AN APPLICATION BEHAVES...

    AND HAVING CONVERSATIONS ABOUT THOSE EXAMPLES. DAN NORTH
  3. THE HARDEST SINGLE PART OF BUILDING A SOFTWARE SYSTEM IS

    DECIDING PRECISELY WHAT TO BUILD. FRED BROOKS DISCOVERY
  4. Feature: Real time update of Parking Lot occupancy In order

    to have accurate availability value for a parking lot, occupancy must be updated every time a driver enters a parking lot Scenario: Entering with First Come First Serve access type Given "Brussels Nord" parking lot has 53 available spots When a car enters "Brussels Nord" parking lot using "FCFS" access Then there are 52 available spots in "Brussels Nord" parking lot 1 2 3 4 5 6 7 8
  5. Given "Brussels Nord" parking lot has 53 available spots 1

    When a car enters "Brussels Nord" parking lot using "FCFS" access 2 Then there are 52 available spots in "Brussels Nord" parking lot 3 /** * @Given :arg1 parking lot has :arg2 available spots * @param mixed $arg1 * @param mixed $arg2 */ public function parkingLotHasAvailableSpots($arg1, $arg2) { throw new PendingException(); } 1 2 3 4 5 6 7 8 9
  6. Given "Brussels Nord" parking lot has 53 available spots 1

    When a car enters "Brussels Nord" parking lot using "FCFS" access 2 Then there are 52 available spots in "Brussels Nord" parking lot 3 /** * @Given :arg1 parking lot has :arg2 available spots * @param mixed $arg1 * @param mixed $arg2 */ public function parkingLotHasAvailableSpots($arg1, $arg2) { $parkingLot = new ParkingLot($arg1,$arg2); $this->parkingLots->save($parkingLot); } 1 2 3 4 5 6 7 8 9 10
  7. When a car enters "Brussels Nord" parking lot using "FCFS"

    access Given "Brussels Nord" parking lot has 53 available spots 1 2 Then there are 52 available spots in "Brussels Nord" parking lot 3 /** * @When a car enters :arg1 parking lot using :arg2 access */ public function aCarEntersParkingLotUsingAccess($arg1, $arg2) { throw new PendingException(); } 1 2 3 4 5 6 7
  8. When a car enters "Brussels Nord" parking lot using "FCFS"

    access Given "Brussels Nord" parking lot has 53 available spots 1 2 Then there are 52 available spots in "Brussels Nord" parking lot 3 /** * @When a car enters :arg1 parking lot using :arg2 access */ public function aCarEntersParkingLotUsingAccess($arg1, $arg2) { $this->bus->dispatch(new EnterParkingLot($arg1,$arg2))); } 1 2 3 4 5 6 7
  9. Then there are 52 available spots in "Brussels Nord" parking

    lot Given "Brussels Nord" parking lot has 53 available spots 1 When a car enters "Brussels Nord" parking lot using "FCFS" access 2 3 /** * @Then there are :arg2 available spots in :arg1 parking lot */ public function thereAreAvailableSpotsInParkingLot2($arg1, $arg2) { throw new PendingException(); } 1 2 3 4 5 6 7
  10. Then there are 52 available spots in "Brussels Nord" parking

    lot Given "Brussels Nord" parking lot has 53 available spots 1 When a car enters "Brussels Nord" parking lot using "FCFS" access 2 3 /** * @Then there are :arg2 available spots in :arg1 parking lot */ public function thereAreAvailableSpotsInParkingLot($arg1, $arg2) { $parkingLot = $this->parkingLots->findByName($arg2); Assert::equals($arg1, $parkingLot->capacity()); } 1 2 3 4 5 6 7 8