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

Agile Design

Agile Design

Requirements change and softwares rot.
We can write code more resilient to changes.

Rick Liu

March 25, 2016

Transcript

13 slides
  1. Softwares rot • Difficult to change • Fragile • Dependencies

    • Needless Complexity • Needless Repetition • Difficult to understand
  2. Version 1 of Copy program 1 def copy 2 while

    c = Keyboard.read do 3 Printer.write(c) 4 end 5 end
  3. First modification of Copy program 1 pt_flag = false 2

    3 def copy 4 while c = (pt_flag ? PaperTape.read : Keyboard.read) do 5 Printer.write(c) 6 end 7 end
  4. Give ‘em an inch The customers would sometimes like the

    Copy program to output to the paper tape punch.
  5. Second modification of Copy program 1 pt_flag = false 2

    punch_flag = false 3 4 def copy 5 while c = (pt_flag ? PaperTape.read : Keyboard.read) do 6 punch_flag ? Punch.write(c) : Printer.write(c) 7 end 8 end
  6. Responding to change 1 class KeyboardReader 2 def read 3

    Keyboard.read 4 end 5 end 6 7 8 def copy(reader=DefaultReader) 9 while c = reader.read do 10 Printer.write(c) 11 end 12 end
  7. Books • Agile Software Development, Principles, Patterns, and Practices, by

    Robert C. Martin • Working Effectively with Legacy Code, by Michael Feathers

More Decks by Rick Liu

Other Decks in Technology