KEMBAR78
Agile Software Design | PDF
Software
Design on
Agile Methods



        Eduardo Guerra
GUERRA
             guerraem@gmail.com

                                      ITA
                 @emguerra

MundoJ                       Architect +
                             Researcher
  Frameworks
  SwingBean, Esfinge
                            Experience
    Research               JavaSE, JavaEE, JavaME
Patterns + Frameworks
+ Agile + Tests + Design
some months latter



borrow some
   money
                                   pay what you
                                   borrowed plus
                                      interest
some years latter



borrow some
   money
                                  pay with
                                  your life!
some days latter
bad code was
                    duplicated
maintenance
in this code
  is time-
consuming




                       people avoid
                       reusing this
                          code
   other classes
  became coupled
    with the bad
      design
some months latter
sometimes
there is no
turn back
“Shipping first time code is like going into
debt. A little debt speeds development so long
as it is paid back promptly with a rewrite...
The danger occurs when the debt is not
repaid. Every minute spent on not-quite-right
code counts as interest on that debt. Entire
engineering organizations can be brought to a
stand-still under the debt load of an
unconsolidated implementation, object-
oriented or otherwise.”

                  Ward Cunningham
Technical
            Debt
As soon as you pay
it, less work you
need to fix it!
Sometimes clients doesn't
FACTS         know exactly what
              requirements they need in
              their software

              Design solutions based on
              one requirement can be
              different if others are
              considered

These facts create a risk to deliver
wrong software to the client!
Traditional software engineer
uses he same approach of other
 types of engineering projects!
Identify all             Create a              Construct based
requirements            complete project          on the project




          Deliver the             Test to verify the
          software                 requirements
Cost of Change Curve
          Using traditional
        style, it is cheaper to
            change in the
COST




              beginning




                             TIME
Traditional software engineer put
  a lot of effort on requirements
  and project to avoid changes!
But, didn't they
see the signs?
Expected!
Unexpected...
             Due to bad
             communication

Because market needs.
Agile software
development
has a distinct
 approach...
Instead of fight



against changes ...
Agile
embraces
changes !
Agile software engineer focus on
implementation and tests to enable
  software to be changed easily!
Automated Testing
Makes safe to change


Decoupling
Changes are isolated



Clean Code
Changes are more easy to make
Test-Driven   Refactoring
Development
Test
Driven
Development
Imagine if you
   could test-
driven your life...
Why some
people don't
  do that
 with their
   code?
Test Driven
Development
is a development and
 design technique in
   which the tests are
 created before the
  production code.
TDD is a crazy
idea that works!




     Kent Beck
Software Engineering
      Radio Podcast
TDD
Cycle
 by Google
Add a Test
          design class interface +
         define expected behavior

     Make Test Pass
create actual behavior +
  most simple solution

   Refactor
          clean implemented code
            + adjust class design
Baby
Steps
All code
 is Guilty
    untl
  proven
Innocent
Refactoring
How often people wash the
dishes in a restaurant kitchen?
The next meal will take longer
and be more expensive because
  we are cleaning the kitchen.



                  What???
This feature that you are
asking is expensive because
the code is not clean and we
   will need to change it.
                               Humm...
                                OK...
Are your source code like this?
Is it better to   Or to let dirt
clean little by    and mess
     little?      accumulate?
Some dirt are hard
       to clean in the
      course of time!

  Remember
Technical Debt?
How to clean
     the source
       code?


Refactoring
“Refactoring is a disciplined
technique for restructuring an
existing body of code, altering
its internal structure without
changing its external behavior.”

               Martin Fowler
Code Bad Smells
 Have you ever look to a
   piece of code which
 doesn't smell very nice?

Code smell is any
symptom in the
source code that can
indicate a problem!
In every step, the tests
                should be executed to
               verify if everything still
                       working!


                        Refactoring
                    is performed in
         small steps to remove bad
smells and reach the desired design
Using refactoring,
the application design
 emerge according to
      its needs!
Is it not dangerous
            to change a
           wining team?


 No when you have
automated unit tests!
Conclusions
Cost of Change Curve
         Agile practices keep




                                       l
                                     na
          the cost of change




                                       io
           constant in later




                                    dit
                                 tra
         phases of the project
COST




                                       agile


                        TIME
short
iterations
Short
iterations only
 works if your
 code is ready
   to change!
Don't try to predict future
  design requirements

        Work hard in
      your current needs
        and let design
            emerge
See you on

Agile Software Design