SlideShare a Scribd company logo
1 of 60
Download to read offline
Agile Refactoring for Making
 Systems More Adaptable
        Joseph W. Yoder
        The Refactory, Inc.
           June 25, 2010
          joe@refactory.com
       http://www.refactory.com
The Refactory Principals
                            John Brant      Don Roberts
                            Brian Foote       Joe Yoder
                                   Ralph Johnson




                           Refactory Affiliates
                                           Joseph Bergin
                                           Fred Grossman
                                             Bill Opdyke
                                                                                                            Slide - 2
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Agile to the Rescue???
Individuals and interactions over processes and tools
Working software over comprehensive documentation
Customer collaboration over contract negotiation
Responding to change over following a plan

That is, while there is value in the items on
  the right, we value the items on the left more.

                                                    …From the Agile Manifesto
                                                                                                             Slide - 3
 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Agile Principles
 Scrum, TDD, Refactoring, Regular Feedback,
   Testing, More Eyes, …
 Good People! Face-To-Face conversation.
 Continuous attention to technical excellence!
 Motivated individuals with the environment
   and support they need. Retrospectives!
 Allow Requirements to Change! Encourage
   Software Evolution as needed!
                                                                                                            Slide - 4
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Agile Encourages Changes
Very Little Upfront Design!
Piecemeal Growth! Small Iterations!
Late changes to the requirements
   of the system!
Continuously Evolving the Architecture!

Adapting to Changes requires the code to
  change and Refactoring supports changes
  to the code in a “safe” way.
                                                                                                            Slide - 5
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Agile & Refactoring
 A key part of Agile is to allow things to
   change and adapt as dictated by
   business needs!
 To support these changes, Refactoring is
   encouraged by most Agile practitioners.
 Agile has helped Refactoring be accepted
   into the mainstream development
   process (even sometimes encouraged).
                                                                                                            Slide - 6
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Ground Breaking Work
    Before there was Agile…

    Started at the University Of Illinois

    Bill Opdyke & Don Roberts PHD Thesis
      with Professor Ralph Johnson

    Refactoring Browser by John Brant and
     Don Roberts (first commercial tool)
                                                                                                            Slide - 7
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Refactoring Definition
      Refactoring is the process of changing a
      software system in such a way that it
      does not alter the external behavior of
      the code, yet improves its internal
      structure…Martin Fowler, Refactoring
      Improving the Design of Existing Code;
      Addison Wesley , 1999

                                                                                                            Slide - 8
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
What is Refactoring
    Refactoring is a controlled technique for improving the
      design of an existing code base

    Small behavior-preserving transformations,
    • Each of might be "too small to be worth doing“
    • Cumulative effect of transformations is significant
    • Small steps help reduce the risk of introducing errors
    • Avoid having the system broken while you are
      carrying out the restructuring
    • Gradually refactor a system over a period of time

                                                                                                            Slide - 9
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
A Simple Refactoring
                                     Create Empty Class
                                                                                         Object




                   Object



                                                                                      NewAbstract




      Concrete1               Concrete2



                                                                             Concrete1               Concrete2




                                                                                                                 Slide - 10
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
A Complex Refactoring

                   Array
                                                                                            MatrixRep



                                                                   Matrix
                                                                       rep


                   Matrix



                                                                          SparseRep         ArrayRep        IdentityRep




                            Adapted from Don Roberts, The Refactory, Inc.                                     Slide - 11
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Refactoring Code Smells
    A code smell is a hint that something has gone wrong
      somewhere in your code. Use the smell to track
      down the problem. KentBeck (with inspiration from
      the nose of Massimo Arnoldi) seems to have coined
      the phrase in the "OnceAndOnlyOnce" page, where
      he also said that code "wants to be simple". Bad
      Smells in Code was an essay by KentBeck and
      MartinFowler, published as Chapter 3 of Refactoring
      Improving The Design Of ExistingCode.
                                          ----Wards Wiki


                                                                                                            Slide - 12
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Code Smells Review
       Duplicate Code, Long Method, Large Class,
       Long Parameter List, Divergent Change,
       Shotgun Surgery, Feature Envy, Data Clumps
       Primitive Obsession, Switch Statements
       Parallel Inheritance, Lazy Class
       Speculative Generality, Temporary Field
       Message Chains, Middle Man
       Inappropriate Intimacy, Incomplete Lib Classes
       Data Class, Refused Bequest, Comments
                                                                                                            Slide - 13
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Comments
         We are not against comments but…

         If you see large methods that have
         places where the code is commented,
         use Extract Method to pull that out to a
         comment


                                                                                                            Slide - 14
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Comments Example
              (Extract Method)
    void printOwing (double amount) {
       printBanner();
       //print details
       System.out.println (name: “ + _name);
       System.out.println (amount: “ + amount);
       …}

    void printOwing (double amount) {
       printBanner();
       printDetails();
        …}
    void printDetails (double amount) {
       System.out.println (name: “ + _name);
       System.out.println (amount: “ + amount);}                                                            Slide - 15
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Extract Method Mechanics
    Create a new method and name it after the intention of
      the code to extract.
    Copy the extracted code from the source to the new
      method.
    Scan the extracted code for references to any variables
      that are local to the source method.
    See whether any temps are used only within extracted
      code.
    Pass into target method as parameters local-scope
      variables that are read from the extracted code.
    Replace the extracted code in the source method.

                                                                                                            Slide - 16
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Remove Method with
 Method Object
 Class Order …
    double price() {
         double primaryBasePrice;
         double secondaryBasePrice;
         double tertiaryBasePrice;
         // long computation;
         …}

                              Order                                                 PriceCalculator
                              price()                                               primaryBasePrice
                                                    1                              secondaryBasePrice
                                                                                    tertiaryBasePrice

return new PriceCalculator(this).compute()                                                compute()

                                                                                                            Slide - 17
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Remove Method to
 Method Object Mechanics
         Create a new class named after method.
         Give the new class a final field for the object
         that hosted the original method.
         Give the new class a constructor for the original
         object and each parameter.
         Give the new class a compute method.
         Copy the body of original method to compute.
         Compile.
         Replace the old method with the one that
         creates the new object and calls compute.
                                                                                                            Slide - 18
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Agile & Testing
 Many Agile practices highly encourage
   Testing as one of their core practices.
 Processes like XP support developers
   writing many unit tests (XUnit ).
 Test Driven Development (TDD) is
   becoming highly accepted in Agile.
 Testing was a key principle of Refactoring
   before there was Agile!
                                                                                                            Slide - 19
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Prerequisites of Refactoring
         Since you are changing the code base,
         it is IMPORTANT to validate with tests.

         There are also a time to refactor and a
         time to wait.

         Need both Unit Testing and Integrated
         Tests for making sure nothing breaks

                                                                                                            Slide - 20
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Deciding Whether A
 Refactoring is Safe
       "A refactoring shouldn't break a program.”
            What does this mean?
       A safe refactoring is behavior preserving.
       It is important not to violate:
            naming/ scoping rules.
            type rules.
       "The program should perform the same
       after a refactoring as before.”
       Satisfying timing constraints.
                                                                                                            Slide - 21
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Using Standard Tools
         To be safe, must have tests
         Should pass the tests before
         and after refactoring
              Commercial Testing Tools
              Kent Beck’s Testing Framework
                (SUnit, JUnit, Nunit, …)
         Take small steps, testing between each
         Java and C# tools are getting better

                                                                                                            Slide - 22
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Catalogue of Refactorings
         Composing Method
         Moving Features
         Organize Data
         Simplifying Conditionals
         Simpler Method Calls
         Generalization

                                   From Fowlers Book
                                                                                                            Slide - 23
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Refactoring and
 Design Patterns (1)

What varies                                              Design Pattern
Algorithms                                               Strategy, Visitor
Actions                                                  Command
Implementations                                          Bridge
Response to change                                       Observer



                                                                                                            Slide - 24
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Refactoring and
 Design Patterns (2)
What varies                                                      Design Pattern
Interactions between objects                                     Mediator
                                                                 Factory Method, Abstract
Object being created                                             Factory, Prototype
Structure being created                                          Builder
Traversal Algorithm                                              Iterator
Object interfaces                                                Adapter
Object behavior                                                  Decorator, State
                                                                                                            Slide - 25
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Refactoring Summary
         We have seen the mechanics for
         some of the Refactorings.

         When you find smelly code, you often
         apply Refactorings to clean your code.

         Refactorings do often apply
         Design Patterns.
                                                                                                            Slide - 26
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Building a System to Change
  Sometimes it pays off to build a system that
    can respond quickly to change!




                                                                                                            Slide - 27
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Allowing Systems to Adapt
         Requirements change within
             application’s domain.
         Domain Experts know their domain best.
         Business Rules are changing rapidly.
         Applications have to quickly adapt to
             new business requirements.
         Agile Development Welcomes Changes to the
         Requirements, even late in the development!
         One way to Adapt is to just Refactor to new
         business requirements…though sometimes…
                                                                                                            Slide - 28
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Forces – Shearing Layers

      Who (Business Person, Analyst, Developer)
      What (Business Rule, Persistence Layer,…)
      When (How often, How fast)

 There is a different rate of change
  on the system.
              Foote & Yoder - Ball of Mud PLoPD4
                                                                                                            Slide - 29
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Newborn Screening
  Refactoring Example


                 Doctor, HealthProf.
                                                                                   Hospital, Lab




                                                                           Blood Specimen
                                 Mother, Infant

                                                                                                            Slide - 30
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Medical Observation –
       Basic OO Design Model
                  Person                          *   Observation



                               Measurement                                      Trait
    Quantity
                                                                          traitValue
 unit                        convertTo:
 amount
 expressOnUnit:
expressOnUnits:

                  PhysicalMeasure            Blood
                                                                    EyeColor            HairColor             Gender       …



       Height              Weight                                              FeedingType          Hearing            Vision
                                              …




    What happens when a new observation is required?
                                                                                                                       Slide - 31
      Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Observation Design
       (1st Design)
                              Person                                 Observation
                                                                                                          ObservationType
                                               1              * -recordedDate : Date      *         1
                        +address()                               -observedDate : Date                   -phenomenon : Symbol
                        +phone()                                 -duration : TimePeriod
                        +name()                                  +phenomenon()




                 Quantity
                                                         Measurement                   Trait
                                               1   1
-unit : Unit
-amount : Number
+expressOnUnit(aUnit : Unit)                           +observationValue()    +observationValue()
+expressOnUnits(unitCollection : Collection)




                                                                                                                        Slide - 32
    Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Observation Design
  Example



                                                                     Height: 3      feet

                                                                     Eyes Color: Blue
                         Name: John Smith
                         Mother: Sue Smith
                         Father:
                         Address:
                         Phone:




                                                                                                            Slide - 33
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Observation Design
  (instance diagram)
 aPerson
 name <John Smith>
obsCollection

                                                                                          anObservationType
                                               aMeasurement
                                                                                          #height
                                               type
                                               value

                                                                                          aQuantity
                                                                                          value <3>
                                                                                          unit <ft>


             aTrait
             type                                             anObservationType
             value <blue>                                     #eyeColor




                                                                                                            Slide - 34
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Composing Observations
  Observations can be more complex
       Cholesterol
            Components: HDL, LDL
       Blood Pressure
            Components: Systolic, Diastolic
       Vision
            Components: Left Eye, Right Eye
                                                                                                            Slide - 35
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Composite Observation Design
(1st Refactoring)
                                                                                         Person



                                                                                   +address()
                                                                                   +phone()
                                                                                   +name()



                                                                                      Observation
                                       ObservationType
                                                                                  -recordedDate : Date
                                     -phenomenon : Symbol                         -observedDate : Date     1..n
                                                                                  -duration : TimePeriod
                                                                                  +phenomenon()




                 Quantity
                                                              Measurement                 Trait             CompositeObservation
-unit : Unit
-amount : Number                                                                                            -observations : Collection
+expressOnUnit(aUnit : Unit)                                +observationValue()    +observationValue()
+expressOnUnits(unitCollection : Collection)



                                                    Composite Pattern (GOF)
                                                     Make sure all tests still pass!                                                     Slide - 36
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Observation Design
  Example



                                                                    Height: 3     feet

                                                                    Eyes Color: Blue
                  Name: John Smith
                  Mother: Sue Smith                                 Blood Pressure:
                  Father:                                            Systolic: 120 mmHg
                  Address:                                           Diastolic: 80 mmHg
                  Phone:




                                                                                                            Slide - 37
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Composite Observation Design
(instance diagram)
                                        anObservType
                                       <#BloodPressure>
       aCompObs




                                           aMeasurement                               anObserType
                                           <120 mmHg>                                <#SYSTOLIC>




              anotherMeasurement                                            anObser-Type
                  <80 mmHg>                                                <#DIASTOLIC>



                                                                                                            Slide - 38
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Composite and Primitive
   Observation Design
   What we know about John?
                         aPerson
                         name <John Smith>
                        obsCollection




         EyesColor: Blue                  Height: 3 feet                      BloodPressure: 120/80

                                                                                   Systolic: 120 mmHg

                                                                                   Diastolic: 80 mmHg




                                                                                                            Slide - 39
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Validating Observations

     Each Observation has its own set
     of legal values.
          Baby’s Weight: [0 30] pounds
          HepatitisB: {positive, negative}
          Left/Right Vision: {normal, abnormal}
     GUI can enforce legal values
          but we want business rules in domain
           objects

                                                                                                            Slide - 40
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Validating Observations Design
 (2nd Refactoring)
        ObservationType
                                                            Validator

      -phenomenon : Symbol
      -validator : Validator




                            DiscreteValidator             NullValidator            RangedValidator

                        -descriptorSet : Collection                              -intervalSet : Collection
                                                                                 -validUnit : Unit




                                                                                                             Slide - 41
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Overall Observation Design
                                                                                Validator




                                                            DiscreteValidator                RangedValidator   NullValidator
                                                  Party     descriptorSet                   intervalSet
                                                                                            validUnit

                                              Observation
      ObservationType                      recordedDate
      type                                 comments


             Measurement                  Trait              CompositeObservation
           value                 value                       values
           value                 value
           value:                value:
           convertTo:

Quantity
                            First make sure original test cases pass and
                            then add new test cases for the validators!
Is everything an Observation?
How does the model specify the structure of the Composite?
What is the relationship between Trait and DiscreteValidator?
                                                                                                                           Slide - 42
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Observation Design
                                                                                                 Validator
                                                                                             validatorName
                 ObservationType                                                             isValid: obsValue
                phenomenonType
                isValid: obsValue
                                                          DiscreteValidator        RangedValidator         NullValidator
                                                          descriptorSet           intervalSet
                                                                                  validUnit
  PrimitiveObservation      CompositeObservation
          Type                     Type                      Party

                                                           Observation
                                                        recordedDate
                                                        comments
                                                        isValid
                                                                                                          Quantity
                                                                                                     unit
                                          CompositeObservation       Primitive Observation           quantity
                                                                     observationValue                convertTo:

                                                                                                     DiscreteValues

 Extend the Design by adding Composite to Type
   -- Refactor the Metadata
                                                                                                                      Slide - 43
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Observation Design
                                                                                                     Validator
                                                                                                 validatorName
                 ObservationType                                                                 isValid: obsValue
                phenomenonType
                isValid: obsValue
                                                             DiscreteValidator         RangedValidator         NullValidator
                                                             descriptorSet            intervalSet
                                                                                      validUnit
  PrimitiveObservation      CompositeObservation
          Type                     Type                          Party

                                                               Observation
                                                            recordedDate
                                                            comments
                                                            isValid
                                                                                                              Quantity
                                                                                                         unit
                                          CompositeObservation           Primitive Observation           quantity
                                                                         observationValue                convertTo:

                                        Operational level                                                DiscreteValues

 Extend the Design by adding Composite to Type
   -- Refactor the Metadata
                                                                                                                          Slide - 44
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Observation Design
                                                                                                     Validator
                                                                                                 validatorName
                 ObservationType               Knowledge level                                   isValid: obsValue
                phenomenonType
                isValid: obsValue
                                                          DiscreteValidator            RangedValidator         NullValidator
                                                          descriptorSet               intervalSet
                                                                                      validUnit
  PrimitiveObservation      CompositeObservation
          Type                     Type                          Party

                                                            Observation
                                                         recordedDate
                                                         comments
                                                         isValid
                                                                                                              Quantity
                                                                                                         unit
                                          CompositeObservation           Primitive Observation           quantity
                                                                         observationValue                convertTo:

                                                                                                         DiscreteValues

 Extend the Design by adding Composite to Type
   -- Refactor the Metadata
                                                                                                                          Slide - 45
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Observation Design
   (instance diagram)

                           anObserv-Type
                          <#COMP-GAL>
aCompObs




                             aMeasurement                       anObser-Type                       aRangedValidator
                              <aQuantity>                         <#GAL>




    anotherMeasurement                                   anObser-Type                        anotherRangedValidator
     <anotherQuantity>                                     <#UDT>




                                                                                                             Slide - 46
 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Observation Design
  (instance diagram)
   anInfant
   name                                                                                                               aDiscreteValidator
   obsCollection
                                                                                        anObservationType             aRangedValidator
                                                                                        #GestationalAge
                                                          aMeasurement
                                                          type
                                                          value

                                                                                        aQuantity
                                                                                        value <36>
                                                                                        unit <weeks>
                                       anObserv-Type
                                      <#COMP-GAL>
                   aCompObs

                                                                                                   aRangedValidator
                                           aMeasurement                  anObser-Type
                                            <aQuantity>                    <#GAL>



                                                                                             anotherRangedValidator
                      anotherMeasurement                         anObser-Type
                       <anotherQuantity>                           <#UDT>




                                                                                                                                    Slide - 47
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Observations: TypeObject

                ObservationType                                                                TypeObject
               phenomenonType 1 descriptor                   1..*        Observation
               isValid: obsValue                             instance recordedDate
                                 1..* elements                        comments
                                                       elements 1..* isValid
                                                                                                                           Quantity
PrimitiveObservation       CompositeObservation                                                                       unit
        Type                      Type                                                                  value    1..* quantity
                                                       CompositeObservation     Primitive Observation
                                                                                observationValue                      convertTo:

 Knowledge level                                                                                                        DiscreteValues
                                                                                                        dvalue   1..*
 Operational level




                                                                                                                          Slide - 48
        Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Observations: Properties
                                               Party



                                                properties
                                                1..*
                               1..*        Observation
                               instance recordedDate
                                        comments
                         elements 1..* isValid
                                                                                                        Quantity
                                                                                                    unit
                                                                                     value     1..* quantity
                          CompositeObservation      Primitive Observation
                                                    observationValue                                convertTo:
 Knowledge level
                                                                                      dvalue   1..*   DiscreteValues
 Operational level




                                                                                                                 Slide - 49
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Observations: TypeSquare
                                              contDescr 1
                ObservationType 1..* varType                PartyType
               phenomenonType                                     1 descriptor
               isValid: obsValue 1 descriptor                1..*
                                 1..* elements
                                                                Party

PrimitiveObservation       CompositeObservation
        Type                      Type                           properties
                                                                 1..*
                                                1..*        Observation
                                                instance recordedDate
                                                         comments
                                          elements 1..* isValid
                                                                                                                  Quantity
                                                                                                             unit
                                                                                                value   1..* quantity
                                           CompositeObservation         Primitive Observation
                                                                        observationValue                     convertTo:
 Knowledge level

 Operational level                                                                              dvalue 1..*    DiscreteValues




                                                                                                                        Slide - 50
  Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Observations: Strategy

                                    1..* type
                 ObservationType                                                                 Validator
                phenomenonType                                                     guard 1
                                                                                             validatorName
                isValid: obsValue                                                            isValid: obsValue
                                    1..* elements


 PrimitiveObservation       CompositeObservation            DiscreteValidator     RangedValidator           NullValidator
         Type                      Type                     descriptorSet        intervalSet
                                                                                 validUnit

   Knowledge level
   Operational level




                                                                                                                  Slide - 51
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Medical Observations Design
                        1..* type          contDescr 1
                                                                 Entities                                guard 1
                                                                                                                          Validator
                                                                                                                     validatorName
                ObservationType 1..* varType                PartyType                                                isValid: obsValue
               phenomenonType                                     1 descriptor
               isValid: obsValue 1 descriptor                1..*
                                 1..* elements
                                                                Party              DiscreteValidator     RangedValidator            NullValidator
                                                                                   descriptorSet        intervalSet
PrimitiveObservation      CompositeObservation                                                          validUnit
        Type                     Type                            properties
                                                                 1..*
                                                1..*        Observation
                                                                                                          Behavior
                                                instance recordedDate
                                                         comments
                                          elements 1..* isValid
                                                                                                                         Quantity
                                                                                                                    unit
                                                                                                       value   1..* quantity
                                          CompositeObservation          Primitive Observation
                                                                        observationValue                            convertTo:
 Knowledge level

 Operational level                                                                                     dvalue 1..*     DiscreteValues

                                                          Attributes


                                                                                                                                         Slide - 52
        Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Strategies/Interpreters/RuleObjects
          (Behavior/Methods)
                                SomeStrategy                                                Entity
                                                                               1
                                                         *
                          -sharedAttributes : someType                             -specificAttribues : type
                          +sharedInterface()             *                         +someOperations()




                                                                                                               RuleObject
Strategy1                 Strategy2
                                                 ...         StragegyN
                                                                                                                            *
                                                                         1




                                                                                                                                                1

            Strategy2.1                  Strategy2.2                         PrimitiveRule                                      CompositeRule




                                                                                                          ANDCondition           ORCondition        NOTCondition




                                              Design Patterns - GOF95
                           Composite Strategies  Interpreter                                                                                       Slide - 53
   Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Composite Strategies

              Problem: Strategy leads to a big
                class hierarchy, one class for
                each kind of policy.

              Solution: Make Composite
                Strategies using Primitive
                Operations.

              => Interpreter pattern
                                                                                                            Slide - 54
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Adaptive Object Model
“Common Architecture”
           -children       *                                    *         -children

              Accountability       -type
                                               1
                                                       AccountabilityType
                                                                                       Classes with
       1
                                                                                      Attributes and
                                   1           1                                      Relationships
                       1       -accountabilities                    1       -accountabilitieTypes
                                                                                                                              Behavior
           -children   **                          -children        * *
                                                                                                -rules                          *
                   Entity          -type                  EntityType                                             Rule

        1                                          1                             1
                                   1               1                                                         +valueUsing:()

                           1                               1            -attributeTypes

        -attributes        *                                *
                                   *               1
                                                                                                    *
                 Attribute                              AttributeType                        Constant                         CompositeRule
                                                        +name                              +value
                                   -type                +type                    1     *                                                      1
               +valueUsing:()



                                                                    *


            Operational                                  Knowledge (meta)                                       TableLookup           BinaryOperation

                                                                                                         *

                                                                                                                                                        Slide - 55
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Process for Developing
 Adaptable Systems
         Developed Iteratively and Incrementally.
              Be Agile, Scrum, XP, Retrospective
         Get Customer Feedback early and often.
              User Scenarios – User Stories…
         Add flexibility only when and where needed.
         Provide Test Cases and Suites for both the
         Object-Model and the Meta-Model.
         Develop Support Tools and Editors for
         manipulating the metadata.
                      Very similar to Evolving Frameworks
                      by Roberts and Johnson PLoPD3
                                                                                                            Slide - 56
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Refactoring Addresses Some
 Key Leverage Points
Refactoring is a technique that works with Brooks’
“promising attacks” (from “No Silver Bullet”):
     buy rather than build: restructuring interfaces to support
      commercial SW
     grow don’t build software: software growth involves
      restructuring (isn’t this core to Agile???)
     requirements refinements and rapid prototyping:
      refactoring supports such design exploration, and
      adapting to changing customer needs
     support great designers: a tool in a designer’s tool chest.

                                                                                                            Slide - 57
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
Papers and Web Sites
      Bill Opdyke’s Thesis
      Don Robert’s Thesis
           http://st-www.cs.illinois.edu/users/droberts/thesis.pdf
      Refactoring Browser
           http://st-www.cs.illinois.edu/users/brant/Refactory
      Evolving Frameworks
           http://st-www.cs.uiuc.edu/users/droberts/evolve.html
      Extreme Programming
           http://www.c2.com/cgi-bin/wiki?ExtremeProgramming

                                                                                                            Slide - 58
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
More Web Sites
         Wiki wiki web
              http://c2.com/cgi/wiki?WikiPagesAboutRefactoring

         The Refactory, Inc.
              http://www.refactory.com

         Martin Fowler’s Refactoring Pages
              http://www.refactoring.com/

         Adaptive Object Models
              http://www.adaptiveobjectmodel.com/


                                                                                                            Slide - 59
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
That’s All




                                                                                                            Slide - 60
Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.

More Related Content

What's hot

The WHY behind TDD/BDD and the HOW with RSpec
The WHY behind TDD/BDD and the HOW with RSpecThe WHY behind TDD/BDD and the HOW with RSpec
The WHY behind TDD/BDD and the HOW with RSpecBen Mabey
 
Software testing agile_environment_wp
Software testing agile_environment_wpSoftware testing agile_environment_wp
Software testing agile_environment_wpCristiano Caetano
 
Postdoc Symposium - Abram Hindle
Postdoc Symposium - Abram HindlePostdoc Symposium - Abram Hindle
Postdoc Symposium - Abram HindleICSM 2011
 
Acceptance testfurureinmind
Acceptance testfurureinmindAcceptance testfurureinmind
Acceptance testfurureinmindLeanDog
 
Chapter 1 ASE Slides ppt
Chapter 1 ASE Slides pptChapter 1 ASE Slides ppt
Chapter 1 ASE Slides pptMr SMAK
 
Agile Software Design
Agile Software DesignAgile Software Design
Agile Software Designeduardomg23
 
Expert Recommendation with Usage Expertise
Expert Recommendation with Usage ExpertiseExpert Recommendation with Usage Expertise
Expert Recommendation with Usage Expertisedavema
 
Lean in Software Development
Lean in Software DevelopmentLean in Software Development
Lean in Software DevelopmentAslam Khan
 
Pair Programming, TDD and other impractical things
Pair Programming, TDD and other impractical thingsPair Programming, TDD and other impractical things
Pair Programming, TDD and other impractical thingsMarcello Duarte
 
Getting started with Agile
Getting started with AgileGetting started with Agile
Getting started with Agilekutuma
 
Managing Software Debt in Practice 2011
Managing Software Debt in Practice 2011Managing Software Debt in Practice 2011
Managing Software Debt in Practice 2011Chris Sterling
 
Michael Bolton - Two futures of software testing - Sept 2010
Michael Bolton - Two futures of software testing - Sept 2010Michael Bolton - Two futures of software testing - Sept 2010
Michael Bolton - Two futures of software testing - Sept 2010David O'Dowd
 
Pair Programming
Pair ProgrammingPair Programming
Pair ProgrammingNaresh Jain
 

What's hot (18)

The WHY behind TDD/BDD and the HOW with RSpec
The WHY behind TDD/BDD and the HOW with RSpecThe WHY behind TDD/BDD and the HOW with RSpec
The WHY behind TDD/BDD and the HOW with RSpec
 
Software testing agile_environment_wp
Software testing agile_environment_wpSoftware testing agile_environment_wp
Software testing agile_environment_wp
 
BBOM-AgilePT-2010
BBOM-AgilePT-2010BBOM-AgilePT-2010
BBOM-AgilePT-2010
 
Postdoc Symposium - Abram Hindle
Postdoc Symposium - Abram HindlePostdoc Symposium - Abram Hindle
Postdoc Symposium - Abram Hindle
 
Real Developers Don't Need Unit Tests
Real Developers Don't Need Unit TestsReal Developers Don't Need Unit Tests
Real Developers Don't Need Unit Tests
 
Acceptance testfurureinmind
Acceptance testfurureinmindAcceptance testfurureinmind
Acceptance testfurureinmind
 
Chapter 1 ASE Slides ppt
Chapter 1 ASE Slides pptChapter 1 ASE Slides ppt
Chapter 1 ASE Slides ppt
 
Agile Software Design
Agile Software DesignAgile Software Design
Agile Software Design
 
Expert Recommendation with Usage Expertise
Expert Recommendation with Usage ExpertiseExpert Recommendation with Usage Expertise
Expert Recommendation with Usage Expertise
 
Oxente BDD
Oxente BDDOxente BDD
Oxente BDD
 
Lean in Software Development
Lean in Software DevelopmentLean in Software Development
Lean in Software Development
 
Pair Programming, TDD and other impractical things
Pair Programming, TDD and other impractical thingsPair Programming, TDD and other impractical things
Pair Programming, TDD and other impractical things
 
Getting started with Agile
Getting started with AgileGetting started with Agile
Getting started with Agile
 
Agile Testing Overview
Agile Testing OverviewAgile Testing Overview
Agile Testing Overview
 
Managing Software Debt in Practice 2011
Managing Software Debt in Practice 2011Managing Software Debt in Practice 2011
Managing Software Debt in Practice 2011
 
AGILEEE Friday 17:15 Talk
AGILEEE Friday 17:15 TalkAGILEEE Friday 17:15 Talk
AGILEEE Friday 17:15 Talk
 
Michael Bolton - Two futures of software testing - Sept 2010
Michael Bolton - Two futures of software testing - Sept 2010Michael Bolton - Two futures of software testing - Sept 2010
Michael Bolton - Two futures of software testing - Sept 2010
 
Pair Programming
Pair ProgrammingPair Programming
Pair Programming
 

Viewers also liked

Websig 1Day School 20110910
Websig 1Day School 20110910Websig 1Day School 20110910
Websig 1Day School 20110910Keisuke Anzai
 
20140306 Markezine Day Spring
20140306 Markezine Day Spring20140306 Markezine Day Spring
20140306 Markezine Day SpringKeisuke Anzai
 
解析データの分析と活用
解析データの分析と活用解析データの分析と活用
解析データの分析と活用Keisuke Anzai
 
20141216 最適化を進化させるテスト設計とターゲティング ターゲティング編(抜粋)
20141216 最適化を進化させるテスト設計とターゲティング ターゲティング編(抜粋)20141216 最適化を進化させるテスト設計とターゲティング ターゲティング編(抜粋)
20141216 最適化を進化させるテスト設計とターゲティング ターゲティング編(抜粋)Keisuke Anzai
 
Clipping de imprensa 2016 tv
Clipping de imprensa 2016  tvClipping de imprensa 2016  tv
Clipping de imprensa 2016 tvBrasil Game Show
 
Testing System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph Yoder
Testing System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph YoderTesting System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph Yoder
Testing System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph YoderJoseph Yoder
 
Taming Big Balls of Mud with Diligence, Agile Practices, and Hard Work
Taming Big Balls of Mud with Diligence, Agile Practices, and Hard WorkTaming Big Balls of Mud with Diligence, Agile Practices, and Hard Work
Taming Big Balls of Mud with Diligence, Agile Practices, and Hard WorkJoseph Yoder
 
Adobe Summit 2014 Quick Wrap-up
Adobe Summit 2014 Quick Wrap-upAdobe Summit 2014 Quick Wrap-up
Adobe Summit 2014 Quick Wrap-upKeisuke Anzai
 
20150610 3つのPで実現される「喜ばれるエクスペリエンス」とは(抜粋)
20150610 3つのPで実現される「喜ばれるエクスペリエンス」とは(抜粋)20150610 3つのPで実現される「喜ばれるエクスペリエンス」とは(抜粋)
20150610 3つのPで実現される「喜ばれるエクスペリエンス」とは(抜粋)Keisuke Anzai
 
Summit 2016 Wrap-up for eVar7
Summit 2016 Wrap-up for eVar7Summit 2016 Wrap-up for eVar7
Summit 2016 Wrap-up for eVar7Keisuke Anzai
 
Milk procurement , rural retail & agribusiness[1]
Milk procurement , rural retail & agribusiness[1]Milk procurement , rural retail & agribusiness[1]
Milk procurement , rural retail & agribusiness[1]Ganesh Singh
 
Historieta
HistorietaHistorieta
Historietajaninatd
 
Summit 2016 wrap up hands out
Summit 2016 wrap up hands outSummit 2016 wrap up hands out
Summit 2016 wrap up hands outKeisuke Anzai
 
Агентство Недвижимости "Тандем Риэлт"
Агентство Недвижимости "Тандем Риэлт"Агентство Недвижимости "Тандем Риэлт"
Агентство Недвижимости "Тандем Риэлт"Tandem-Rielt
 
今、顧客体験を向上させるために取り組むべきこと ~Experience Business時代を迎えて~
今、顧客体験を向上させるために取り組むべきこと ~Experience Business時代を迎えて~今、顧客体験を向上させるために取り組むべきこと ~Experience Business時代を迎えて~
今、顧客体験を向上させるために取り組むべきこと ~Experience Business時代を迎えて~Keisuke Anzai
 
20140415 アドタイデイズ 安西パート
20140415 アドタイデイズ 安西パート20140415 アドタイデイズ 安西パート
20140415 アドタイデイズ 安西パートKeisuke Anzai
 
Being a Successful User-Centred Product Manager
Being a Successful User-Centred Product ManagerBeing a Successful User-Centred Product Manager
Being a Successful User-Centred Product ManagerAndrew Mayfield
 

Viewers also liked (20)

Websig 1Day School 20110910
Websig 1Day School 20110910Websig 1Day School 20110910
Websig 1Day School 20110910
 
20140306 Markezine Day Spring
20140306 Markezine Day Spring20140306 Markezine Day Spring
20140306 Markezine Day Spring
 
解析データの分析と活用
解析データの分析と活用解析データの分析と活用
解析データの分析と活用
 
20141216 最適化を進化させるテスト設計とターゲティング ターゲティング編(抜粋)
20141216 最適化を進化させるテスト設計とターゲティング ターゲティング編(抜粋)20141216 最適化を進化させるテスト設計とターゲティング ターゲティング編(抜粋)
20141216 最適化を進化させるテスト設計とターゲティング ターゲティング編(抜粋)
 
Clipping de imprensa 2016 tv
Clipping de imprensa 2016  tvClipping de imprensa 2016  tv
Clipping de imprensa 2016 tv
 
Clipping marketing 2016
Clipping marketing 2016Clipping marketing 2016
Clipping marketing 2016
 
Testing System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph Yoder
Testing System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph YoderTesting System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph Yoder
Testing System Qualities Agile2012 by Rebecca Wirfs-Brock and Joseph Yoder
 
Taming Big Balls of Mud with Diligence, Agile Practices, and Hard Work
Taming Big Balls of Mud with Diligence, Agile Practices, and Hard WorkTaming Big Balls of Mud with Diligence, Agile Practices, and Hard Work
Taming Big Balls of Mud with Diligence, Agile Practices, and Hard Work
 
Adobe Summit 2014 Quick Wrap-up
Adobe Summit 2014 Quick Wrap-upAdobe Summit 2014 Quick Wrap-up
Adobe Summit 2014 Quick Wrap-up
 
20150610 3つのPで実現される「喜ばれるエクスペリエンス」とは(抜粋)
20150610 3つのPで実現される「喜ばれるエクスペリエンス」とは(抜粋)20150610 3つのPで実現される「喜ばれるエクスペリエンス」とは(抜粋)
20150610 3つのPで実現される「喜ばれるエクスペリエンス」とは(抜粋)
 
Summit 2016 Wrap-up for eVar7
Summit 2016 Wrap-up for eVar7Summit 2016 Wrap-up for eVar7
Summit 2016 Wrap-up for eVar7
 
Milk procurement , rural retail & agribusiness[1]
Milk procurement , rural retail & agribusiness[1]Milk procurement , rural retail & agribusiness[1]
Milk procurement , rural retail & agribusiness[1]
 
AOM OOPSLA 2009
AOM OOPSLA 2009AOM OOPSLA 2009
AOM OOPSLA 2009
 
Historieta
HistorietaHistorieta
Historieta
 
English 106 project 2 ppt
English 106 project 2 pptEnglish 106 project 2 ppt
English 106 project 2 ppt
 
Summit 2016 wrap up hands out
Summit 2016 wrap up hands outSummit 2016 wrap up hands out
Summit 2016 wrap up hands out
 
Агентство Недвижимости "Тандем Риэлт"
Агентство Недвижимости "Тандем Риэлт"Агентство Недвижимости "Тандем Риэлт"
Агентство Недвижимости "Тандем Риэлт"
 
今、顧客体験を向上させるために取り組むべきこと ~Experience Business時代を迎えて~
今、顧客体験を向上させるために取り組むべきこと ~Experience Business時代を迎えて~今、顧客体験を向上させるために取り組むべきこと ~Experience Business時代を迎えて~
今、顧客体験を向上させるために取り組むべきこと ~Experience Business時代を迎えて~
 
20140415 アドタイデイズ 安西パート
20140415 アドタイデイズ 安西パート20140415 アドタイデイズ 安西パート
20140415 アドタイデイズ 安西パート
 
Being a Successful User-Centred Product Manager
Being a Successful User-Centred Product ManagerBeing a Successful User-Centred Product Manager
Being a Successful User-Centred Product Manager
 

Similar to Refactoring AOMs For AgilePT2010

When Should You Consider Meta Architectures
When Should You Consider Meta ArchitecturesWhen Should You Consider Meta Architectures
When Should You Consider Meta ArchitecturesDaniel Cukier
 
When Should You Consider Meta Architectures
When Should You Consider Meta ArchitecturesWhen Should You Consider Meta Architectures
When Should You Consider Meta Architecturesccsl-usp
 
Recover 30% of your day with IBM Development Tools (Smarter Mainframe Develop...
Recover 30% of your day with IBM Development Tools (Smarter Mainframe Develop...Recover 30% of your day with IBM Development Tools (Smarter Mainframe Develop...
Recover 30% of your day with IBM Development Tools (Smarter Mainframe Develop...Susan Yoskin
 
Clean Software Design - DevNot Summit Istanbul 2017
Clean Software Design - DevNot Summit Istanbul 2017Clean Software Design - DevNot Summit Istanbul 2017
Clean Software Design - DevNot Summit Istanbul 2017Lemi Orhan Ergin
 
How Heroku uses Heroku to build Heroku
How Heroku uses Heroku to build HerokuHow Heroku uses Heroku to build Heroku
How Heroku uses Heroku to build HerokuCraig Kerstiens
 
Teaching Elephants to Dance (and Fly!): A Developer's Journey to Digital Tran...
Teaching Elephants to Dance (and Fly!): A Developer's Journey to Digital Tran...Teaching Elephants to Dance (and Fly!): A Developer's Journey to Digital Tran...
Teaching Elephants to Dance (and Fly!): A Developer's Journey to Digital Tran...Burr Sutter
 
Real insights real_results-steve_robinson
Real insights real_results-steve_robinsonReal insights real_results-steve_robinson
Real insights real_results-steve_robinsonIBM
 
Real Insights Real Results - Steve Robinson
Real Insights Real Results - Steve RobinsonReal Insights Real Results - Steve Robinson
Real Insights Real Results - Steve RobinsonRoopa Nadkarni
 
Real insights real_results-steve_robinson
Real insights real_results-steve_robinsonReal insights real_results-steve_robinson
Real insights real_results-steve_robinsonIBM
 
Unlocking the Power of Iteration
Unlocking the Power of IterationUnlocking the Power of Iteration
Unlocking the Power of IterationClement Ho
 
Refactoring, Emergent Design & Evolutionary Architecture
Refactoring, Emergent Design & Evolutionary ArchitectureRefactoring, Emergent Design & Evolutionary Architecture
Refactoring, Emergent Design & Evolutionary ArchitectureBrad Appleton
 
The Power Of Refactoring (4developers Krakow)
The Power Of Refactoring (4developers Krakow)The Power Of Refactoring (4developers Krakow)
The Power Of Refactoring (4developers Krakow)Stefan Koopmanschap
 
CA 2E Best Practice Assessments
CA 2E Best Practice AssessmentsCA 2E Best Practice Assessments
CA 2E Best Practice AssessmentsADC Austin Tech
 
仕様決定、部品化、ディレクションがなぜ重要か
仕様決定、部品化、ディレクションがなぜ重要か仕様決定、部品化、ディレクションがなぜ重要か
仕様決定、部品化、ディレクションがなぜ重要かKohei Otsuka
 
10 Ways To Improve Your Code( Neal Ford)
10  Ways To  Improve  Your  Code( Neal  Ford)10  Ways To  Improve  Your  Code( Neal  Ford)
10 Ways To Improve Your Code( Neal Ford)guestebde
 
Refactoring - An Introduction
Refactoring - An IntroductionRefactoring - An Introduction
Refactoring - An IntroductionGiorgio Vespucci
 
Complexity is Outside the Code, JS Remote Conf
Complexity is Outside the Code, JS Remote ConfComplexity is Outside the Code, JS Remote Conf
Complexity is Outside the Code, JS Remote Confjessitron
 
Software Development Engineers Ireland
Software Development Engineers IrelandSoftware Development Engineers Ireland
Software Development Engineers IrelandSean O'Sullivan
 
Seven systems engineering myths and the corresponding realities
Seven systems engineering myths and the corresponding realitiesSeven systems engineering myths and the corresponding realities
Seven systems engineering myths and the corresponding realitiesJoseph KAsser
 

Similar to Refactoring AOMs For AgilePT2010 (20)

When Should You Consider Meta Architectures
When Should You Consider Meta ArchitecturesWhen Should You Consider Meta Architectures
When Should You Consider Meta Architectures
 
When Should You Consider Meta Architectures
When Should You Consider Meta ArchitecturesWhen Should You Consider Meta Architectures
When Should You Consider Meta Architectures
 
Recover 30% of your day with IBM Development Tools (Smarter Mainframe Develop...
Recover 30% of your day with IBM Development Tools (Smarter Mainframe Develop...Recover 30% of your day with IBM Development Tools (Smarter Mainframe Develop...
Recover 30% of your day with IBM Development Tools (Smarter Mainframe Develop...
 
Clean Software Design - DevNot Summit Istanbul 2017
Clean Software Design - DevNot Summit Istanbul 2017Clean Software Design - DevNot Summit Istanbul 2017
Clean Software Design - DevNot Summit Istanbul 2017
 
How Heroku uses Heroku to build Heroku
How Heroku uses Heroku to build HerokuHow Heroku uses Heroku to build Heroku
How Heroku uses Heroku to build Heroku
 
Teaching Elephants to Dance (and Fly!): A Developer's Journey to Digital Tran...
Teaching Elephants to Dance (and Fly!): A Developer's Journey to Digital Tran...Teaching Elephants to Dance (and Fly!): A Developer's Journey to Digital Tran...
Teaching Elephants to Dance (and Fly!): A Developer's Journey to Digital Tran...
 
Real insights real_results-steve_robinson
Real insights real_results-steve_robinsonReal insights real_results-steve_robinson
Real insights real_results-steve_robinson
 
Real Insights Real Results - Steve Robinson
Real Insights Real Results - Steve RobinsonReal Insights Real Results - Steve Robinson
Real Insights Real Results - Steve Robinson
 
Real insights real_results-steve_robinson
Real insights real_results-steve_robinsonReal insights real_results-steve_robinson
Real insights real_results-steve_robinson
 
Unlocking the Power of Iteration
Unlocking the Power of IterationUnlocking the Power of Iteration
Unlocking the Power of Iteration
 
Refactoring, Emergent Design & Evolutionary Architecture
Refactoring, Emergent Design & Evolutionary ArchitectureRefactoring, Emergent Design & Evolutionary Architecture
Refactoring, Emergent Design & Evolutionary Architecture
 
The Power Of Refactoring (4developers Krakow)
The Power Of Refactoring (4developers Krakow)The Power Of Refactoring (4developers Krakow)
The Power Of Refactoring (4developers Krakow)
 
CA 2E Best Practice Assessments
CA 2E Best Practice AssessmentsCA 2E Best Practice Assessments
CA 2E Best Practice Assessments
 
仕様決定、部品化、ディレクションがなぜ重要か
仕様決定、部品化、ディレクションがなぜ重要か仕様決定、部品化、ディレクションがなぜ重要か
仕様決定、部品化、ディレクションがなぜ重要か
 
10 Ways To Improve Your Code( Neal Ford)
10  Ways To  Improve  Your  Code( Neal  Ford)10  Ways To  Improve  Your  Code( Neal  Ford)
10 Ways To Improve Your Code( Neal Ford)
 
Refactoring - An Introduction
Refactoring - An IntroductionRefactoring - An Introduction
Refactoring - An Introduction
 
Complexity is Outside the Code, JS Remote Conf
Complexity is Outside the Code, JS Remote ConfComplexity is Outside the Code, JS Remote Conf
Complexity is Outside the Code, JS Remote Conf
 
10 Ways To Improve Your Code
10 Ways To Improve Your Code10 Ways To Improve Your Code
10 Ways To Improve Your Code
 
Software Development Engineers Ireland
Software Development Engineers IrelandSoftware Development Engineers Ireland
Software Development Engineers Ireland
 
Seven systems engineering myths and the corresponding realities
Seven systems engineering myths and the corresponding realitiesSeven systems engineering myths and the corresponding realities
Seven systems engineering myths and the corresponding realities
 

Refactoring AOMs For AgilePT2010

  • 1. Agile Refactoring for Making Systems More Adaptable Joseph W. Yoder The Refactory, Inc. June 25, 2010 joe@refactory.com http://www.refactory.com
  • 2. The Refactory Principals John Brant Don Roberts Brian Foote Joe Yoder Ralph Johnson Refactory Affiliates Joseph Bergin Fred Grossman Bill Opdyke Slide - 2 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 3. Agile to the Rescue??? Individuals and interactions over processes and tools Working software over comprehensive documentation Customer collaboration over contract negotiation Responding to change over following a plan That is, while there is value in the items on the right, we value the items on the left more. …From the Agile Manifesto Slide - 3 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 4. Agile Principles Scrum, TDD, Refactoring, Regular Feedback, Testing, More Eyes, … Good People! Face-To-Face conversation. Continuous attention to technical excellence! Motivated individuals with the environment and support they need. Retrospectives! Allow Requirements to Change! Encourage Software Evolution as needed! Slide - 4 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 5. Agile Encourages Changes Very Little Upfront Design! Piecemeal Growth! Small Iterations! Late changes to the requirements of the system! Continuously Evolving the Architecture! Adapting to Changes requires the code to change and Refactoring supports changes to the code in a “safe” way. Slide - 5 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 6. Agile & Refactoring A key part of Agile is to allow things to change and adapt as dictated by business needs! To support these changes, Refactoring is encouraged by most Agile practitioners. Agile has helped Refactoring be accepted into the mainstream development process (even sometimes encouraged). Slide - 6 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 7. Ground Breaking Work Before there was Agile… Started at the University Of Illinois Bill Opdyke & Don Roberts PHD Thesis with Professor Ralph Johnson Refactoring Browser by John Brant and Don Roberts (first commercial tool) Slide - 7 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 8. Refactoring Definition Refactoring is the process of changing a software system in such a way that it does not alter the external behavior of the code, yet improves its internal structure…Martin Fowler, Refactoring Improving the Design of Existing Code; Addison Wesley , 1999 Slide - 8 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 9. What is Refactoring Refactoring is a controlled technique for improving the design of an existing code base Small behavior-preserving transformations, • Each of might be "too small to be worth doing“ • Cumulative effect of transformations is significant • Small steps help reduce the risk of introducing errors • Avoid having the system broken while you are carrying out the restructuring • Gradually refactor a system over a period of time Slide - 9 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 10. A Simple Refactoring Create Empty Class Object Object NewAbstract Concrete1 Concrete2 Concrete1 Concrete2 Slide - 10 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 11. A Complex Refactoring Array MatrixRep Matrix rep Matrix SparseRep ArrayRep IdentityRep Adapted from Don Roberts, The Refactory, Inc. Slide - 11 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 12. Refactoring Code Smells A code smell is a hint that something has gone wrong somewhere in your code. Use the smell to track down the problem. KentBeck (with inspiration from the nose of Massimo Arnoldi) seems to have coined the phrase in the "OnceAndOnlyOnce" page, where he also said that code "wants to be simple". Bad Smells in Code was an essay by KentBeck and MartinFowler, published as Chapter 3 of Refactoring Improving The Design Of ExistingCode. ----Wards Wiki Slide - 12 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 13. Code Smells Review Duplicate Code, Long Method, Large Class, Long Parameter List, Divergent Change, Shotgun Surgery, Feature Envy, Data Clumps Primitive Obsession, Switch Statements Parallel Inheritance, Lazy Class Speculative Generality, Temporary Field Message Chains, Middle Man Inappropriate Intimacy, Incomplete Lib Classes Data Class, Refused Bequest, Comments Slide - 13 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 14. Comments We are not against comments but… If you see large methods that have places where the code is commented, use Extract Method to pull that out to a comment Slide - 14 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 15. Comments Example (Extract Method) void printOwing (double amount) { printBanner(); //print details System.out.println (name: “ + _name); System.out.println (amount: “ + amount); …} void printOwing (double amount) { printBanner(); printDetails(); …} void printDetails (double amount) { System.out.println (name: “ + _name); System.out.println (amount: “ + amount);} Slide - 15 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 16. Extract Method Mechanics Create a new method and name it after the intention of the code to extract. Copy the extracted code from the source to the new method. Scan the extracted code for references to any variables that are local to the source method. See whether any temps are used only within extracted code. Pass into target method as parameters local-scope variables that are read from the extracted code. Replace the extracted code in the source method. Slide - 16 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 17. Remove Method with Method Object Class Order … double price() { double primaryBasePrice; double secondaryBasePrice; double tertiaryBasePrice; // long computation; …} Order PriceCalculator price() primaryBasePrice 1 secondaryBasePrice tertiaryBasePrice return new PriceCalculator(this).compute() compute() Slide - 17 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 18. Remove Method to Method Object Mechanics Create a new class named after method. Give the new class a final field for the object that hosted the original method. Give the new class a constructor for the original object and each parameter. Give the new class a compute method. Copy the body of original method to compute. Compile. Replace the old method with the one that creates the new object and calls compute. Slide - 18 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 19. Agile & Testing Many Agile practices highly encourage Testing as one of their core practices. Processes like XP support developers writing many unit tests (XUnit ). Test Driven Development (TDD) is becoming highly accepted in Agile. Testing was a key principle of Refactoring before there was Agile! Slide - 19 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 20. Prerequisites of Refactoring Since you are changing the code base, it is IMPORTANT to validate with tests. There are also a time to refactor and a time to wait. Need both Unit Testing and Integrated Tests for making sure nothing breaks Slide - 20 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 21. Deciding Whether A Refactoring is Safe "A refactoring shouldn't break a program.”  What does this mean? A safe refactoring is behavior preserving. It is important not to violate:  naming/ scoping rules.  type rules. "The program should perform the same after a refactoring as before.” Satisfying timing constraints. Slide - 21 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 22. Using Standard Tools To be safe, must have tests Should pass the tests before and after refactoring  Commercial Testing Tools  Kent Beck’s Testing Framework (SUnit, JUnit, Nunit, …) Take small steps, testing between each Java and C# tools are getting better Slide - 22 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 23. Catalogue of Refactorings Composing Method Moving Features Organize Data Simplifying Conditionals Simpler Method Calls Generalization From Fowlers Book Slide - 23 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 24. Refactoring and Design Patterns (1) What varies Design Pattern Algorithms Strategy, Visitor Actions Command Implementations Bridge Response to change Observer Slide - 24 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 25. Refactoring and Design Patterns (2) What varies Design Pattern Interactions between objects Mediator Factory Method, Abstract Object being created Factory, Prototype Structure being created Builder Traversal Algorithm Iterator Object interfaces Adapter Object behavior Decorator, State Slide - 25 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 26. Refactoring Summary We have seen the mechanics for some of the Refactorings. When you find smelly code, you often apply Refactorings to clean your code. Refactorings do often apply Design Patterns. Slide - 26 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 27. Building a System to Change Sometimes it pays off to build a system that can respond quickly to change! Slide - 27 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 28. Allowing Systems to Adapt Requirements change within application’s domain. Domain Experts know their domain best. Business Rules are changing rapidly. Applications have to quickly adapt to new business requirements. Agile Development Welcomes Changes to the Requirements, even late in the development! One way to Adapt is to just Refactor to new business requirements…though sometimes… Slide - 28 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 29. Forces – Shearing Layers Who (Business Person, Analyst, Developer) What (Business Rule, Persistence Layer,…) When (How often, How fast) There is a different rate of change on the system. Foote & Yoder - Ball of Mud PLoPD4 Slide - 29 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 30. Newborn Screening Refactoring Example Doctor, HealthProf. Hospital, Lab Blood Specimen Mother, Infant Slide - 30 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 31. Medical Observation – Basic OO Design Model Person * Observation Measurement Trait Quantity traitValue unit convertTo: amount expressOnUnit: expressOnUnits: PhysicalMeasure Blood EyeColor HairColor Gender … Height Weight FeedingType Hearing Vision … What happens when a new observation is required? Slide - 31 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 32. Observation Design (1st Design) Person Observation ObservationType 1 * -recordedDate : Date * 1 +address() -observedDate : Date -phenomenon : Symbol +phone() -duration : TimePeriod +name() +phenomenon() Quantity Measurement Trait 1 1 -unit : Unit -amount : Number +expressOnUnit(aUnit : Unit) +observationValue() +observationValue() +expressOnUnits(unitCollection : Collection) Slide - 32 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 33. Observation Design Example Height: 3 feet Eyes Color: Blue Name: John Smith Mother: Sue Smith Father: Address: Phone: Slide - 33 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 34. Observation Design (instance diagram) aPerson name <John Smith> obsCollection anObservationType aMeasurement #height type value aQuantity value <3> unit <ft> aTrait type anObservationType value <blue> #eyeColor Slide - 34 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 35. Composing Observations Observations can be more complex Cholesterol  Components: HDL, LDL Blood Pressure  Components: Systolic, Diastolic Vision  Components: Left Eye, Right Eye Slide - 35 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 36. Composite Observation Design (1st Refactoring) Person +address() +phone() +name() Observation ObservationType -recordedDate : Date -phenomenon : Symbol -observedDate : Date 1..n -duration : TimePeriod +phenomenon() Quantity Measurement Trait CompositeObservation -unit : Unit -amount : Number -observations : Collection +expressOnUnit(aUnit : Unit) +observationValue() +observationValue() +expressOnUnits(unitCollection : Collection) Composite Pattern (GOF) Make sure all tests still pass! Slide - 36 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 37. Observation Design Example Height: 3 feet Eyes Color: Blue Name: John Smith Mother: Sue Smith Blood Pressure: Father: Systolic: 120 mmHg Address: Diastolic: 80 mmHg Phone: Slide - 37 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 38. Composite Observation Design (instance diagram) anObservType <#BloodPressure> aCompObs aMeasurement anObserType <120 mmHg> <#SYSTOLIC> anotherMeasurement anObser-Type <80 mmHg> <#DIASTOLIC> Slide - 38 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 39. Composite and Primitive Observation Design What we know about John? aPerson name <John Smith> obsCollection EyesColor: Blue Height: 3 feet BloodPressure: 120/80 Systolic: 120 mmHg Diastolic: 80 mmHg Slide - 39 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 40. Validating Observations Each Observation has its own set of legal values.  Baby’s Weight: [0 30] pounds  HepatitisB: {positive, negative}  Left/Right Vision: {normal, abnormal} GUI can enforce legal values  but we want business rules in domain objects Slide - 40 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 41. Validating Observations Design (2nd Refactoring) ObservationType Validator -phenomenon : Symbol -validator : Validator DiscreteValidator NullValidator RangedValidator -descriptorSet : Collection -intervalSet : Collection -validUnit : Unit Slide - 41 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 42. Overall Observation Design Validator DiscreteValidator RangedValidator NullValidator Party descriptorSet intervalSet validUnit Observation ObservationType recordedDate type comments Measurement Trait CompositeObservation value value values value value value: value: convertTo: Quantity First make sure original test cases pass and then add new test cases for the validators! Is everything an Observation? How does the model specify the structure of the Composite? What is the relationship between Trait and DiscreteValidator? Slide - 42 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 43. Observation Design Validator validatorName ObservationType isValid: obsValue phenomenonType isValid: obsValue DiscreteValidator RangedValidator NullValidator descriptorSet intervalSet validUnit PrimitiveObservation CompositeObservation Type Type Party Observation recordedDate comments isValid Quantity unit CompositeObservation Primitive Observation quantity observationValue convertTo: DiscreteValues Extend the Design by adding Composite to Type -- Refactor the Metadata Slide - 43 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 44. Observation Design Validator validatorName ObservationType isValid: obsValue phenomenonType isValid: obsValue DiscreteValidator RangedValidator NullValidator descriptorSet intervalSet validUnit PrimitiveObservation CompositeObservation Type Type Party Observation recordedDate comments isValid Quantity unit CompositeObservation Primitive Observation quantity observationValue convertTo: Operational level DiscreteValues Extend the Design by adding Composite to Type -- Refactor the Metadata Slide - 44 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 45. Observation Design Validator validatorName ObservationType Knowledge level isValid: obsValue phenomenonType isValid: obsValue DiscreteValidator RangedValidator NullValidator descriptorSet intervalSet validUnit PrimitiveObservation CompositeObservation Type Type Party Observation recordedDate comments isValid Quantity unit CompositeObservation Primitive Observation quantity observationValue convertTo: DiscreteValues Extend the Design by adding Composite to Type -- Refactor the Metadata Slide - 45 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 46. Observation Design (instance diagram) anObserv-Type <#COMP-GAL> aCompObs aMeasurement anObser-Type aRangedValidator <aQuantity> <#GAL> anotherMeasurement anObser-Type anotherRangedValidator <anotherQuantity> <#UDT> Slide - 46 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 47. Observation Design (instance diagram) anInfant name aDiscreteValidator obsCollection anObservationType aRangedValidator #GestationalAge aMeasurement type value aQuantity value <36> unit <weeks> anObserv-Type <#COMP-GAL> aCompObs aRangedValidator aMeasurement anObser-Type <aQuantity> <#GAL> anotherRangedValidator anotherMeasurement anObser-Type <anotherQuantity> <#UDT> Slide - 47 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 48. Observations: TypeObject ObservationType TypeObject phenomenonType 1 descriptor 1..* Observation isValid: obsValue instance recordedDate 1..* elements comments elements 1..* isValid Quantity PrimitiveObservation CompositeObservation unit Type Type value 1..* quantity CompositeObservation Primitive Observation observationValue convertTo: Knowledge level DiscreteValues dvalue 1..* Operational level Slide - 48 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 49. Observations: Properties Party properties 1..* 1..* Observation instance recordedDate comments elements 1..* isValid Quantity unit value 1..* quantity CompositeObservation Primitive Observation observationValue convertTo: Knowledge level dvalue 1..* DiscreteValues Operational level Slide - 49 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 50. Observations: TypeSquare contDescr 1 ObservationType 1..* varType PartyType phenomenonType 1 descriptor isValid: obsValue 1 descriptor 1..* 1..* elements Party PrimitiveObservation CompositeObservation Type Type properties 1..* 1..* Observation instance recordedDate comments elements 1..* isValid Quantity unit value 1..* quantity CompositeObservation Primitive Observation observationValue convertTo: Knowledge level Operational level dvalue 1..* DiscreteValues Slide - 50 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 51. Observations: Strategy 1..* type ObservationType Validator phenomenonType guard 1 validatorName isValid: obsValue isValid: obsValue 1..* elements PrimitiveObservation CompositeObservation DiscreteValidator RangedValidator NullValidator Type Type descriptorSet intervalSet validUnit Knowledge level Operational level Slide - 51 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 52. Medical Observations Design 1..* type contDescr 1 Entities guard 1 Validator validatorName ObservationType 1..* varType PartyType isValid: obsValue phenomenonType 1 descriptor isValid: obsValue 1 descriptor 1..* 1..* elements Party DiscreteValidator RangedValidator NullValidator descriptorSet intervalSet PrimitiveObservation CompositeObservation validUnit Type Type properties 1..* 1..* Observation Behavior instance recordedDate comments elements 1..* isValid Quantity unit value 1..* quantity CompositeObservation Primitive Observation observationValue convertTo: Knowledge level Operational level dvalue 1..* DiscreteValues Attributes Slide - 52 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 53. Strategies/Interpreters/RuleObjects (Behavior/Methods) SomeStrategy Entity 1 * -sharedAttributes : someType -specificAttribues : type +sharedInterface() * +someOperations() RuleObject Strategy1 Strategy2 ... StragegyN * 1 1 Strategy2.1 Strategy2.2 PrimitiveRule CompositeRule ANDCondition ORCondition NOTCondition Design Patterns - GOF95 Composite Strategies  Interpreter Slide - 53 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 54. Composite Strategies Problem: Strategy leads to a big class hierarchy, one class for each kind of policy. Solution: Make Composite Strategies using Primitive Operations. => Interpreter pattern Slide - 54 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 55. Adaptive Object Model “Common Architecture” -children * * -children Accountability -type 1 AccountabilityType Classes with 1 Attributes and 1 1 Relationships 1 -accountabilities 1 -accountabilitieTypes Behavior -children ** -children * * -rules * Entity -type EntityType Rule 1 1 1 1 1 +valueUsing:() 1 1 -attributeTypes -attributes * * * 1 * Attribute AttributeType Constant CompositeRule +name +value -type +type 1 * 1 +valueUsing:() * Operational Knowledge (meta) TableLookup BinaryOperation * Slide - 55 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 56. Process for Developing Adaptable Systems Developed Iteratively and Incrementally.  Be Agile, Scrum, XP, Retrospective Get Customer Feedback early and often.  User Scenarios – User Stories… Add flexibility only when and where needed. Provide Test Cases and Suites for both the Object-Model and the Meta-Model. Develop Support Tools and Editors for manipulating the metadata. Very similar to Evolving Frameworks by Roberts and Johnson PLoPD3 Slide - 56 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 57. Refactoring Addresses Some Key Leverage Points Refactoring is a technique that works with Brooks’ “promising attacks” (from “No Silver Bullet”):  buy rather than build: restructuring interfaces to support commercial SW  grow don’t build software: software growth involves restructuring (isn’t this core to Agile???)  requirements refinements and rapid prototyping: refactoring supports such design exploration, and adapting to changing customer needs  support great designers: a tool in a designer’s tool chest. Slide - 57 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 58. Papers and Web Sites Bill Opdyke’s Thesis Don Robert’s Thesis  http://st-www.cs.illinois.edu/users/droberts/thesis.pdf Refactoring Browser  http://st-www.cs.illinois.edu/users/brant/Refactory Evolving Frameworks  http://st-www.cs.uiuc.edu/users/droberts/evolve.html Extreme Programming  http://www.c2.com/cgi-bin/wiki?ExtremeProgramming Slide - 58 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 59. More Web Sites Wiki wiki web  http://c2.com/cgi/wiki?WikiPagesAboutRefactoring The Refactory, Inc.  http://www.refactory.com Martin Fowler’s Refactoring Pages  http://www.refactoring.com/ Adaptive Object Models  http://www.adaptiveobjectmodel.com/ Slide - 59 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.
  • 60. That’s All Slide - 60 Agile Refactoring for Making Systems More Adaptable Copyright 2010, Joseph W. Yoder & The Refactory, Inc.