SlideShare ist ein Scribd-Unternehmen logo
1 von 138
Downloaden Sie, um offline zu lesen
Simple Design Applied
    Spend more time creating
         valuable code



Alistair McKinnell   Declan Whelan
    @mckinnell         @dwhelan
Exercise
What is Simple Design?

 On an index card write up to
 three facts on an index card.

    Be ready to share with
          your table.
What is Simple Design?

 At your table gather the facts
 and count how many distinct
    facts you came up with.
Introductions



      ?
www.XProgramming.com
Exercise
Simple Design

At your table order the
rules of simple design in
      priority order.
Simple Design

1. All tests must pass
2. No code is duplicated
3. Code is self-explanatory
4. No superfluous parts exist
Simple Design

1. All tests must pass
2. No code is duplicated
3. Code is self-explanatory
4. No superfluous parts exist
Simple Design

1. Passes its tests
2. No code is duplicated
3. Code is self-explanatory
4. No superfluous parts exist
Simple Design

1. Passes its tests
2. Minimizes duplication
3. Code is self-explanatory
4. No superfluous parts exist
Simple Design

1. Passes its tests
2. Minimizes duplication
3. Maximizes clarity
4. No superfluous parts exist
Simple Design

1. Passes its tests
2. Minimizes duplication
3. Maximizes clarity
4. Has fewer elements
Simple Design

1. Passes its tests (given TDD)
2. Minimizes duplication
3. Maximizes clarity
4. Has fewer elements
Simple Design

1. Passes its tests (given TDD)
2. Minimizes duplication
3. Maximizes clarity (fix names)
4. Has fewer elements
Simple Design

1. Passes its tests (given TDD)
2. Minimizes duplication
3. Maximizes clarity (fix names)
4. Has fewer elements
That leaves me with two key elements
of simple design: remove duplication and
fix bad names.
When I remove duplication, I tend to see
an appropriate structure emerge, and when
I fix bad names, I tend to see responsibilities
slide into appropriate parts of the design.


                          J. B. Rainsberger
Simple Design

• Remove duplication
• Fix bad names
Simple Design
       (for today)
• Fix bad names

    ❤    Choosing good names

• Remove duplication

    ❤    Commonality & Variability
Exercise
Stroop Effect
 Green Red Blue
Purple Blue Purple
 Green Red Blue
Purple Blue Purple
 Blue Purple Red
Green Purple Green
Meaning:




Colour:
           black
           yellow
Meaning:




Colour:
           blue
           black
black
yellow
yellow
 red
red
yellow
red
yellow
blue
blue
yellow
 blue
red
red
blue
red
yellow
yellow
red
yellow
red
yellow
blue
black
yellow
black
black
blue
red
black
The
End
Exercise
CComBstr sVal                                 $.getJSON()                                        int result




                Rx rx                   applyMeasureConstraintToEnableSortingByMeasure()                     float hp




    applyPhq9DateRangeConstraint()                      public void run()                                Date genymdhms




               m_name                                      Label label                                    IShapeFactory




              Customer                                        int i                        RollOverPerformanceIndicatorsToNextMonthTask




          CustomerManager                              LPSTR lpCmdLine                               int daysSinceModification




          boolean fNewPage                      UpdatePerfIndValueDecCountCmd                  DepressionSelfManagementCalculator



                                                             Tutorial02

PerfIndValueDecCountForMatchingIvpCmd                    PulseRenderer                               IndexCardPageLayout sut
CComBstr sVal                                 $.getJSON()                                        int result




                Rx rx                   applyMeasureConstraintToEnableSortingByMeasure()                     float hp




    applyPhq9DateRangeConstraint()                      public void run()                                Date genymdhms




               m_name                                      Label label                                    IShapeFactory




              Customer                                        int i                        RollOverPerformanceIndicatorsToNextMonthTask




          CustomerManager                              LPSTR lpCmdLine                               int daysSinceModification




          boolean fNewPage                      UpdatePerfIndValueDecCountCmd                  DepressionSelfManagementCalculator



                                                             Tutorial02

PerfIndValueDecCountForMatchingIvpCmd                    PulseRenderer                               IndexCardPageLayout sut
Find a partner and each of you:

1. select a name you thought was good
2. explain why to your partner
3. select a name you thought was bad
4. explain why to your partner
                                      CComBstr sVal                                 $.getJSON()                                        int result




                                          Rx rx                   applyMeasureConstraintToEnableSortingByMeasure()                     float hp




                              applyPhq9DateRangeConstraint()                      public void run()                                Date genymdhms




                                         m_name                                      Label label                                    IShapeFactory




                                        Customer                                        int i                        RollOverPerformanceIndicatorsToNextMonthTask




                                    CustomerManager                              LPSTR lpCmdLine                               int daysSinceModification




                                    boolean fNewPage                      UpdatePerfIndValueDecCountCmd                  DepressionSelfManagementCalculator




                          PerfIndValueDecCountForMatchingIvpCmd                    PulseRenderer                               IndexCardPageLayout sut
Choosing Good Names
Choosing Good Names
    Use the telephone test for readability.
    If someone could understand your
    code when read aloud over the
    telephone, it's clear enough.
    If not, then it needs rewriting.
Telephone Test


Goal Donor vs Gold Owner

  Date genymdhms
Choosing Good Names
    Splitters can be lumped more easily
    than lumpers can be split.
    It is easier to combine two concepts
    that it is to separate them.
Splitting a Lumper

 Customer Address
Splitting a Lumper

                  Customer Address




Billing Address     Mailing Address   Service Address
Lumping a Splitter

Billing Address   Mailing Address   Service Address
Lumping a Splitter

Billing Address   Mailing Address    Service Address




                  Customer Address
Choosing Good Names

    Pronounceable Names
    Avoid Encodings
Pronounceable Names

UpdatePerfIndValueDecCountCmd
Pronounceable Names

UpdatePerfIndValueDecCountCmd


DecrementAggregateCommand
Pronounceable Names

Date genymdhms
Pronounceable Names

Date genymdhms


Date generatedTimestamp
Avoid Encodings

LPSTR lpCmdLine
LPSTR commandLine

m_name
name
Choosing Good Names

    Intention-Revealing Name
    Role-Suggesting Name
Intention-Revealing Name

applyMeasureConstraintTo
    EnableSortingByMeasure()
Intention-Revealing Name

applyMeasureConstraintTo
    EnableSortingByMeasure()

applyMeasureConstraint()
Role-Suggesting Name

int result


IndexCardPageLayout sut
Choosing Good Names


    Ubiquitous Language
Ubiquitous Language

CComBstr sVal
Ubiquitous Language

CComBstr sVal


CComBstr calibrationToolName
Ubiquitous Language

Rx rx
Ubiquitous Language

Rx rx


Rx refillable
Ubiquitous Language

applyPhq9DateRangeConstraint()


The PHQ-9 is the nine item depression scale of
the Patient Health Questionnaire.

The PHQ-9 is a powerful tool for assisting primary
care clinicians in diagnosing depression as well as
selecting and monitoring treatment.
Pragmatic
            Programmers                                 Agile in a Flash
                                                                  Speed-Learning Agile
                                                                 Software Development

                                                                                       Agile Cards for
                                                                                         Agile Teams




                                                                                       Jeff Langr and
                                                                                         Tim Ottinger
                                                                                      edited by Susannah Pfalzer



Prepared exclusively for Alistair McKinnell   Copyright ©2011 Pragmatic Programmers
43            Really Meaningful Names


               ® Are accurate
               ® Are purposeful
               ® Are pronounceable
               ® Begin well
               ® Are simple
               ® Depend on context
               ® Match name length to scope




Prepared exclusively for Alistair McKinnell   Copyright ©2011 Pragmatic Programmers
Choosing Good Names
                                                                                                     •Locate one
                             Naming'Guidelines
System'of'Names
    S1# #   Name#pass#the#“telephone”#test.
    S2# #   There#is#a#clean#name#for#each#concept.#Remember:#later#on#it’s#easier#to#lump#




                                                                                                      guideline that if
            things#together#than#to#split#them#apart.
    S3# #   Name#is#from#the#problem#or#solu?on#domain#and#support#ubiquitous#language#for#
            the#team

General



                                                                                                      applied would have
    G1##    Name#is#pronounceable.
    G2##    Name#avoids#encodings#and#member#prefixes.
    G3##    Name#suggest#why#it#exists.
    G4##    Name#suggest#how#it#should#be#used.




                                                                                                      the biggest impact
    G5##    Name#suggest#what#it#does.
    G6##    Name#is#easily#searchable#in#the#code#base.


Classes
    C1#     If#this#is#an#important#base#class#its#class#name#should#be#a#simple#single#word.
    C2#
    C3#
            If#this#is#a#subclass#its#class#name#suggests#how#it#differs#from#its#superclass.
            The#class#name#is#a#noun#or#a#noun#phrase.
                                                                                                      on your code
                                                                                                     •Find a partner
Methods
    M1#     The#method#name#suggests#why#it#would#be#called.
    M2#     The#method#is#name#a#verb#or#a#verb#phrase.


Variables/Fields/Arguments



                                                                                                     •Discuss
    V1#     Its#name#indicate#the#role#it's#playing.
    V2#     The#length#of#the#name#reflect#its#scope.


Alistair McKinnell @amckinnell Declan Whelan @dwhelan
Naming Guidelines v1.0 August 2012 !                                                           1/1
Choosing Good Names
public List<int[]> getThem() {
  List<int[]> list1 = new ArrayList<int[]>();

    for (int[] x : theList)
      if (x[0] == 4)
        list1.add(x);

    return list1;
}




Source: Clean Code: A Handbook of Agile Software Craftsmanship, Robert C. Martin, pages 18-19
Choosing Good Names
public List<int[]> getThem() {
  List<int[]> list1 = new ArrayList<int[]>();

    for (int[] x : theList)
      if (x[0] == 4)
        list1.add(x);

    return list1;
}

public List<int[]> getFlaggedCells() {
  List<int[]> flaggedCells = new ArrayList<int[]>();

    for (int[] cell : gameBoard)
      if (cell[STATUS_VALUE] == FLAGGED)
        flaggedCells.add(cell);

    return flaggedCells;
}

Source: Clean Code: A Handbook of Agile Software Craftsmanship, Robert C. Martin, pages 18-19
Choosing Good Names
public List<int[]> getThem() {
  List<int[]> list1 = new ArrayList<int[]>();

    for (int[] x : theList)
      if (x[0] == 4)
        list1.add(x);

    return list1;
}

public List<Cell> getFlaggedCells() {
  List<Cell> flaggedCells = new ArrayList<Cell>();

    for (Cell cell : gameBoard)
      if (cell.isFlagged())
        flaggedCells.add(cell);

    return flaggedCells;
}

Source: Clean Code: A Handbook of Agile Software Craftsmanship, Robert C. Martin, pages 18-19
Choosing Good Names
public List<int[]> getThem() {
  List<int[]> list1 = new ArrayList<int[]>();

    for (int[] x : theList)
      if (x[0] == 4)
        list1.add(x);

    return list1;
}

public List<Cell> getFlaggedCells() {
  List<Cell> result = new ArrayList<Cell>();

    for (Cell cell : gameBoard)
      if (cell.isFlagged())
        result.add(cell);

    return result;
}

Source: Clean Code: A Handbook of Agile Software Craftsmanship, Robert C. Martin, pages 18-19
Choosing Good Names
int s = 0;

for (int j=0; j<34; j++) {
  s += (t[j]*4)/5;
}


const int EFFECTIVE_DAYS_PER_WEEK = 4;
int realDaysPerIdealDay = 4;
const int WORKING_DAYS_PER_WEEK = 5;
const int WORK_DAYS_PER_WEEK = 5;
int sum = 0;
int effectiveTotalEstimate = 0;
for (int j=0; j < NUMBER_OF_TASKS; j++) {
for (int j=0; j < NUMBER_OF_TASKS; j++) {realDaysPerIdealDay;
  int realTaskDays = taskEstimate[j] *
  int effectiveTaskEstimate =
  int realTaskWeeks = (realdays / WORK_DAYS_PER_WEEK);
    taskEstimate[j] * EFFECTIVE_DAYS_PER_WEEK / WORKING_DAYS_PER_WEEK;
  sum += realTaskWeeks;
  effectiveTotalEstimate += effectiveTaskEstimate;
}
}



        Source: Clean Code: A Handbook of Agile Software Craftsmanship, Robert C. Martin, page 23
What’s In A Name?


   Moonbeam
    Zappa
All tests must pass       No code is duplicated




Code is self-explanatory   No superfluous parts exist
No code is duplicated
Exercise
How do you handle
   duplicate code
 in your codebase?
Avoiding Duplicate Code

     DRY: Don’t Repeat Yourself
     Every piece of knowledge must have
     a single, unambiguous, authoritative
     representation within a system.
Avoiding Duplicate Code

     Once and Only Once
     Data, structure, or logic should exist
     in only one place in the system.
Avoiding Duplicate Code

     Test-Driven Development
     1. Write new code only if an
        automated test has failed.
     2. Eliminate duplication.
Avoiding Duplicate Code

     Single Choice Principle
     Whenever a software system must
     support a set of alternatives, one
     and only one module in the system
     should know their exhaustive list.
Avoiding Duplicate Code

     Duplication may be the
     root of all evil in software.
Commonality and Variability
Copy & Paste
function something() {



}
function something() {




}


function something() {




}
function something() {




}


function somethingElse() {




}
function something() {




}


function somethingElse() {




}
Duplicate Code
Copy & Paste
Edit the Copy
                ☞ Duplicate Code
Duplicate Code

Avoid duplication by expressing
  commonality and variability
           explicitly.
function something() {




}


function somethingElse() {




}
Duplicate Code:
Select Options
Can you spot the
   commonality and variation?

Can you spot the duplicate code?

   How would you make the
commonality and variation explicit?
public static List<SelectOption> createEndMonthList(Date expiryDate) {
    int selectedMonth = getDateMonth(expiryDate);

    SelectOptionsSource months = new SelectOptionsSource(1, 12, selectedMonth);
    SelectOptions monthOptions = new SelectOptions(months);

    return monthOptions.create();
}

public static List<SelectOption> createEndDaysList() {
    int selectedDay = getDateDay(getCurrentDatePlus14Days());

    SelectOptionsSource days = new SelectOptionsSource(1, 31, selectedDay);
    SelectOptions dayOptions = new SelectOptions(days);

    return dayOptions.create();
}

public static List<SelectOption> createEndYearList() {
    int selectedYear = getDateYear(getCurrentDatePlus14Days());

    SelectOptionsSource years = new SelectOptionsSource(1985, 1985 + 30, selectedYear);
    SelectOptions yearOptions = new SelectOptions(years);

    return yearOptions.create();
}
public static List<SelectOption> createEndMonthList(Date expiryDate) {
    int selectedMonth = getDateMonth(expiryDate);

    SelectOptionsSource months = new SelectOptionsSource(1, 12, selectedMonth);
    SelectOptions monthOptions = new SelectOptions(months);

    return monthOptions.create();
}

public static List<SelectOption> createEndDaysList() {
    int selectedDay = getDateDay(getCurrentDatePlus14Days());

    SelectOptionsSource days = new SelectOptionsSource(1, 31, selectedDay);
    SelectOptions dayOptions = new SelectOptions(days);

    return dayOptions.create();
}

public static List<SelectOption> createEndYearList() {
    int selectedYear = getDateYear(getCurrentDatePlus14Days());

    SelectOptionsSource years = new SelectOptionsSource(1985, 1985 + 30, selectedYear);
    SelectOptions yearOptions = new SelectOptions(years);

    return yearOptions.create();
}
public static List<SelectOption> createEndMonthList(Date expiryDate) {
    int selectedMonth = getDateMonth(expiryDate);

    SelectOptionsSource months = new SelectOptionsSource(1, 12, selectedMonth);
    SelectOptions monthOptions = new SelectOptions(months);

    return monthOptions.create();
}

public static List<SelectOption> createEndDaysList() {
    int selectedDay = getDateDay(getCurrentDatePlus14Days());

    SelectOptionsSource days = new SelectOptionsSource(1, 31, selectedDay);
    SelectOptions dayOptions = new SelectOptions(days);

    return dayOptions.create();
}

public static List<SelectOption> createEndYearList() {
    int selectedYear = getDateYear(getCurrentDatePlus14Days());

    SelectOptionsSource years = new SelectOptionsSource(1985, 1985 + 30, selectedYear);
    SelectOptions yearOptions = new SelectOptions(years);

    return yearOptions.create();
}
Select Options
           SelectOptions                      SelectOptionsSource

create()                                  getFirst()
                                          getLast()
                                          isSelected()




     Commonality            Variability                  Resolution
                                                         Encapsulate
       Behaviour           Collaborator
                                                          Collection
Select Options
           SelectOptions                       SelectOptionsSource

create()                                   getFirst()
                                           getLast()
                                           isSelected()




     Commonality             Variability                  Resolution

    Data Structure         Value of State            Simple Java Type
Select Options
           SelectOptions               SelectOptionsSource

create()                           getFirst()
                                   getLast()
                                   isSelected()




                           Encapsulate
                           Collection
Select Options
           SelectOptions               SelectOptionsSource

create()                          getFirst()
                                  getLast()
                                  isSelected()




                           Parameter
                           Object
Duplicate Code:
Compound Result Handler
Can you spot the
   commonality and variation?

Can you spot the duplicate code?

   How would you make the
commonality and variation explicit?
if ( ... ) {




} else {




}
Compound Result Handler
    CompoundResultHandler                CompoundResultClassifier

                                        isNegative()
                                        isPositive()




                                     AbstractCompoundResultClassifier

                                     toNumber()




                  QueensCompoundResultClassifier            StandardCompoundResultClassifier

                 isNegative()                             isNegative()
                 isPositive()                             isPositive()
Compound Result Handler
    CompoundResultHandler                CompoundResultClassifier

                                        isNegative()
                                        isPositive()




                                     AbstractCompoundResultClassifier

                                     toNumber()




                  QueensCompoundResultClassifier            StandardCompoundResultClassifier

                 isNegative()                             isNegative()
                 isPositive()                             isPositive()
Compound Result Handler
      CompoundResultHandler                CompoundResultClassifier

                                          isNegative()
                                          isPositive()




                                       AbstractCompoundResultClassifier

                                       toNumber()




                    QueensCompoundResultClassifier            StandardCompoundResultClassifier

                   isNegative()                             isNegative()
                   isPositive()                             isPositive()




 Commonality                         Variability                                Resolution
                                                                              Inheritance
  Behaviour                       Implementation
                                                                           (Object-Oriented)
Compound Result Handler
      CompoundResultHandler                CompoundResultClassifier

                                          isNegative()
                                          isPositive()




                                       AbstractCompoundResultClassifier

                                       toNumber()




                    QueensCompoundResultClassifier            StandardCompoundResultClassifier

                   isNegative()                             isNegative()
                   isPositive()                             isPositive()




 Commonality                         Variability                                Resolution
                                                                              Inheritance
  Behaviour                       Implementation
                                                                           (Object-Oriented)
Compound Result Handler
        CompoundResultHandler                CompoundResultClassifier

                                            isNegative()
                                            isPositive()




                                         AbstractCompoundResultClassifier

                                         toNumber()




                      QueensCompoundResultClassifier            StandardCompoundResultClassifier

                     isNegative()                             isNegative()
                     isPositive()                             isPositive()




 Commonality                           Variability                                Resolution

 Implementation                            None                                   Base Class
Compound Result Handler
        CompoundResultHandler                CompoundResultClassifier

                                            isNegative()
                                            isPositive()




                                         AbstractCompoundResultClassifier

                                         toNumber()




                      QueensCompoundResultClassifier            StandardCompoundResultClassifier

                     isNegative()                             isNegative()
                     isPositive()                             isPositive()




 Commonality                           Variability                                Resolution

 Implementation                            None                                   Base Class
Compound Result Handler
public static CompoundResultClassifier createCompoundResultClassifier(
                                                Patient sourcePatient) {
    return isRegisteredAtQueens(sourcePatient) ? QUEENS : STANDARD;
}

private static boolean isRegisteredAtQueens(Patient sourcePatient) {
    return sourcePatient.getDataWarehouse().equals(DataWarehouseTag.QHN);
}




                          Factory
Avoiding Duplicate Code
Commonality and Variability
Duplicate Code
Copy & Paste
Edit the Copy
                ☞ Duplicate Code
Duplicate Code

Avoid duplication by expressing
  commonality and variability
           explicitly.
All tests must pass       No code is duplicated




Code is self-explanatory   No superfluous parts exist
0   10   20   30   40   50   60   70   80
0   10   20   30   40   50   60   70   80
“The prime directive that was
unanimously agree upon by all
 present was that in the next
tens years Agile leaders must
Demand Technical Excellence.”

                Jeff Sutherland
“Failure to do that means
you are not an Agile leader.”


                Jeff Sutherland
Personal Action Plan
Reading
                                                                                        The Elements of Programming Style
                                                                                        Kernighan and Plauger


                                                                                        Prefactoring
                                                                                        Extreme Abstraction Extreme Separation Extreme Readability
                                                                                        Ken Pugh

          Pragmatic
            Programmers                       Agile in a Flash
                                                 Speed-Learning Agile
                                                Software Development
                                                                                        Agile in a Flash
                                                            Agile Cards for
                                                              Agile Teams               Speed-Learning Agile Development
                                                            Jeff Langr and
                                                              Tim Ottinger
                                                           edited by Susannah Pfalzer
                                                                                        Jeff Langr and Tim Ottinger
Prepared exclusively for Alistair McKinnell
Reading
Clean Code
A Handbook of Agile Software Craftsmanship
Robert C. Martin


Domain Driven Design
Tackling Complexity in the Heart of Software
Eric Evans


Implementation Patterns
Kent Beck
Reading
The Pragmatic Programmer: From Journeyman to Master
Andrew Hunt and Dave Thomas

Extreme Programming Explained: Embrace Change
Kent Beck and Cynthia Andres

Test Driven Development: By Example
Kent Beck

Object-Oriented Software Construction
Bertrand Meyer
Reading
Design Patterns: Elements of Reusable
Object-Oriented Software Erich Gamma,
Richard Helm, Ralph Johnson, and John Vlissides


Multi-Paradigm Design for C++
James O. Coplien



Lean Architecture: for Agile Software Development
James O. Coplien and Gertrud Bjørnvig
Photo Credits
http://www.flickr.com/photos/27558040@N00/4151899795/



http://www.flickr.com/photos/popilop/331357312/



http://www.flickr.com/photos/arlette/3260468/



http://www.flickr.com/photos/36829973@N04/3546657245/



http://www.flickr.com/photos/40838054@N00/7261734660/

Weitere ähnliche Inhalte

Was ist angesagt?

Real world DSL - making technical and business people speaking the same language
Real world DSL - making technical and business people speaking the same languageReal world DSL - making technical and business people speaking the same language
Real world DSL - making technical and business people speaking the same languageMario Fusco
 
Coding Standards & Best Practices for iOS/C#
Coding Standards & Best Practices for iOS/C#Coding Standards & Best Practices for iOS/C#
Coding Standards & Best Practices for iOS/C#Asim Rais Siddiqui
 
Groovy DSLs, from Beginner to Expert - Guillaume Laforge and Paul King - Spri...
Groovy DSLs, from Beginner to Expert - Guillaume Laforge and Paul King - Spri...Groovy DSLs, from Beginner to Expert - Guillaume Laforge and Paul King - Spri...
Groovy DSLs, from Beginner to Expert - Guillaume Laforge and Paul King - Spri...Guillaume Laforge
 
[2012 02 03]clean_code 4장
[2012 02 03]clean_code 4장[2012 02 03]clean_code 4장
[2012 02 03]clean_code 4장Jong Pil Won
 
Domain-Specific Languages
Domain-Specific LanguagesDomain-Specific Languages
Domain-Specific LanguagesJavier Canovas
 
Clean code - Agile Software Craftsmanship
Clean code - Agile Software CraftsmanshipClean code - Agile Software Craftsmanship
Clean code - Agile Software CraftsmanshipYukti Kaura
 
JavaScript Parser Infrastructure for Code Quality Analysis
JavaScript Parser Infrastructure for Code Quality AnalysisJavaScript Parser Infrastructure for Code Quality Analysis
JavaScript Parser Infrastructure for Code Quality AnalysisAriya Hidayat
 
The influence of identifiers on code quality
The influence of identifiers on code qualityThe influence of identifiers on code quality
The influence of identifiers on code qualityMichel Wermelinger
 
Breaking The Monotony
Breaking The MonotonyBreaking The Monotony
Breaking The MonotonyNaresh Jain
 
Introduction to Client-Side Javascript
Introduction to Client-Side JavascriptIntroduction to Client-Side Javascript
Introduction to Client-Side JavascriptJulie Iskander
 
What lies beneath the beautiful code?
What lies beneath the beautiful code?What lies beneath the beautiful code?
What lies beneath the beautiful code?Niranjan Sarade
 
Database Design E R 2009
Database Design E R 2009Database Design E R 2009
Database Design E R 2009Cathie101
 
01 sm3 xml_xp_02
01 sm3 xml_xp_0201 sm3 xml_xp_02
01 sm3 xml_xp_02Niit Care
 

Was ist angesagt? (16)

Real world DSL - making technical and business people speaking the same language
Real world DSL - making technical and business people speaking the same languageReal world DSL - making technical and business people speaking the same language
Real world DSL - making technical and business people speaking the same language
 
Coding standard
Coding standardCoding standard
Coding standard
 
Coding Standards & Best Practices for iOS/C#
Coding Standards & Best Practices for iOS/C#Coding Standards & Best Practices for iOS/C#
Coding Standards & Best Practices for iOS/C#
 
Groovy DSLs, from Beginner to Expert - Guillaume Laforge and Paul King - Spri...
Groovy DSLs, from Beginner to Expert - Guillaume Laforge and Paul King - Spri...Groovy DSLs, from Beginner to Expert - Guillaume Laforge and Paul King - Spri...
Groovy DSLs, from Beginner to Expert - Guillaume Laforge and Paul King - Spri...
 
[2012 02 03]clean_code 4장
[2012 02 03]clean_code 4장[2012 02 03]clean_code 4장
[2012 02 03]clean_code 4장
 
Domain-Specific Languages
Domain-Specific LanguagesDomain-Specific Languages
Domain-Specific Languages
 
Clean code - Agile Software Craftsmanship
Clean code - Agile Software CraftsmanshipClean code - Agile Software Craftsmanship
Clean code - Agile Software Craftsmanship
 
JavaScript Parser Infrastructure for Code Quality Analysis
JavaScript Parser Infrastructure for Code Quality AnalysisJavaScript Parser Infrastructure for Code Quality Analysis
JavaScript Parser Infrastructure for Code Quality Analysis
 
The influence of identifiers on code quality
The influence of identifiers on code qualityThe influence of identifiers on code quality
The influence of identifiers on code quality
 
Breaking The Monotony
Breaking The MonotonyBreaking The Monotony
Breaking The Monotony
 
Introduction to Client-Side Javascript
Introduction to Client-Side JavascriptIntroduction to Client-Side Javascript
Introduction to Client-Side Javascript
 
perl_objects
perl_objectsperl_objects
perl_objects
 
What lies beneath the beautiful code?
What lies beneath the beautiful code?What lies beneath the beautiful code?
What lies beneath the beautiful code?
 
Database Design E R 2009
Database Design E R 2009Database Design E R 2009
Database Design E R 2009
 
Structured Query Language
Structured Query LanguageStructured Query Language
Structured Query Language
 
01 sm3 xml_xp_02
01 sm3 xml_xp_0201 sm3 xml_xp_02
01 sm3 xml_xp_02
 

Ähnlich wie Agile 2012 Simple Design Applied

Dynamic Language Performance
Dynamic Language PerformanceDynamic Language Performance
Dynamic Language PerformanceKevin Hazzard
 
Programming in C [Module One]
Programming in C [Module One]Programming in C [Module One]
Programming in C [Module One]Abhishek Sinha
 
Android training in Nagpur
Android training in Nagpur Android training in Nagpur
Android training in Nagpur letsleadsand
 
Android classes-in-pune-syllabus
Android classes-in-pune-syllabusAndroid classes-in-pune-syllabus
Android classes-in-pune-syllabuscncandrwebworld
 
C:\Fakepath\Combating Software Entropy 2
C:\Fakepath\Combating Software Entropy 2C:\Fakepath\Combating Software Entropy 2
C:\Fakepath\Combating Software Entropy 2Hammad Rajjoub
 
C:\Fakepath\Combating Software Entropy 2
C:\Fakepath\Combating Software Entropy 2C:\Fakepath\Combating Software Entropy 2
C:\Fakepath\Combating Software Entropy 2Hammad Rajjoub
 
Evolving a Clean, Pragmatic Architecture at JBCNConf 2019
Evolving a Clean, Pragmatic Architecture at JBCNConf 2019Evolving a Clean, Pragmatic Architecture at JBCNConf 2019
Evolving a Clean, Pragmatic Architecture at JBCNConf 2019Victor Rentea
 
Euro python 2015 writing quality code
Euro python 2015   writing quality codeEuro python 2015   writing quality code
Euro python 2015 writing quality coderadek_j
 
Refactoring for Software Design Smells - Tech Talk
Refactoring for Software Design Smells - Tech TalkRefactoring for Software Design Smells - Tech Talk
Refactoring for Software Design Smells - Tech TalkCodeOps Technologies LLP
 
Refactoring for Software Design Smells - Tech Talk
Refactoring for Software Design Smells - Tech Talk Refactoring for Software Design Smells - Tech Talk
Refactoring for Software Design Smells - Tech Talk Ganesh Samarthyam
 
Building Services With gRPC, Docker and Go
Building Services With gRPC, Docker and GoBuilding Services With gRPC, Docker and Go
Building Services With gRPC, Docker and GoMartin Kess
 
Code Quality Practice and Tools
Code Quality Practice and ToolsCode Quality Practice and Tools
Code Quality Practice and ToolsBob Paulin
 
Programming Design Guidelines
Programming Design GuidelinesProgramming Design Guidelines
Programming Design Guidelinesintuitiv.de
 

Ähnlich wie Agile 2012 Simple Design Applied (20)

Clean Code
Clean CodeClean Code
Clean Code
 
Dynamic Language Performance
Dynamic Language PerformanceDynamic Language Performance
Dynamic Language Performance
 
Icpc11b.ppt
Icpc11b.pptIcpc11b.ppt
Icpc11b.ppt
 
Programming in C [Module One]
Programming in C [Module One]Programming in C [Module One]
Programming in C [Module One]
 
Clean code and code smells
Clean code and code smellsClean code and code smells
Clean code and code smells
 
Android training in Nagpur
Android training in Nagpur Android training in Nagpur
Android training in Nagpur
 
Android classes-in-pune-syllabus
Android classes-in-pune-syllabusAndroid classes-in-pune-syllabus
Android classes-in-pune-syllabus
 
Clean Code 2
Clean Code 2Clean Code 2
Clean Code 2
 
C:\Fakepath\Combating Software Entropy 2
C:\Fakepath\Combating Software Entropy 2C:\Fakepath\Combating Software Entropy 2
C:\Fakepath\Combating Software Entropy 2
 
C:\Fakepath\Combating Software Entropy 2
C:\Fakepath\Combating Software Entropy 2C:\Fakepath\Combating Software Entropy 2
C:\Fakepath\Combating Software Entropy 2
 
Evolving a Clean, Pragmatic Architecture at JBCNConf 2019
Evolving a Clean, Pragmatic Architecture at JBCNConf 2019Evolving a Clean, Pragmatic Architecture at JBCNConf 2019
Evolving a Clean, Pragmatic Architecture at JBCNConf 2019
 
Euro python 2015 writing quality code
Euro python 2015   writing quality codeEuro python 2015   writing quality code
Euro python 2015 writing quality code
 
Refactoring for Software Design Smells - Tech Talk
Refactoring for Software Design Smells - Tech TalkRefactoring for Software Design Smells - Tech Talk
Refactoring for Software Design Smells - Tech Talk
 
Refactoring for Software Design Smells - Tech Talk
Refactoring for Software Design Smells - Tech Talk Refactoring for Software Design Smells - Tech Talk
Refactoring for Software Design Smells - Tech Talk
 
Building Services With gRPC, Docker and Go
Building Services With gRPC, Docker and GoBuilding Services With gRPC, Docker and Go
Building Services With gRPC, Docker and Go
 
Headless Js Testing
Headless Js TestingHeadless Js Testing
Headless Js Testing
 
Clean code
Clean codeClean code
Clean code
 
Code Quality Practice and Tools
Code Quality Practice and ToolsCode Quality Practice and Tools
Code Quality Practice and Tools
 
BDD in my team: how we do it
BDD in my team: how we do itBDD in my team: how we do it
BDD in my team: how we do it
 
Programming Design Guidelines
Programming Design GuidelinesProgramming Design Guidelines
Programming Design Guidelines
 

Mehr von Declan Whelan

Technical debt is a systemic problem - not a personal failing
Technical debt is a systemic problem - not a personal failingTechnical debt is a systemic problem - not a personal failing
Technical debt is a systemic problem - not a personal failingDeclan Whelan
 
From Technical Debt to Technical Health
From Technical Debt to Technical HealthFrom Technical Debt to Technical Health
From Technical Debt to Technical HealthDeclan Whelan
 
effective agile adoption
effective agile adoptioneffective agile adoption
effective agile adoptionDeclan Whelan
 
Navigating Organizational Change
Navigating Organizational ChangeNavigating Organizational Change
Navigating Organizational ChangeDeclan Whelan
 
Domain Driven Design and Hexagonal Architecture with Rails
Domain Driven Design and Hexagonal Architecture with RailsDomain Driven Design and Hexagonal Architecture with Rails
Domain Driven Design and Hexagonal Architecture with RailsDeclan Whelan
 
Win Win Conversations
Win Win ConversationsWin Win Conversations
Win Win ConversationsDeclan Whelan
 
Releasing your teams energy through 'pull' conversations
Releasing your teams energy through 'pull' conversationsReleasing your teams energy through 'pull' conversations
Releasing your teams energy through 'pull' conversationsDeclan Whelan
 
Specification by Example
Specification by ExampleSpecification by Example
Specification by ExampleDeclan Whelan
 
Learning is Key to Agile Success: Agile Vancouver 2010
Learning is Key to Agile Success: Agile Vancouver 2010Learning is Key to Agile Success: Agile Vancouver 2010
Learning is Key to Agile Success: Agile Vancouver 2010Declan Whelan
 
Agile learning agile 2010
Agile learning agile 2010Agile learning agile 2010
Agile learning agile 2010Declan Whelan
 
Agile Learning (60 minute version)
Agile Learning (60 minute version)Agile Learning (60 minute version)
Agile Learning (60 minute version)Declan Whelan
 
Agile Learning from Agile 2009
Agile Learning from Agile 2009Agile Learning from Agile 2009
Agile Learning from Agile 2009Declan Whelan
 
Agile Testing: The Role Of The Agile Tester
Agile Testing: The Role Of The Agile TesterAgile Testing: The Role Of The Agile Tester
Agile Testing: The Role Of The Agile TesterDeclan Whelan
 

Mehr von Declan Whelan (17)

Technical debt is a systemic problem - not a personal failing
Technical debt is a systemic problem - not a personal failingTechnical debt is a systemic problem - not a personal failing
Technical debt is a systemic problem - not a personal failing
 
From Technical Debt to Technical Health
From Technical Debt to Technical HealthFrom Technical Debt to Technical Health
From Technical Debt to Technical Health
 
effective agile adoption
effective agile adoptioneffective agile adoption
effective agile adoption
 
Big Balls of Mud
Big Balls of MudBig Balls of Mud
Big Balls of Mud
 
Navigating Organizational Change
Navigating Organizational ChangeNavigating Organizational Change
Navigating Organizational Change
 
Domain Driven Design and Hexagonal Architecture with Rails
Domain Driven Design and Hexagonal Architecture with RailsDomain Driven Design and Hexagonal Architecture with Rails
Domain Driven Design and Hexagonal Architecture with Rails
 
Win Win Conversations
Win Win ConversationsWin Win Conversations
Win Win Conversations
 
Releasing your teams energy through 'pull' conversations
Releasing your teams energy through 'pull' conversationsReleasing your teams energy through 'pull' conversations
Releasing your teams energy through 'pull' conversations
 
Specification by Example
Specification by ExampleSpecification by Example
Specification by Example
 
Solid principles
Solid principlesSolid principles
Solid principles
 
Learning is Key to Agile Success: Agile Vancouver 2010
Learning is Key to Agile Success: Agile Vancouver 2010Learning is Key to Agile Success: Agile Vancouver 2010
Learning is Key to Agile Success: Agile Vancouver 2010
 
Agile learning agile 2010
Agile learning agile 2010Agile learning agile 2010
Agile learning agile 2010
 
Agile Learning (60 minute version)
Agile Learning (60 minute version)Agile Learning (60 minute version)
Agile Learning (60 minute version)
 
Cuke2Beer
Cuke2BeerCuke2Beer
Cuke2Beer
 
Agile Learning from Agile 2009
Agile Learning from Agile 2009Agile Learning from Agile 2009
Agile Learning from Agile 2009
 
Agile, Tdd And .Net
Agile, Tdd And .NetAgile, Tdd And .Net
Agile, Tdd And .Net
 
Agile Testing: The Role Of The Agile Tester
Agile Testing: The Role Of The Agile TesterAgile Testing: The Role Of The Agile Tester
Agile Testing: The Role Of The Agile Tester
 

Kürzlich hochgeladen

南新罕布什尔大学毕业证学位证成绩单-学历认证
南新罕布什尔大学毕业证学位证成绩单-学历认证南新罕布什尔大学毕业证学位证成绩单-学历认证
南新罕布什尔大学毕业证学位证成绩单-学历认证kbdhl05e
 
(No.1)↠Young Call Girls in Sikanderpur (Gurgaon) ꧁❤ 9711911712 ❤꧂ Escorts
(No.1)↠Young Call Girls in Sikanderpur (Gurgaon) ꧁❤ 9711911712 ❤꧂ Escorts(No.1)↠Young Call Girls in Sikanderpur (Gurgaon) ꧁❤ 9711911712 ❤꧂ Escorts
(No.1)↠Young Call Girls in Sikanderpur (Gurgaon) ꧁❤ 9711911712 ❤꧂ EscortsDelhi Escorts Service
 
Call Girls In Dwarka Sub City ☎️7838079806 ✅ 💯Call Girls In Delhi
Call Girls In Dwarka Sub City  ☎️7838079806 ✅ 💯Call Girls In DelhiCall Girls In Dwarka Sub City  ☎️7838079806 ✅ 💯Call Girls In Delhi
Call Girls In Dwarka Sub City ☎️7838079806 ✅ 💯Call Girls In DelhiSoniyaSingh
 
(南达科他州立大学毕业证学位证成绩单-永久存档)
(南达科他州立大学毕业证学位证成绩单-永久存档)(南达科他州立大学毕业证学位证成绩单-永久存档)
(南达科他州立大学毕业证学位证成绩单-永久存档)oannq
 
西伦敦大学毕业证学位证成绩单-怎么样做
西伦敦大学毕业证学位证成绩单-怎么样做西伦敦大学毕业证学位证成绩单-怎么样做
西伦敦大学毕业证学位证成绩单-怎么样做j5bzwet6
 
Authentic No 1 Amil Baba In Pakistan Amil Baba In Faisalabad Amil Baba In Kar...
Authentic No 1 Amil Baba In Pakistan Amil Baba In Faisalabad Amil Baba In Kar...Authentic No 1 Amil Baba In Pakistan Amil Baba In Faisalabad Amil Baba In Kar...
Authentic No 1 Amil Baba In Pakistan Amil Baba In Faisalabad Amil Baba In Kar...Authentic No 1 Amil Baba In Pakistan
 
E J Waggoner against Kellogg's Pantheism 8.pptx
E J Waggoner against Kellogg's Pantheism 8.pptxE J Waggoner against Kellogg's Pantheism 8.pptx
E J Waggoner against Kellogg's Pantheism 8.pptxJackieSparrow3
 
Inspiring Through Words Power of Inspiration.pptx
Inspiring Through Words Power of Inspiration.pptxInspiring Through Words Power of Inspiration.pptx
Inspiring Through Words Power of Inspiration.pptxShubham Rawat
 
Call Girls In Karkardooma 83770 87607 Just-Dial Escorts Service 24X7 Avilable
Call Girls In Karkardooma 83770 87607 Just-Dial Escorts Service 24X7 AvilableCall Girls In Karkardooma 83770 87607 Just-Dial Escorts Service 24X7 Avilable
Call Girls In Karkardooma 83770 87607 Just-Dial Escorts Service 24X7 Avilabledollysharma2066
 
Call Girls in Govindpuri Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Govindpuri Delhi 💯Call Us 🔝8264348440🔝Call Girls in Govindpuri Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Govindpuri Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
办理西悉尼大学毕业证成绩单、制作假文凭
办理西悉尼大学毕业证成绩单、制作假文凭办理西悉尼大学毕业证成绩单、制作假文凭
办理西悉尼大学毕业证成绩单、制作假文凭o8wvnojp
 

Kürzlich hochgeladen (12)

南新罕布什尔大学毕业证学位证成绩单-学历认证
南新罕布什尔大学毕业证学位证成绩单-学历认证南新罕布什尔大学毕业证学位证成绩单-学历认证
南新罕布什尔大学毕业证学位证成绩单-学历认证
 
(No.1)↠Young Call Girls in Sikanderpur (Gurgaon) ꧁❤ 9711911712 ❤꧂ Escorts
(No.1)↠Young Call Girls in Sikanderpur (Gurgaon) ꧁❤ 9711911712 ❤꧂ Escorts(No.1)↠Young Call Girls in Sikanderpur (Gurgaon) ꧁❤ 9711911712 ❤꧂ Escorts
(No.1)↠Young Call Girls in Sikanderpur (Gurgaon) ꧁❤ 9711911712 ❤꧂ Escorts
 
Call Girls In Dwarka Sub City ☎️7838079806 ✅ 💯Call Girls In Delhi
Call Girls In Dwarka Sub City  ☎️7838079806 ✅ 💯Call Girls In DelhiCall Girls In Dwarka Sub City  ☎️7838079806 ✅ 💯Call Girls In Delhi
Call Girls In Dwarka Sub City ☎️7838079806 ✅ 💯Call Girls In Delhi
 
(南达科他州立大学毕业证学位证成绩单-永久存档)
(南达科他州立大学毕业证学位证成绩单-永久存档)(南达科他州立大学毕业证学位证成绩单-永久存档)
(南达科他州立大学毕业证学位证成绩单-永久存档)
 
Model Call Girl in Lado Sarai Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Lado Sarai Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Lado Sarai Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Lado Sarai Delhi reach out to us at 🔝9953056974🔝
 
西伦敦大学毕业证学位证成绩单-怎么样做
西伦敦大学毕业证学位证成绩单-怎么样做西伦敦大学毕业证学位证成绩单-怎么样做
西伦敦大学毕业证学位证成绩单-怎么样做
 
Authentic No 1 Amil Baba In Pakistan Amil Baba In Faisalabad Amil Baba In Kar...
Authentic No 1 Amil Baba In Pakistan Amil Baba In Faisalabad Amil Baba In Kar...Authentic No 1 Amil Baba In Pakistan Amil Baba In Faisalabad Amil Baba In Kar...
Authentic No 1 Amil Baba In Pakistan Amil Baba In Faisalabad Amil Baba In Kar...
 
E J Waggoner against Kellogg's Pantheism 8.pptx
E J Waggoner against Kellogg's Pantheism 8.pptxE J Waggoner against Kellogg's Pantheism 8.pptx
E J Waggoner against Kellogg's Pantheism 8.pptx
 
Inspiring Through Words Power of Inspiration.pptx
Inspiring Through Words Power of Inspiration.pptxInspiring Through Words Power of Inspiration.pptx
Inspiring Through Words Power of Inspiration.pptx
 
Call Girls In Karkardooma 83770 87607 Just-Dial Escorts Service 24X7 Avilable
Call Girls In Karkardooma 83770 87607 Just-Dial Escorts Service 24X7 AvilableCall Girls In Karkardooma 83770 87607 Just-Dial Escorts Service 24X7 Avilable
Call Girls In Karkardooma 83770 87607 Just-Dial Escorts Service 24X7 Avilable
 
Call Girls in Govindpuri Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Govindpuri Delhi 💯Call Us 🔝8264348440🔝Call Girls in Govindpuri Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Govindpuri Delhi 💯Call Us 🔝8264348440🔝
 
办理西悉尼大学毕业证成绩单、制作假文凭
办理西悉尼大学毕业证成绩单、制作假文凭办理西悉尼大学毕业证成绩单、制作假文凭
办理西悉尼大学毕业证成绩单、制作假文凭
 

Agile 2012 Simple Design Applied

  • 1. Simple Design Applied Spend more time creating valuable code Alistair McKinnell Declan Whelan @mckinnell @dwhelan
  • 3. What is Simple Design? On an index card write up to three facts on an index card. Be ready to share with your table.
  • 4. What is Simple Design? At your table gather the facts and count how many distinct facts you came up with.
  • 7.
  • 9. Simple Design At your table order the rules of simple design in priority order.
  • 10. Simple Design 1. All tests must pass 2. No code is duplicated 3. Code is self-explanatory 4. No superfluous parts exist
  • 11.
  • 12. Simple Design 1. All tests must pass 2. No code is duplicated 3. Code is self-explanatory 4. No superfluous parts exist
  • 13. Simple Design 1. Passes its tests 2. No code is duplicated 3. Code is self-explanatory 4. No superfluous parts exist
  • 14. Simple Design 1. Passes its tests 2. Minimizes duplication 3. Code is self-explanatory 4. No superfluous parts exist
  • 15. Simple Design 1. Passes its tests 2. Minimizes duplication 3. Maximizes clarity 4. No superfluous parts exist
  • 16. Simple Design 1. Passes its tests 2. Minimizes duplication 3. Maximizes clarity 4. Has fewer elements
  • 17. Simple Design 1. Passes its tests (given TDD) 2. Minimizes duplication 3. Maximizes clarity 4. Has fewer elements
  • 18. Simple Design 1. Passes its tests (given TDD) 2. Minimizes duplication 3. Maximizes clarity (fix names) 4. Has fewer elements
  • 19. Simple Design 1. Passes its tests (given TDD) 2. Minimizes duplication 3. Maximizes clarity (fix names) 4. Has fewer elements
  • 20. That leaves me with two key elements of simple design: remove duplication and fix bad names. When I remove duplication, I tend to see an appropriate structure emerge, and when I fix bad names, I tend to see responsibilities slide into appropriate parts of the design. J. B. Rainsberger
  • 21. Simple Design • Remove duplication • Fix bad names
  • 22. Simple Design (for today) • Fix bad names ❤ Choosing good names • Remove duplication ❤ Commonality & Variability
  • 24. Stroop Effect Green Red Blue Purple Blue Purple Green Red Blue Purple Blue Purple Blue Purple Red Green Purple Green
  • 25. Meaning: Colour: black yellow
  • 26. Meaning: Colour: blue black
  • 44. CComBstr sVal $.getJSON() int result Rx rx applyMeasureConstraintToEnableSortingByMeasure() float hp applyPhq9DateRangeConstraint() public void run() Date genymdhms m_name Label label IShapeFactory Customer int i RollOverPerformanceIndicatorsToNextMonthTask CustomerManager LPSTR lpCmdLine int daysSinceModification boolean fNewPage UpdatePerfIndValueDecCountCmd DepressionSelfManagementCalculator Tutorial02 PerfIndValueDecCountForMatchingIvpCmd PulseRenderer IndexCardPageLayout sut
  • 45. CComBstr sVal $.getJSON() int result Rx rx applyMeasureConstraintToEnableSortingByMeasure() float hp applyPhq9DateRangeConstraint() public void run() Date genymdhms m_name Label label IShapeFactory Customer int i RollOverPerformanceIndicatorsToNextMonthTask CustomerManager LPSTR lpCmdLine int daysSinceModification boolean fNewPage UpdatePerfIndValueDecCountCmd DepressionSelfManagementCalculator Tutorial02 PerfIndValueDecCountForMatchingIvpCmd PulseRenderer IndexCardPageLayout sut
  • 46. Find a partner and each of you: 1. select a name you thought was good 2. explain why to your partner 3. select a name you thought was bad 4. explain why to your partner CComBstr sVal $.getJSON() int result Rx rx applyMeasureConstraintToEnableSortingByMeasure() float hp applyPhq9DateRangeConstraint() public void run() Date genymdhms m_name Label label IShapeFactory Customer int i RollOverPerformanceIndicatorsToNextMonthTask CustomerManager LPSTR lpCmdLine int daysSinceModification boolean fNewPage UpdatePerfIndValueDecCountCmd DepressionSelfManagementCalculator PerfIndValueDecCountForMatchingIvpCmd PulseRenderer IndexCardPageLayout sut
  • 48. Choosing Good Names Use the telephone test for readability. If someone could understand your code when read aloud over the telephone, it's clear enough. If not, then it needs rewriting.
  • 49. Telephone Test Goal Donor vs Gold Owner Date genymdhms
  • 50. Choosing Good Names Splitters can be lumped more easily than lumpers can be split. It is easier to combine two concepts that it is to separate them.
  • 51. Splitting a Lumper Customer Address
  • 52. Splitting a Lumper Customer Address Billing Address Mailing Address Service Address
  • 53. Lumping a Splitter Billing Address Mailing Address Service Address
  • 54. Lumping a Splitter Billing Address Mailing Address Service Address Customer Address
  • 55. Choosing Good Names Pronounceable Names Avoid Encodings
  • 60. Avoid Encodings LPSTR lpCmdLine LPSTR commandLine m_name name
  • 61. Choosing Good Names Intention-Revealing Name Role-Suggesting Name
  • 63. Intention-Revealing Name applyMeasureConstraintTo EnableSortingByMeasure() applyMeasureConstraint()
  • 65. Choosing Good Names Ubiquitous Language
  • 70. Ubiquitous Language applyPhq9DateRangeConstraint() The PHQ-9 is the nine item depression scale of the Patient Health Questionnaire. The PHQ-9 is a powerful tool for assisting primary care clinicians in diagnosing depression as well as selecting and monitoring treatment.
  • 71. Pragmatic Programmers Agile in a Flash Speed-Learning Agile Software Development Agile Cards for Agile Teams Jeff Langr and Tim Ottinger edited by Susannah Pfalzer Prepared exclusively for Alistair McKinnell Copyright ©2011 Pragmatic Programmers
  • 72. 43 Really Meaningful Names ® Are accurate ® Are purposeful ® Are pronounceable ® Begin well ® Are simple ® Depend on context ® Match name length to scope Prepared exclusively for Alistair McKinnell Copyright ©2011 Pragmatic Programmers
  • 73. Choosing Good Names •Locate one Naming'Guidelines System'of'Names S1# # Name#pass#the#“telephone”#test. S2# # There#is#a#clean#name#for#each#concept.#Remember:#later#on#it’s#easier#to#lump# guideline that if things#together#than#to#split#them#apart. S3# # Name#is#from#the#problem#or#solu?on#domain#and#support#ubiquitous#language#for# the#team General applied would have G1## Name#is#pronounceable. G2## Name#avoids#encodings#and#member#prefixes. G3## Name#suggest#why#it#exists. G4## Name#suggest#how#it#should#be#used. the biggest impact G5## Name#suggest#what#it#does. G6## Name#is#easily#searchable#in#the#code#base. Classes C1# If#this#is#an#important#base#class#its#class#name#should#be#a#simple#single#word. C2# C3# If#this#is#a#subclass#its#class#name#suggests#how#it#differs#from#its#superclass. The#class#name#is#a#noun#or#a#noun#phrase. on your code •Find a partner Methods M1# The#method#name#suggests#why#it#would#be#called. M2# The#method#is#name#a#verb#or#a#verb#phrase. Variables/Fields/Arguments •Discuss V1# Its#name#indicate#the#role#it's#playing. V2# The#length#of#the#name#reflect#its#scope. Alistair McKinnell @amckinnell Declan Whelan @dwhelan Naming Guidelines v1.0 August 2012 ! 1/1
  • 74. Choosing Good Names public List<int[]> getThem() { List<int[]> list1 = new ArrayList<int[]>(); for (int[] x : theList) if (x[0] == 4) list1.add(x); return list1; } Source: Clean Code: A Handbook of Agile Software Craftsmanship, Robert C. Martin, pages 18-19
  • 75. Choosing Good Names public List<int[]> getThem() { List<int[]> list1 = new ArrayList<int[]>(); for (int[] x : theList) if (x[0] == 4) list1.add(x); return list1; } public List<int[]> getFlaggedCells() { List<int[]> flaggedCells = new ArrayList<int[]>(); for (int[] cell : gameBoard) if (cell[STATUS_VALUE] == FLAGGED) flaggedCells.add(cell); return flaggedCells; } Source: Clean Code: A Handbook of Agile Software Craftsmanship, Robert C. Martin, pages 18-19
  • 76. Choosing Good Names public List<int[]> getThem() { List<int[]> list1 = new ArrayList<int[]>(); for (int[] x : theList) if (x[0] == 4) list1.add(x); return list1; } public List<Cell> getFlaggedCells() { List<Cell> flaggedCells = new ArrayList<Cell>(); for (Cell cell : gameBoard) if (cell.isFlagged()) flaggedCells.add(cell); return flaggedCells; } Source: Clean Code: A Handbook of Agile Software Craftsmanship, Robert C. Martin, pages 18-19
  • 77. Choosing Good Names public List<int[]> getThem() { List<int[]> list1 = new ArrayList<int[]>(); for (int[] x : theList) if (x[0] == 4) list1.add(x); return list1; } public List<Cell> getFlaggedCells() { List<Cell> result = new ArrayList<Cell>(); for (Cell cell : gameBoard) if (cell.isFlagged()) result.add(cell); return result; } Source: Clean Code: A Handbook of Agile Software Craftsmanship, Robert C. Martin, pages 18-19
  • 78. Choosing Good Names int s = 0; for (int j=0; j<34; j++) { s += (t[j]*4)/5; } const int EFFECTIVE_DAYS_PER_WEEK = 4; int realDaysPerIdealDay = 4; const int WORKING_DAYS_PER_WEEK = 5; const int WORK_DAYS_PER_WEEK = 5; int sum = 0; int effectiveTotalEstimate = 0; for (int j=0; j < NUMBER_OF_TASKS; j++) { for (int j=0; j < NUMBER_OF_TASKS; j++) {realDaysPerIdealDay; int realTaskDays = taskEstimate[j] * int effectiveTaskEstimate = int realTaskWeeks = (realdays / WORK_DAYS_PER_WEEK); taskEstimate[j] * EFFECTIVE_DAYS_PER_WEEK / WORKING_DAYS_PER_WEEK; sum += realTaskWeeks; effectiveTotalEstimate += effectiveTaskEstimate; } } Source: Clean Code: A Handbook of Agile Software Craftsmanship, Robert C. Martin, page 23
  • 79. What’s In A Name? Moonbeam Zappa
  • 80.
  • 81. All tests must pass No code is duplicated Code is self-explanatory No superfluous parts exist
  • 82. No code is duplicated
  • 84. How do you handle duplicate code in your codebase?
  • 85.
  • 86. Avoiding Duplicate Code DRY: Don’t Repeat Yourself Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
  • 87. Avoiding Duplicate Code Once and Only Once Data, structure, or logic should exist in only one place in the system.
  • 88. Avoiding Duplicate Code Test-Driven Development 1. Write new code only if an automated test has failed. 2. Eliminate duplication.
  • 89. Avoiding Duplicate Code Single Choice Principle Whenever a software system must support a set of alternatives, one and only one module in the system should know their exhaustive list.
  • 90. Avoiding Duplicate Code Duplication may be the root of all evil in software.
  • 91.
  • 96. function something() { } function somethingElse() { }
  • 97. function something() { } function somethingElse() { }
  • 98. Duplicate Code Copy & Paste Edit the Copy ☞ Duplicate Code
  • 99. Duplicate Code Avoid duplication by expressing commonality and variability explicitly.
  • 100. function something() { } function somethingElse() { }
  • 102. Can you spot the commonality and variation? Can you spot the duplicate code? How would you make the commonality and variation explicit?
  • 103.
  • 104. public static List<SelectOption> createEndMonthList(Date expiryDate) { int selectedMonth = getDateMonth(expiryDate); SelectOptionsSource months = new SelectOptionsSource(1, 12, selectedMonth); SelectOptions monthOptions = new SelectOptions(months); return monthOptions.create(); } public static List<SelectOption> createEndDaysList() { int selectedDay = getDateDay(getCurrentDatePlus14Days()); SelectOptionsSource days = new SelectOptionsSource(1, 31, selectedDay); SelectOptions dayOptions = new SelectOptions(days); return dayOptions.create(); } public static List<SelectOption> createEndYearList() { int selectedYear = getDateYear(getCurrentDatePlus14Days()); SelectOptionsSource years = new SelectOptionsSource(1985, 1985 + 30, selectedYear); SelectOptions yearOptions = new SelectOptions(years); return yearOptions.create(); }
  • 105. public static List<SelectOption> createEndMonthList(Date expiryDate) { int selectedMonth = getDateMonth(expiryDate); SelectOptionsSource months = new SelectOptionsSource(1, 12, selectedMonth); SelectOptions monthOptions = new SelectOptions(months); return monthOptions.create(); } public static List<SelectOption> createEndDaysList() { int selectedDay = getDateDay(getCurrentDatePlus14Days()); SelectOptionsSource days = new SelectOptionsSource(1, 31, selectedDay); SelectOptions dayOptions = new SelectOptions(days); return dayOptions.create(); } public static List<SelectOption> createEndYearList() { int selectedYear = getDateYear(getCurrentDatePlus14Days()); SelectOptionsSource years = new SelectOptionsSource(1985, 1985 + 30, selectedYear); SelectOptions yearOptions = new SelectOptions(years); return yearOptions.create(); }
  • 106. public static List<SelectOption> createEndMonthList(Date expiryDate) { int selectedMonth = getDateMonth(expiryDate); SelectOptionsSource months = new SelectOptionsSource(1, 12, selectedMonth); SelectOptions monthOptions = new SelectOptions(months); return monthOptions.create(); } public static List<SelectOption> createEndDaysList() { int selectedDay = getDateDay(getCurrentDatePlus14Days()); SelectOptionsSource days = new SelectOptionsSource(1, 31, selectedDay); SelectOptions dayOptions = new SelectOptions(days); return dayOptions.create(); } public static List<SelectOption> createEndYearList() { int selectedYear = getDateYear(getCurrentDatePlus14Days()); SelectOptionsSource years = new SelectOptionsSource(1985, 1985 + 30, selectedYear); SelectOptions yearOptions = new SelectOptions(years); return yearOptions.create(); }
  • 107. Select Options SelectOptions SelectOptionsSource create() getFirst() getLast() isSelected() Commonality Variability Resolution Encapsulate Behaviour Collaborator Collection
  • 108. Select Options SelectOptions SelectOptionsSource create() getFirst() getLast() isSelected() Commonality Variability Resolution Data Structure Value of State Simple Java Type
  • 109.
  • 110. Select Options SelectOptions SelectOptionsSource create() getFirst() getLast() isSelected() Encapsulate Collection
  • 111. Select Options SelectOptions SelectOptionsSource create() getFirst() getLast() isSelected() Parameter Object
  • 113. Can you spot the commonality and variation? Can you spot the duplicate code? How would you make the commonality and variation explicit?
  • 114. if ( ... ) { } else { }
  • 115. Compound Result Handler CompoundResultHandler CompoundResultClassifier isNegative() isPositive() AbstractCompoundResultClassifier toNumber() QueensCompoundResultClassifier StandardCompoundResultClassifier isNegative() isNegative() isPositive() isPositive()
  • 116. Compound Result Handler CompoundResultHandler CompoundResultClassifier isNegative() isPositive() AbstractCompoundResultClassifier toNumber() QueensCompoundResultClassifier StandardCompoundResultClassifier isNegative() isNegative() isPositive() isPositive()
  • 117. Compound Result Handler CompoundResultHandler CompoundResultClassifier isNegative() isPositive() AbstractCompoundResultClassifier toNumber() QueensCompoundResultClassifier StandardCompoundResultClassifier isNegative() isNegative() isPositive() isPositive() Commonality Variability Resolution Inheritance Behaviour Implementation (Object-Oriented)
  • 118. Compound Result Handler CompoundResultHandler CompoundResultClassifier isNegative() isPositive() AbstractCompoundResultClassifier toNumber() QueensCompoundResultClassifier StandardCompoundResultClassifier isNegative() isNegative() isPositive() isPositive() Commonality Variability Resolution Inheritance Behaviour Implementation (Object-Oriented)
  • 119. Compound Result Handler CompoundResultHandler CompoundResultClassifier isNegative() isPositive() AbstractCompoundResultClassifier toNumber() QueensCompoundResultClassifier StandardCompoundResultClassifier isNegative() isNegative() isPositive() isPositive() Commonality Variability Resolution Implementation None Base Class
  • 120. Compound Result Handler CompoundResultHandler CompoundResultClassifier isNegative() isPositive() AbstractCompoundResultClassifier toNumber() QueensCompoundResultClassifier StandardCompoundResultClassifier isNegative() isNegative() isPositive() isPositive() Commonality Variability Resolution Implementation None Base Class
  • 121. Compound Result Handler public static CompoundResultClassifier createCompoundResultClassifier( Patient sourcePatient) { return isRegisteredAtQueens(sourcePatient) ? QUEENS : STANDARD; } private static boolean isRegisteredAtQueens(Patient sourcePatient) { return sourcePatient.getDataWarehouse().equals(DataWarehouseTag.QHN); } Factory
  • 122.
  • 125. Duplicate Code Copy & Paste Edit the Copy ☞ Duplicate Code
  • 126. Duplicate Code Avoid duplication by expressing commonality and variability explicitly.
  • 127.
  • 128. All tests must pass No code is duplicated Code is self-explanatory No superfluous parts exist
  • 129. 0 10 20 30 40 50 60 70 80
  • 130. 0 10 20 30 40 50 60 70 80
  • 131. “The prime directive that was unanimously agree upon by all present was that in the next tens years Agile leaders must Demand Technical Excellence.” Jeff Sutherland
  • 132. “Failure to do that means you are not an Agile leader.” Jeff Sutherland
  • 134. Reading The Elements of Programming Style Kernighan and Plauger Prefactoring Extreme Abstraction Extreme Separation Extreme Readability Ken Pugh Pragmatic Programmers Agile in a Flash Speed-Learning Agile Software Development Agile in a Flash Agile Cards for Agile Teams Speed-Learning Agile Development Jeff Langr and Tim Ottinger edited by Susannah Pfalzer Jeff Langr and Tim Ottinger Prepared exclusively for Alistair McKinnell
  • 135. Reading Clean Code A Handbook of Agile Software Craftsmanship Robert C. Martin Domain Driven Design Tackling Complexity in the Heart of Software Eric Evans Implementation Patterns Kent Beck
  • 136. Reading The Pragmatic Programmer: From Journeyman to Master Andrew Hunt and Dave Thomas Extreme Programming Explained: Embrace Change Kent Beck and Cynthia Andres Test Driven Development: By Example Kent Beck Object-Oriented Software Construction Bertrand Meyer
  • 137. Reading Design Patterns: Elements of Reusable Object-Oriented Software Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides Multi-Paradigm Design for C++ James O. Coplien Lean Architecture: for Agile Software Development James O. Coplien and Gertrud Bjørnvig