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

Refactoring Ruby Edition

Refactoring Ruby Edition

Slides based on the book: "Refactoring: Ruby Edition"

Avatar for Julio Lucero

Julio Lucero

April 05, 2013
Tweet

More Decks by Julio Lucero

Other Decks in Programming

Transcript

  1. “A change made of the internal structure of software to

    make it easier to understand and cheaper to modify without changing its observable behavior”
  2. WHY SHOULD YOU REFACTOR? • Mejora el diseño del software

    • Hace que el software sea más fácil de entender • Ayuda a encontrar errores • Ayuda a Programar más Rápido
  3. Kinds of Refactorings 1. Composing Methods 2. Moving Features Between

    Objects 3. Organization Data 4. Simplifying Conditional Expressions 5. Making Method Calls Simpler 6. Dealing with Generalization
  4. 3. Organization Data row = [ ] row[0] = "Bichi

    Gol" row[1] = "20" # refactoring row = Player.new row.name = "Bichi Gol" row.goals = "20" Replace Array with Object
  5. 6. DEALING WITH GENERALIZATION • Pull Up/Down Method • Extract

    Module • Extract Subclass • Introduce Inheritance
  6. Guarda que termina. • Solid suite of test. • Always

    in small steps. • Any fool can write code that a computer can understand. Good programmers write code that humans can understand.