Secret Assumption of Agile

Preview:

DESCRIPTION

Early proponents of Agile assumed a certain style of programming that was an outgrowth of the Simple Design practice of eXtreme Programming. As Agile has been adopted, this particular style was not brought in as a co-requisite. This presentation explains aspects of this style, cites examples of the impact of its use, and describes a training program developed by Fred George to address this deficiency. This training program formed the basis of ThoughtWorks University several years after its creation. (Presentation given at Agile India 2013)

Citation preview

Copyright © 2009-2013 by Fred George

The Secret Assumptionof Agile

1

Fred Georgefredgeorge@acm.org@fgeorge52

Copyright © 2009-2013 by Fred George

Agile is Productive

2

Traditional

12 Months

$28 / Hour

$2,000,000

Agile

8 Months.............3 Months5 Months8 Months

$87 / Hour

$1,100,0006x

Copyright © 2009-2013 by Fred George

How?

3

1. Code That Can Change2. Lean Management3. Processing Power

Copyright © 2009-2013 by Fred George

“Objects are only good for programs that change.”Rick DeNatale, IBM1988

4

Copyright © 2009-2013 by Fred George

Stories Assume Easy Change

5

Copyright © 2009-2013 by Fred George

Typical Program

6

public void foo( ) {........................

}

How many lines?

2.3 lines / method25 lines / class

Smalltalk:1.1 lines / method

Copyright © 2009-2013 by Fred George

Replacement Application

7

Old

Java

Oracle DB

Web UI

72 Classes

New

1400 Classes

Java

Oracle DB

Web UI

Copyright © 2009-2013 by Fred George

Tasking Cycle

8

TaskDesign

TestCode

Integrate

Ship

Copyright © 2009-2013 by Fred George

Task Cycle Case Study

9

TaskDesign

TestCode

Integrate1,000,000 Lines of J2EE Code50 Programmers4000 TestsCycle Time?

2-4 Hours

Copyright © 2009-2013 by Fred George

Tasking Cycle

10

TaskDesign

TestCode

Integrate

15 Minutes

15 Minutes

Copyright © 2009-2013 by Fred George

Simple Design

1. Works

2. Communicates

3. No duplicate code

4. Least classes and methods

Applies to Application and Tests

12

Copyright © 2009-2013 by Fred George

RefactoringMartin Fowler

13

Copyright © 2009-2013 by Fred George

Tasking Cycle

14

TaskDesign

TestCode

Integrate

SimpleDesign

Refactoring

Copyright © 2009-2013 by Fred George

Refactoring to PatternsJoshua Kerievsky

15

Copyright © 2009-2013 by Fred George

Refactoring

IntroducePatterns

Refactoring

Tasking Cycle

16

TaskDesign

TestCode

Integrate

Copyright © 2009-2013 by Fred George

Case Study: Complexity

Cyclomatic Complexity

100 is Bad

“...never seen less than 5” - Senior Architect

Cyclomatic Complexity: 1.8

9 week test: 1 bug, fixed within 2 hours

17

Copyright © 2009-2013 by Fred George 18

Path to Proficiency

Workin

g

Experience

Training

Copyright © 2009-2013 by Fred George

Product Requests (London)

19

23 Stories15 Days

28 Stories12 Days

Class5 Days

Payback:11 Days

Copyright © 2009-2013 by Fred George

OO Boot Camp

20

“...teaches you to think like a programmer...”

Copyright © 2009-2013 by Fred George 21

“15 minutes after the class started, I realized I knew nothing about programming.”Lead Designer, Consulting Firm, commenting to CIO of a large US manufacturer.

Copyright © 2009-2013 by Fred George

OO Boot Camp

22

History: Since 1995

Over 1000 Students; 3 countries

Java, VB, C#, Ruby

Socratic Method (Question - Answer - Question)

60%+ Lab

Pair Programming

Test First (15 Minute Cycle)

Students Present Solutions

Copyright © 2009-2013 by Fred George

Master

Journeyman

Apprentice

23

Copyright © 2009-2013 by Fred George 24

Master

Journeyman

Apprentice

2-6 Months

2 Years - Never

Copyright © 2009-2013 by Fred George

Part 1: PrinciplesEncapsulation

Object Relationships

Inheritance

Delegation

Polymorphism

Collaborating Objects

Interfaces

Coding Patterns

Refactoring

Recursion

25

40-50 Hours

Copyright © 2009-2013 by Fred George

Part 2: Design PatternsRationale

Patterns vs. Principles

Observer Pattern

Iterator Pattern

Mediator Pattern

Composite Pattern

Visitor Pattern

Builder Pattern

Concerts

Survey of Patterns

26

40-50 Hours

Copyright © 2009-2013 by Fred George

Suspicious Statements

case - Almost always wrong

else - Mostly wrong

if - Suspicious

Unless guard clause at start of method

Substitute Design Patterns for all these

27

Copyright © 2009-2013 by Fred George

Suspicious Methods

getters - Violates Encapsulation

setters - Worse: violates Encapsulation and Object integrity

Methods with 2 or more levels of indenting

28

Copyright © 2009-2013 by Fred George

Suspicious Classes

Classes with names ending in -er or -or

Special naming conventions for Interfaces

Interface with a single implementing Class

Classes with more than 2 instance variables

29

Copyright © 2009-2013 by Fred George

Results

30

Dropouts

Journeymen

Predictors

Retention

Support

20%

20%

Architecture, Design, Multiple Languages

Must be used within a month

Journeymen, Masters

Copyright © 2009-2013 by Fred George

Maintenance

31

Old

Java

Oracle DB

Web UI

72 Classes

New

1400 Classes

Java

Oracle DB

Web UI

Copyright © 2009-2013 by Fred George

Transition Plan

32

No Documentation

No Training

No Time

No Problem!

Copyright © 2009-2013 by Fred George

Training -- OO Boot Camp

33

First class 1 October

9-12 students / class

Include project managers and QA

4 classes so far

Copyright © 2009-2013 by Fred George

Implementation

34

Start development on 15 October

Ruby used (never used before 1 October)

No stories - just business problem

First page ready for review by end of November

Copyright © 2009-2013 by Fred George

Currently...

35

5 Tables running

Each Table has it’s own business problem

Only developers

Speaker designated

Processes are varying, particularly metrics

Copyright © 2009-2013 by Fred George

Questions?

36

Recommended