15
Campus Party 2014 REFACTORING WORKSHOP Carla Suárez @carlast22 María Gómez @mariascandella

Refactoring workshop (Campus Party Quito 2014)

Embed Size (px)

Citation preview

C a m p u s P a r t y 2 0 1 4

REFACTORING WORKSHOP Carla Suárez @carlast22

María Gómez @mariascandella !

REFACTORING

!

▫︎Method to change the code.

▫︎ The internal structure of a module get changed while the external one keeps unaltered.

▫︎Used for cleaner and better structured code.

2

SKILLS NEEDED FOR DEVELOPMENT

▫︎Use of good practices (SOLID principle)

▫︎Work on a incremental fashion

▫︎ TDD (test driven development)

▫︎Well designed test cases

▫︎ Pair programming

3

SOLID

▫︎ Single Responsibility Principle

▫︎Open/Closed Principle

▫︎ Liskov Substitution Principle

▫︎ Interface Segregation Principle

▫︎Dependency Inversion Principle

4

SOLID

▫︎ Single Responsibility Principle

5

“A class or module should have one one reason to change”

SOLID

▫︎Open/Closed Principle

6

“Software entities should be open for extension, but close for modification”

SOLID

▫︎ Liskov Substitution Principle

7

“Objects in a program should be replaceable with instances of their subtypes without altering the correctness of that

program”

SOLID

▫︎ Interface Segregation Principle

8

“No client should be force to depend on method it does not use”

SOLID

▫︎Dependency Inversion Principle

9

“Modules should depend upon abstractions, no upon concretions.”

WORKING INCREMENTALLY

10

InitialPlanning

Planning

Requirements Analysis  &  Design

Implementation

Deployment

TestingEvaluation

http://en.wikipedia.org/wiki/Iterative_and_incremental_development

UNIT TESTS

▫︎A way to test the correctness of a piece of code.

▫︎ They ensure that a module works correctly in an independent way.

11

UNIT TEST EXAMPLE

12

TDD (TEST DRIVEN DEVELOPMENT)

13

RED

GREENREFACTOR

PAIR PROGRAMMING

▫︎ Two developer working on the same code in the same computer.

▫︎Benefits:

▫︎Higher quality.

▫︎More productivity

▫︎ Less prone to errors

▫︎ Ping-pong model

14

LET’S CODE!

▫︎ http://tinyurl.com/cpq4TW

15