www.unicomlearning.com

India Agile Week-2013
26 October 2013 | Pune
Paving the Way for Agile Engineering Practices
Aman K...
www.unicomlearning.com

Paving the Way
for

Agile Engineering
Practices
UNICOM Presents

India Agile Week-2013
www.unicomlearning.com

Paving the Way
for

Agile Engineering
Practices
UNICOM Presents

India Agile Week-2013
www.unicomlearning.com

Paving the Way
for

Agile Engineering
Practices
UNICOM Presents

India Agile Week-2013
www.unicomlearning.com

Paving the Way
for

Agile Engineering
Practices
UNICOM Presents

India Agile Week-2013
Exploring Agile Engineering Practices…
Exploring Agile Engineering Practices…
Exploring Agile Engineering Practices…
Exploring Agile Engineering Practices…
Exploring Agile Engineering Practices…
Agile Engineering
Practices
Paving the Way
for

Agile Engineering
Practices
Paving the Way
for

Agile Engineering
Practices
Why?
Observations
as
Agile Practitioner &
Agile Coach
Most code bases are
inherited by teams
Most teams starting Agile
adoption have an existing
code base
Existing code bases differ
from “Agile” code bases
Agile Engineering Practices
cannot be applied as-is
to existing code bases
Result?
Technical improvements
cannot keep up with Agile
planning, time-boxes &
frequent delivery
Everyone stresses out!
Code base worsens with
every iteration!

Agile deemed a failure!
Paving the Way
for

Agile Engineering
Practices
What?
Removing common
roadblocks
Code smells
Architectural smells
Deployment smells
Code smells
Most common, most offending!
•
•
•
•
•
•
•
•
•
•

Long methods
Long class
Static method calls
Lot of if-else’s, including ...
Hurt Matrix
Smell

TDD

Refactoring

Pair
Programming

Continuous
Integration

Long methods/class

X

X

X

-

Statics

X
...
Architectural smells
Most common, most offending!
•
•
•
•
•
•
•
•

Incorrect responsibility-split across layers
Confusing or inconsistent modul...
Hurt Matrix
Smell

TDD

Refactoring

Pair
Programming

Continuous
Integration

Layering

X

X

X

X

Module structure

X

...
Deployment smells
Most common, most offending!
•
•
•
•
•
•

Branching based on release / feature / team
Dependencies not version controlled
...
Hurt Matrix
Smell

TDD

Refactoring

Pair
Programming

Continuous
Integration

Branching strategy

-

X

X

X

Untracked d...
Paving the Way
for

Agile Engineering
Practices
How?
Let’s look at
examples…
Code smells
Most common, most offending!
•
•
•
•
•
•
•
•
•
•

Long methods
Long class
Static method calls
Lot of if-else’s, including ...
Most common, most offending!
•
•
•
•
•
•
•
•
•
•

Long methods
Long class
Static method calls
Lot of if-else’s, including ...
Smelly!
TDD Hurt:
Hard to test for
one thing at a
time!
Refactoring
Hurt:
Hard to safely
refactor!
Failed attempt at IDE refactoring!
Pair
Programming
Hurt:
Hard to quickly
understand!
Hard to quickly
debug!
What to do?

Smelly Code
Smelly Code

Tests for
Smelly Code
Smelly Code

Tests for
Smelly Code

Tests for
new Feature
Smelly Code

Tests for
Smelly Code

Tests for
new Feature

Add to
Smelly Code
Smelly Code

Tests for
Smelly Code

Tests for
new Feature

Add to
Smelly Code

Smellier
Code
Let’s back up a bit…
Smelly Code

Tests for
Smelly Code

Tests for
new Feature

Add to
Smelly Code

Smellier
Code
Smelly Code

Tests for
Smelly Code

Tests for
new Feature

Manual
Refactor to
Less Smelly
Code

Add to
Smelly Code

Smelli...
Smelly Code

Tests for
Smelly Code

Tests for
new Feature

Manual
Refactor to
Less Smelly
Code

Add to
Smelly Code

Smelli...
Smelly Code

Tests for
Smelly Code

Tests for
new Feature

Manual
Refactor to
Less Smelly
Code

Add to
Smelly Code

Add to...
Smelly Code

Tests for
Smelly Code

Tests for
new Feature

Manual
Refactor to
Less Smelly
Code

Add to
Smelly Code

Add to...
Smelly Code

Tests for
Smelly Code

Tests for
new Feature

Manual
Refactor to
Less Smelly
Code

Pave!

Add to
Smelly Code
...
Most common, most offending!
•
•
•
•
•
•
•
•
•
•

Long methods
Long class
Static method calls
Lot of if-else’s, including ...
Most common, most offending!
•
•
•
•
•
•
•
•
•
•

Long methods
Long class
Static method calls
Lot of if-else’s, including ...
Smelly!
Pave!
Most common, most offending!
•
•
•
•
•
•
•
•
•
•

Long methods
Long class
Static method calls
Lot of if-else’s, including ...
Smelly!
How to
test
different
outcomes?
Pave!
Architectural smells
Most common, most offending!
•
•
•
•
•
•
•
•

Incorrect responsibility-split across layers
Confusing or inconsistent modul...
Most common, most offending!
•
•
•
•
•
•
•
•

Incorrect responsibility-split across layers
Confusing or inconsistent modul...
Smelly!
Pave!
Smelly!
Two database hits!
Pave!
More domain driven
Most common, most offending!
•
•
•
•
•
•
•
•

Incorrect responsibility-split across layers
Confusing or inconsistent modul...
Smelly!
Field-based
injection
How to inject the
mock?
Pave!
A

B

C

Spring IoC

D
A

B

C

Spring IoC

D

E
A

B

C

E

Spring IoC

D
A

B

C

E

Spring IoC

D

Is E really
“cross-cutting”
or is it just too
easy to inject?
A

High
coupling

B

C

E

Spring IoC

D

Smelly!
A

B

C

E

Spring IoC

D

Solution?
A

B

C

D

E

Pave!

Spring IoC
Deployment smells
Most common, most offending!
•
•
•
•
•
•

Branching based on release / feature / team
Dependencies not version controlled
...
Most common, most offending!
•
•
•
•
•
•

Branching based on release / feature / team
Dependencies not version controlled
...
Smelly!
http://martinfowler.com/bliki/FeatureBranch.html
Pave!

http://martinfowler.com/bliki/FeatureToggle.html
http://paulhammant.com/blog/branch_by_abstraction.html
Most common, most offending!
•
•
•
•
•
•

Branching based on release / feature / team
Dependencies not version controlled
...
Pave!

Dump
current
schema DDL

Introduce a
tool like
Liquibase/
dbdeploy &
commit
initial DDL
script

Similarly for DML

...
Most common, most offending!
•
•
•
•
•
•

Branching based on release / feature / team
Dependencies not version controlled
...
Pave!

Automate
deployment
steps with
bash scripts

Commit the
scripts into
a versioncontrolled
repository

http://rubygem...
Most common, most offending!
•
•
•
•
•
•

Branching based on release / feature / team
Dependencies not version controlled
...
Pave!

Identify
volatile
shared
resources

Deploy/
install local
version of
identified
resources

Create stubs
as local
ve...
Paving the Way
for

Agile Engineering
Practices…
Is difficult but doable!
Needs some upfront thinking,
planning & implementation.
Can be done alongside business
functional...
Just be alert & prepared…
to pave the way!
www.unicomlearning.com

amanking.com
king@thoughtworks.com

India Agile Week-2013
Organized by
UNICOM Trainings & Seminars...
Paving the Way for Agile Engineering Practices
Paving the Way for Agile Engineering Practices
Paving the Way for Agile Engineering Practices
Paving the Way for Agile Engineering Practices
Paving the Way for Agile Engineering Practices
Paving the Way for Agile Engineering Practices
Paving the Way for Agile Engineering Practices
Paving the Way for Agile Engineering Practices
Paving the Way for Agile Engineering Practices
Paving the Way for Agile Engineering Practices
Paving the Way for Agile Engineering Practices
Paving the Way for Agile Engineering Practices
Paving the Way for Agile Engineering Practices
Paving the Way for Agile Engineering Practices
Paving the Way for Agile Engineering Practices
Paving the Way for Agile Engineering Practices
Paving the Way for Agile Engineering Practices
Paving the Way for Agile Engineering Practices
Paving the Way for Agile Engineering Practices
Upcoming SlideShare
Loading in …5
×

Paving the Way for Agile Engineering Practices

648 views

Published on

Talk focused on preparing to apply Agile Engineering Practices on an existing code base. Most existing projects differ in structure and quality compared to greenfield Agile projects. They often suffer from Code Smells, Architectural Smells, and Deployment Smells. Overcoming these in an evolutionary manner is key to paving the way for successful application of Agile Engineering Practices. Failure to do so could lead to stress and counterproductive results. This presentation covers why, what, and how of some useful techniques.

Presented at Agile in Business conference at Pune, India, during India Agile Week (Oct 2013).

Published in: Technology
1 Comment
2 Likes
Statistics
Notes
No Downloads
Views
Total views
648
On SlideShare
0
From Embeds
0
Number of Embeds
24
Actions
Shares
0
Downloads
0
Comments
1
Likes
2
Embeds 0
No embeds

No notes for slide
  • Credits:http://shop.oreilly.com/product/0636920020271.do
  • Credits:http://shop.oreilly.com/product/0636920020271.dohttp://www.cs.ox.ac.uk/softeng/subjects/APE.html
  • Credits:http://shop.oreilly.com/product/0636920020271.dohttp://www.cs.ox.ac.uk/softeng/subjects/APE.htmlhttp://www.scrumalliance.org/courses-events/courses/csd/united-states/new-jersey/princeton/2013/august/20132307-certified-scrumdeveloper-track
  • Credits:http://shop.oreilly.com/product/0636920020271.dohttp://www.cs.ox.ac.uk/softeng/subjects/APE.htmlhttp://www.scrumalliance.org/courses-events/courses/csd/united-states/new-jersey/princeton/2013/august/20132307-certified-scrumdeveloper-trackhttp://www.agileinbusiness.com/pune/program
  • Paving the Way for Agile Engineering Practices

    1. 1. www.unicomlearning.com India Agile Week-2013 26 October 2013 | Pune Paving the Way for Agile Engineering Practices Aman King Agile Technologist | Agile Coach ThoughtWorks India | Bangalore www.agileinbusiness.com
    2. 2. www.unicomlearning.com Paving the Way for Agile Engineering Practices UNICOM Presents India Agile Week-2013
    3. 3. www.unicomlearning.com Paving the Way for Agile Engineering Practices UNICOM Presents India Agile Week-2013
    4. 4. www.unicomlearning.com Paving the Way for Agile Engineering Practices UNICOM Presents India Agile Week-2013
    5. 5. www.unicomlearning.com Paving the Way for Agile Engineering Practices UNICOM Presents India Agile Week-2013
    6. 6. Exploring Agile Engineering Practices…
    7. 7. Exploring Agile Engineering Practices…
    8. 8. Exploring Agile Engineering Practices…
    9. 9. Exploring Agile Engineering Practices…
    10. 10. Exploring Agile Engineering Practices…
    11. 11. Agile Engineering Practices
    12. 12. Paving the Way for Agile Engineering Practices
    13. 13. Paving the Way for Agile Engineering Practices Why?
    14. 14. Observations as Agile Practitioner & Agile Coach
    15. 15. Most code bases are inherited by teams
    16. 16. Most teams starting Agile adoption have an existing code base
    17. 17. Existing code bases differ from “Agile” code bases
    18. 18. Agile Engineering Practices cannot be applied as-is to existing code bases
    19. 19. Result?
    20. 20. Technical improvements cannot keep up with Agile planning, time-boxes & frequent delivery
    21. 21. Everyone stresses out! Code base worsens with every iteration! Agile deemed a failure!
    22. 22. Paving the Way for Agile Engineering Practices What?
    23. 23. Removing common roadblocks
    24. 24. Code smells Architectural smells Deployment smells
    25. 25. Code smells
    26. 26. Most common, most offending! • • • • • • • • • • Long methods Long class Static method calls Lot of if-else’s, including null checks Primitive obsession Multiple assignments to a local variable Temporal coupling Fields as temporary variables Out parameters Setters!!!
    27. 27. Hurt Matrix Smell TDD Refactoring Pair Programming Continuous Integration Long methods/class X X X - Statics X X - X Conditionals X X X - Primitive obsession X X - - Multiple assignments X X X - Methods with side-effects X X X - Setters X X X -
    28. 28. Architectural smells
    29. 29. Most common, most offending! • • • • • • • • Incorrect responsibility-split across layers Confusing or inconsistent module structure Missing Dependency Injection Abused Dependency Injection No componentization Over-componentization Rewrites: big-bang, either-or, long-lived Mixed tech stack
    30. 30. Hurt Matrix Smell TDD Refactoring Pair Programming Continuous Integration Layering X X X X Module structure X X X - Missing or abused DI X X X X Componentization X X X X Rewrites X X X X Mixed tech stack X X X X
    31. 31. Deployment smells
    32. 32. Most common, most offending! • • • • • • Branching based on release / feature / team Dependencies not version controlled Database changes not version controlled Deployment scripts not version controlled Shared non-isolated environments Infrastructure access highly restricted
    33. 33. Hurt Matrix Smell TDD Refactoring Pair Programming Continuous Integration Branching strategy - X X X Untracked dependencies - - X X Untracked DB changes X X X X Untracked deployment scripts - - X X Shared environments X X X X Restricted infrastructure access - - X X
    34. 34. Paving the Way for Agile Engineering Practices How?
    35. 35. Let’s look at examples…
    36. 36. Code smells
    37. 37. Most common, most offending! • • • • • • • • • • Long methods Long class Static method calls Lot of if-else’s, including null checks Primitive obsession Multiple assignments to a local variable Temporal coupling Fields as temporary variables Out parameters Setters!!!
    38. 38. Most common, most offending! • • • • • • • • • • Long methods Long class Static method calls Lot of if-else’s, including null checks Primitive obsession Multiple assignments to a local variable Temporal coupling Fields as temporary variables Out parameters Setters!!!
    39. 39. Smelly!
    40. 40. TDD Hurt: Hard to test for one thing at a time!
    41. 41. Refactoring Hurt: Hard to safely refactor!
    42. 42. Failed attempt at IDE refactoring!
    43. 43. Pair Programming Hurt: Hard to quickly understand! Hard to quickly debug!
    44. 44. What to do? Smelly Code
    45. 45. Smelly Code Tests for Smelly Code
    46. 46. Smelly Code Tests for Smelly Code Tests for new Feature
    47. 47. Smelly Code Tests for Smelly Code Tests for new Feature Add to Smelly Code
    48. 48. Smelly Code Tests for Smelly Code Tests for new Feature Add to Smelly Code Smellier Code
    49. 49. Let’s back up a bit…
    50. 50. Smelly Code Tests for Smelly Code Tests for new Feature Add to Smelly Code Smellier Code
    51. 51. Smelly Code Tests for Smelly Code Tests for new Feature Manual Refactor to Less Smelly Code Add to Smelly Code Smellier Code
    52. 52. Smelly Code Tests for Smelly Code Tests for new Feature Manual Refactor to Less Smelly Code Add to Smelly Code Smellier Code
    53. 53. Smelly Code Tests for Smelly Code Tests for new Feature Manual Refactor to Less Smelly Code Add to Smelly Code Add to Refactored Code Smellier Code
    54. 54. Smelly Code Tests for Smelly Code Tests for new Feature Manual Refactor to Less Smelly Code Add to Smelly Code Add to Refactored Code Refactor to Less Smelly Code Smellier Code Cleaner Code
    55. 55. Smelly Code Tests for Smelly Code Tests for new Feature Manual Refactor to Less Smelly Code Pave! Add to Smelly Code Add to Refactored Code Refactor to Less Smelly Code Smellier Code Cleaner Code
    56. 56. Most common, most offending! • • • • • • • • • • Long methods Long class Static method calls Lot of if-else’s, including null checks Primitive obsession Multiple assignments to a local variable Temporal coupling Fields as temporary variables Out parameters Setters!!!
    57. 57. Most common, most offending! • • • • • • • • • • Long methods Long class Static method calls Lot of if-else’s, including null checks Primitive obsession Multiple assignments to a local variable Temporal coupling Fields as temporary variables Out parameters Setters!!!
    58. 58. Smelly!
    59. 59. Pave!
    60. 60. Most common, most offending! • • • • • • • • • • Long methods Long class Static method calls Lot of if-else’s, including null checks Primitive obsession Multiple assignments to a local variable Temporal coupling Fields as temporary variables Out parameters Setters!!!
    61. 61. Smelly!
    62. 62. How to test different outcomes?
    63. 63. Pave!
    64. 64. Architectural smells
    65. 65. Most common, most offending! • • • • • • • • Incorrect responsibility-split across layers Confusing or inconsistent module structure Missing Dependency Injection Abused Dependency Injection No componentization Over-componentization Rewrites: big-bang, either-or, long-lived Mixed tech stack
    66. 66. Most common, most offending! • • • • • • • • Incorrect responsibility-split across layers Confusing or inconsistent module structure Missing Dependency Injection Abused Dependency Injection No componentization Over-componentization Rewrites: big-bang, either-or, long-lived Mixed tech stack
    67. 67. Smelly!
    68. 68. Pave!
    69. 69. Smelly!
    70. 70. Two database hits!
    71. 71. Pave!
    72. 72. More domain driven
    73. 73. Most common, most offending! • • • • • • • • Incorrect responsibility-split across layers Confusing or inconsistent module structure Missing Dependency Injection Abused Dependency Injection No componentization Over-componentization Rewrites: big-bang, either-or, long-lived Mixed tech stack
    74. 74. Smelly!
    75. 75. Field-based injection
    76. 76. How to inject the mock?
    77. 77. Pave!
    78. 78. A B C Spring IoC D
    79. 79. A B C Spring IoC D E
    80. 80. A B C E Spring IoC D
    81. 81. A B C E Spring IoC D Is E really “cross-cutting” or is it just too easy to inject?
    82. 82. A High coupling B C E Spring IoC D Smelly!
    83. 83. A B C E Spring IoC D Solution?
    84. 84. A B C D E Pave! Spring IoC
    85. 85. Deployment smells
    86. 86. Most common, most offending! • • • • • • Branching based on release / feature / team Dependencies not version controlled Database changes not version controlled Deployment scripts not version controlled Shared non-isolated environments Infrastructure access highly restricted
    87. 87. Most common, most offending! • • • • • • Branching based on release / feature / team Dependencies not version controlled Database changes not version controlled Deployment scripts not version controlled Shared non-isolated environments Infrastructure access highly restricted
    88. 88. Smelly! http://martinfowler.com/bliki/FeatureBranch.html
    89. 89. Pave! http://martinfowler.com/bliki/FeatureToggle.html http://paulhammant.com/blog/branch_by_abstraction.html
    90. 90. Most common, most offending! • • • • • • Branching based on release / feature / team Dependencies not version controlled Database changes not version controlled Deployment scripts not version controlled Shared non-isolated environments Infrastructure access highly restricted
    91. 91. Pave! Dump current schema DDL Introduce a tool like Liquibase/ dbdeploy & commit initial DDL script Similarly for DML http://www.liquibase.org http://dbdeploy.com Further changes made only via Liquibase/ dbdeploy scripts Test the Liquibase/ dbdeploy scripts Commit the Liquibase/ dbdeploy scripts
    92. 92. Most common, most offending! • • • • • • Branching based on release / feature / team Dependencies not version controlled Database changes not version controlled Deployment scripts not version controlled Shared non-isolated environments Infrastructure access highly restricted
    93. 93. Pave! Automate deployment steps with bash scripts Commit the scripts into a versioncontrolled repository http://rubygems.org/gems/chef http://rubygems.org/gems/puppet Automate invoking the scripts via a CI tool like Jenkins/Go Build confidence with automated smoke tests Replace scripts with a tool like Chef/ Puppet
    94. 94. Most common, most offending! • • • • • • Branching based on release / feature / team Dependencies not version controlled Database changes not version controlled Deployment scripts not version controlled Shared non-isolated environments Infrastructure access highly restricted
    95. 95. Pave! Identify volatile shared resources Deploy/ install local version of identified resources Create stubs as local version of identified resources Develop against local version of identified resources Regularly update/sync local version of identified resources Test end-toend on a true integrated environment
    96. 96. Paving the Way for Agile Engineering Practices…
    97. 97. Is difficult but doable! Needs some upfront thinking, planning & implementation. Can be done alongside business functionality.
    98. 98. Just be alert & prepared… to pave the way!
    99. 99. www.unicomlearning.com amanking.com king@thoughtworks.com India Agile Week-2013 Organized by UNICOM Trainings & Seminars Pvt. Ltd. contact@unicomlearning.com Example code available at https://github.com/amanking/paving_the_way_talk_companion

    ×