Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Big rewrites without big risks
Flavius Ștef
https://flic.kr/p/9iuMzn
About meI train and coach
people in agile, lean
and leadership
Iterative and
incremental
Images: http://www.yoomee.com/about-agile
Why?
time
risk
time
risk
validate
validate validate validate validate
New skill: story splitting
●
Create-Read-Update-Delete
●
Workflow steps
●
Less usability first
●
etc.
x
x x
x
x
x x
x x x
Splitting
features
is easy
THE PROBLEM OFTHE PROBLEM OF
INCREMENTAL REFACTORINGINCREMENTAL REFACTORING
Sometimes we need a new architecture
●
Go faster
●
Reduce number of bugs
●
Improve an NFR
●
Respond to client demands
●
Re...
IncrementalIncremental
ArchitectureArchitecture
Refactoring?Refactoring?
Agile doesn't apply here!!!
But the questions remain
How do we know
the app still works?
How do we know
how much is done?
How do we know
when we'll fi...
STRATEGIESSTRATEGIES
Sorry, still
no silver bullet
Get creative!Get creative!
1. Fake it till
you make it
Product 1
Desktop (C#)
Windows
Product 2 ~ Product 1
Desktop (C#)
Windows
Product 3
Desktop (C#)
Windows
Front-end platfor...
GUI
(C#)
Middleware
(C#)
RPC Hardware
Manager
(C++)
Packet
Generators
RPC
Old Product
WIN CLIENT TRAFFIC GENERATOR
GUI
(C#)
Middleware
(C#)
RPC Hardware
Manager
(C++)
Packet
Generators
RPC
Step 1. Research (1 Sprint)
TRAFFIC GENERATOR
GU...
Step 2. Make MW run on Linux (2 Sprints)
Middleware
(C#)
LINUX CLIENT
Mono
Web
UI
Step 3. Link web UI with middleware (1 week)
Middleware
(C#)
LINUX CLIENT
Mono
Web
UI Send basic message between the two.
Step 3. Link web UI with middleware (1 week)
Middleware
(C#)
LINUX CLIENT
Mono
Web
UI
C# bindings
exist
PROBLEM:
Java bind...
Step 4. Walking skeleton (2 days)
Middleware
(C#)
LINUX CLIENT
Mono
Web
UI
Old MW
(C#)
Configure
different
scenarios Dump ...
Step 4. Walking skeleton (2 days)
Middleware
(C#)
LINUX CLIENT
Mono
Web
UI
RPC
Old MW
(C#)
Configure
different
scenarios D...
Step 5. Read+write configuration (3 weeks)
Middleware
(C#)
LINUX CLIENT
Mono
Web
UI
RPC
Hardware
Manager
(C++)
Packet
Gene...
Timeline
Research
Make it run on Linux
Walking
Skeleton
Stories for demo version10d
20d
7d
15d
About 1 month
2. I just don't love
you anymorehttps://flic.kr/p/rrHjG
Same product, different team
Middleware
(C#)
Mono
Web
UI
RPC
Hardware
Manager
(C++)
Packet
Generators
RPC
TRAFFIC GENERATO...
Step 1. Analyze dependencies & possible
replacements (2 Weeks)
Hardware
Manager
(C++)
MFC WinAPI
STL Boost
Find substitutes
Step 2. Proof of concept (2 Months)
Hardware
Manager
(C++)
MFC WinAPI
Hack alternatives for:
- (De)Serialization (MFC)
- I...
Step 2. Proof of concept (2 Months)
“Hacked”
Hardware
Manager
STL Boost
Packet
Generators
#ifdef __vm
Implemented ~1% of u...
Step 3. Unit testing (2 Weeks)
CString sut = “foo”; CMyString sut = “foo”;
StringTestvalidate
against
validate
against
Step 4. Performance testing (2 Weeks)
CFile sut; CMyFile sut;
StringPerformanceTest
validate
against
validate
against
for ...
Step 5. Incrementally remove Win dependency
2m 2m 1m
Remove MFC Remove WinAPI Final
testing
Windows Linux
Process
TRUNK
DEV
...1w
Runtests
Runtests
3d
Code
Freeze
Practices:
●
Software buildable and running at all times
●
Pull w...
3. One bite
at a time
https://flic.kr/p/CaNo1
Rewrite #1
4m 7m
Rewrite #2 Beta
Launch
An interface rewrite
2m
Abort!
Rally:
circa
2008
Rally:
circa
2009
What about
the stories
page?
Oh, there
were
changes...
4. Rewrite the
story book
Three Amigos
Dev QA BA
Feature: ________
Scenario:________
Given ________
When ________
Then _________
Scenarios
PROCESSPROCESS
Set goal
Analyze
architecture
Create
backlog
Talk to QA
Pick
refactoring
RefactorTest
Update
backlog
Stop
Done?
YES
Integr...
Analyze
architecture
Create
backlog
Talk to QA
Pick
refactoring
RefactorTest
Update
backlog
Stop
Done?
YES
Integrate
NO
Ad...
Set goal
Create
backlog
Talk to QA
Pick
refactoring
RefactorTest
Update
backlog
Stop
Done?
YES
Integrate
NO
Add tests
if n...
Analyze
architecture
Set goal Talk to QA
Pick
refactoring
RefactorTest
Update
backlog
Stop
Done?
YES
Integrate
NO
Add test...
Create
backlog
Analyze
architecture
Set goal
Pick
refactoring
RefactorTest
Update
backlog
Stop
Done?
YES
Integrate
NO
Add ...
Stop
YES
Talk to QA
Create
backlog
Analyze
architecture
Set goal
Pick
refactoring
RefactorTest
Update
backlog
Done?
Integr...
Goal
Prerequisite Prerequisite
Prerequisite Prerequisite Prerequisite
The Mikado Method
Mikado Method
Move service
from Windows
to Linux
Fix Win API
compiler errs
Fix MFC
compiler errs
Fix CString
compiler errs...
If you need some guidance selecting the
refactoring
http://www.sigs.de/download/oop_08/Stal%20Mi3-4.pdf+ Michael Stal: Arc...
Michael Stal: source of architecture refactorings
●
Rename Entities
●
Remove Duplicates
●
Introduce Abstraction
Hierarchie...
CONCLUSIONCONCLUSION
It's hard, but it can be done
Chunk the problem down
Encapsulate, stub, simulate
Work incrementally
Run tests
Validate aga...
THANKS!
Flavius Ștef
Twitter: @flaviusstef
Slides: slideshare.net/fstef
www.mozaicworks.com/blog/
Upcoming SlideShare
Loading in …5
×

Flavius Ștef: Big Rewrites Without Big Risks at I T.A.K.E. Unconference

263 views

Published on

Flavius Ștef: Big Rewrites Without Big Risks at I T.A.K.E. Unconference

Published in: Software
  • Be the first to comment

  • Be the first to like this

Flavius Ștef: Big Rewrites Without Big Risks at I T.A.K.E. Unconference

  1. 1. Big rewrites without big risks Flavius Ștef https://flic.kr/p/9iuMzn
  2. 2. About meI train and coach people in agile, lean and leadership
  3. 3. Iterative and incremental Images: http://www.yoomee.com/about-agile
  4. 4. Why? time risk time risk validate validate validate validate validate
  5. 5. New skill: story splitting ● Create-Read-Update-Delete ● Workflow steps ● Less usability first ● etc.
  6. 6. x x x x x x x x x x Splitting features is easy
  7. 7. THE PROBLEM OFTHE PROBLEM OF INCREMENTAL REFACTORINGINCREMENTAL REFACTORING
  8. 8. Sometimes we need a new architecture ● Go faster ● Reduce number of bugs ● Improve an NFR ● Respond to client demands ● Respond to market (ex: cloud, mobile, web)
  9. 9. IncrementalIncremental ArchitectureArchitecture Refactoring?Refactoring?
  10. 10. Agile doesn't apply here!!!
  11. 11. But the questions remain How do we know the app still works? How do we know how much is done? How do we know when we'll finish?
  12. 12. STRATEGIESSTRATEGIES
  13. 13. Sorry, still no silver bullet Get creative!Get creative!
  14. 14. 1. Fake it till you make it
  15. 15. Product 1 Desktop (C#) Windows Product 2 ~ Product 1 Desktop (C#) Windows Product 3 Desktop (C#) Windows Front-end platform Java, JS Awesome NextGen Product Linux-based Web UI (Java, JS)
  16. 16. GUI (C#) Middleware (C#) RPC Hardware Manager (C++) Packet Generators RPC Old Product WIN CLIENT TRAFFIC GENERATOR
  17. 17. GUI (C#) Middleware (C#) RPC Hardware Manager (C++) Packet Generators RPC Step 1. Research (1 Sprint) TRAFFIC GENERATOR GUI (C#) Middleware (C#) RPC Hardware Manager (C++) Packet Generators RPC TRAFFIC GENERATOR GUI (C#) Middleware (C#) RPC Hardware Manager (C++) Packet Generators RPC TRAFFIC GENERATOR WIN CLIENT WIN CLIENT WIN CLIENT
  18. 18. Step 2. Make MW run on Linux (2 Sprints) Middleware (C#) LINUX CLIENT Mono Web UI
  19. 19. Step 3. Link web UI with middleware (1 week) Middleware (C#) LINUX CLIENT Mono Web UI Send basic message between the two.
  20. 20. Step 3. Link web UI with middleware (1 week) Middleware (C#) LINUX CLIENT Mono Web UI C# bindings exist PROBLEM: Java bindings don't exist RPC expected
  21. 21. Step 4. Walking skeleton (2 days) Middleware (C#) LINUX CLIENT Mono Web UI Old MW (C#) Configure different scenarios Dump to disk Hack: load dump Hardware Manager (C++) Packet Generators RPC TRAFFIC GENERATOR x Start Conf. #: 3 Google Chrome OK!
  22. 22. Step 4. Walking skeleton (2 days) Middleware (C#) LINUX CLIENT Mono Web UI RPC Old MW (C#) Configure different scenarios Dump to disk Hack: load dump Hardware Manager (C++) Packet Generators RPC TRAFFIC GENERATOR x Start Conf. #: 3 Google Chrome
  23. 23. Step 5. Read+write configuration (3 weeks) Middleware (C#) LINUX CLIENT Mono Web UI RPC Hardware Manager (C++) Packet Generators RPC TRAFFIC GENERATOR RPC endpoint in C# existed in old product. New product built Java RPC incrementally. Read: How many NICs in the configuration? Read: What are their Ips? Write: Set IP of NIC #4 Write: Add a machine to configuration Read: Another statistic ... B A C K L O G
  24. 24. Timeline Research Make it run on Linux Walking Skeleton Stories for demo version10d 20d 7d 15d About 1 month
  25. 25. 2. I just don't love you anymorehttps://flic.kr/p/rrHjG
  26. 26. Same product, different team Middleware (C#) Mono Web UI RPC Hardware Manager (C++) Packet Generators RPC TRAFFIC GENERATORLINUX CLIENT
  27. 27. Step 1. Analyze dependencies & possible replacements (2 Weeks) Hardware Manager (C++) MFC WinAPI STL Boost Find substitutes
  28. 28. Step 2. Proof of concept (2 Months) Hardware Manager (C++) MFC WinAPI Hack alternatives for: - (De)Serialization (MFC) - IPC (WinAPI) - … STL Boost CString → CMyString CArray → CMyArray
  29. 29. Step 2. Proof of concept (2 Months) “Hacked” Hardware Manager STL Boost Packet Generators #ifdef __vm Implemented ~1% of use cases - Select only one HW card - Comment out other code
  30. 30. Step 3. Unit testing (2 Weeks) CString sut = “foo”; CMyString sut = “foo”; StringTestvalidate against validate against
  31. 31. Step 4. Performance testing (2 Weeks) CFile sut; CMyFile sut; StringPerformanceTest validate against validate against for (i=0; i<20000; i++) CFile (MFC) 20x faster than CMyFile (Boost)
  32. 32. Step 5. Incrementally remove Win dependency 2m 2m 1m Remove MFC Remove WinAPI Final testing Windows Linux
  33. 33. Process TRUNK DEV ...1w Runtests Runtests 3d Code Freeze Practices: ● Software buildable and running at all times ● Pull weekly from trunk ● Run regression (10.000+ tests) every 3 days ● Continuous integration (team level)
  34. 34. 3. One bite at a time https://flic.kr/p/CaNo1
  35. 35. Rewrite #1 4m 7m Rewrite #2 Beta Launch An interface rewrite 2m Abort!
  36. 36. Rally: circa 2008
  37. 37. Rally: circa 2009
  38. 38. What about the stories page?
  39. 39. Oh, there were changes...
  40. 40. 4. Rewrite the story book
  41. 41. Three Amigos Dev QA BA Feature: ________ Scenario:________ Given ________ When ________ Then _________ Scenarios
  42. 42. PROCESSPROCESS
  43. 43. Set goal Analyze architecture Create backlog Talk to QA Pick refactoring RefactorTest Update backlog Stop Done? YES Integrate NO Add tests if needed
  44. 44. Analyze architecture Create backlog Talk to QA Pick refactoring RefactorTest Update backlog Stop Done? YES Integrate NO Add tests if needed Business “Switch database vendors” “Implement new features faster” Or Technical “Support 3000 concurrent connections” “Centralize security controls” Set goal
  45. 45. Set goal Create backlog Talk to QA Pick refactoring RefactorTest Update backlog Stop Done? YES Integrate NO Add tests if needed SWOT Analysis (Strengths, Weaknesses, Opportunities, Threats) - What do we keep? - What do we drop? - What do we improve? Analyze architecture
  46. 46. Analyze architecture Set goal Talk to QA Pick refactoring RefactorTest Update backlog Stop Done? YES Integrate NO Add tests if needed Architecture Epics “Remove MFC” “Move DB code from JSPs” Create backlog
  47. 47. Create backlog Analyze architecture Set goal Pick refactoring RefactorTest Update backlog Stop Done? YES Integrate NO Add tests if needed What is the testing strategy? Automation vs. exploratory How often Make sure testers are available Talk to QA
  48. 48. Stop YES Talk to QA Create backlog Analyze architecture Set goal Pick refactoring RefactorTest Update backlog Done? Integrate NO Add tests if needed Mikado Method
  49. 49. Goal Prerequisite Prerequisite Prerequisite Prerequisite Prerequisite The Mikado Method
  50. 50. Mikado Method Move service from Windows to Linux Fix Win API compiler errs Fix MFC compiler errs Fix CString compiler errs Write CMyString Replace CString invocations
  51. 51. If you need some guidance selecting the refactoring http://www.sigs.de/download/oop_08/Stal%20Mi3-4.pdf+ Michael Stal: Architecture Refactoring Catalog
  52. 52. Michael Stal: source of architecture refactorings ● Rename Entities ● Remove Duplicates ● Introduce Abstraction Hierarchies ● Remove Unnecessary Abstractions ● Substitute Mediation with Adaptation ● Break Dependency Cycles ● Inject Dependencies ● Insert Transparency Layer ● Reduce Dependencies with Facades ● Merge Subsystems ● Split Subsystems ● Enforce Strict Layering ● Move Entities ● Add Strategies ● Enforce Symmetry ● Extract Interface ● Enforce Contract ● Provide Extension Interfaces ● Substitute Inheritance with Delegation ● Provide Interoperability Layers ● Aspectify ● Integrate DSLs ● Add Uniform Supp. to Runtime Aspects ● Add Configuration Subsystem ● Introduce the Open/Close Principle ● Optimize with Caching ● Replace Singleton ● Separate Synchronous and Asynchronous Processing ● Replace Remote Methods with Messages ● Add Object Manager ● Change Unidirectional Association to Bidirectional
  53. 53. CONCLUSIONCONCLUSION
  54. 54. It's hard, but it can be done Chunk the problem down Encapsulate, stub, simulate Work incrementally Run tests Validate against the goal SUMMARY
  55. 55. THANKS! Flavius Ștef Twitter: @flaviusstef Slides: slideshare.net/fstef www.mozaicworks.com/blog/

×