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

MatteoVaccariBirthdayGreetingsKataInSCBCN2013

trikitrok
September 28, 2013

 MatteoVaccariBirthdayGreetingsKataInSCBCN2013

Presentation for Matteo Vaccari's Birthday Greetings Refactoring Kata that we did in SCBCN

trikitrok

September 28, 2013
Tweet

Other Decks in Programming

Transcript

  1. The kata ­ Created by Matteo Vaccari. ­ Alistair Cockburn's:

    Ports and Adapters. a. k. a. Hexagonal Architecture ­ Refactoring version.
  2. The initial code 1. Read employee records from a file.

    2. Filter employees whose birthday is today. 3. Send a personalized greetings message by email.
  3. Problems  BirthdayService  Has too many responsibilities.  Depends

    on low level APIs.  Talks with external systems.  ...
  4. In the ports and adapters architecture  Domain Model depends

    on nothing  Everything depends on the domain model
  5. Refactoring approach 1. Identify a responsibility 2. Extract a method

    3. Create a new class 4. Move that method to the new class
  6. Refactoring guides  Single Responsibility Principle  First at function

    level, then at class level.  Dependency Inversion Principle