SlideShare a Scribd company logo
Refactoring for Software Architecture Smells: 
Managing Architecture Debt
Ganesh Samarthyam, Corporate Trainer and Author
www.designsmells.com
Agenda
• Introduction &
motivation
• What is architectural
refactoring?
• Case studies in
architectural refactoring
• Challenges in architecture
refactoring
Why care about this topic?
City metaphor
“Cities grow, cities evolve, cities
have parts that simply die while other
parts flourish; each city has to be
renewed in order to meet the needs of its
populace… Software-intensive systems
are like that. They grow, they evolve,
sometimes they wither away, and
sometimes they flourish…”
Grady Booch in the foreword for “Refactoring for Software Design Smells: Managing Technical Debt”, Girish Suryanarayana, Ganesh Samarthyam, Tushar Sharma, Morgan Kaufmann/Elsevier, 2014.
“Infrastructure debt”!
What is technical debt?
When,&due&to&constraints,&I&design&
quickly&and&dirty,&my&project&is&
loaded&with&technical&debt&
What is architecture debt?
…
Architecture)
debt)
Architecture)
smells)
Architecture)
viola2ons)
Design)debt)
Design)smells)
Viola2ons)of)
design)rules)
Test)debt)
Lack)of)tests)
Inadequate)test)
coverage)
Code)debt)
Sta2c)analysis)
tool)viola2ons)
Inconsistent)
coding)style)
Refactoring a city?
Is this refactoring?
Architecture vs. agility?
Key reasons for architecture
refactoring
Business
needs
Increase
feature
velocity
Address
architecture
decay
Realizing
NFRs
Modernize
Reduce costs
Increase feature velocity
Bubbles don’t
crash!
Address NFRs
Reduce costs
Address architecture decay
Modernize and get more
profitable
What if I don’t do
architecture refactoring?
Agenda
• Introduction & motivation
• What is architectural
refactoring?
• Case studies in
architectural refactoring
• Challenges in architecture
refactoring
Code refactoring
margin = c.getMargin();
if (c instanceof AbstractButton) {
margin = ((AbstractButton)c).getMargin();
} else if (c instanceof JToolBar) {
margin = ((JToolBar)c).getMargin();
} else if (c instanceof JTextComponent) {
margin = ((JTextComponent)c).getMargin();
}
Example: Refactoring for
design smells
Earlier (relatively) mature
work
Natural extension: Refactoring
for architectural smells
The$red$lines$in$this$
dependency$diagram$shows$
circular$dependencies$
Example: Architectural
refactoring
Remove one of the dependencies
Change dependency direction
Move one of the dependencies
Illustration: Refactoring for
layering smells
Layer&A&
Layer&B&
Layer&C&
Layer&A&
Layer&B&
Layer&C&
Open layering Closed layering
Refactoring “missing layer”
smell
This	
  smell	
  arises	
  when	
  one	
  of	
  the	
  
layers	
  is	
  missing	
  (or	
  when	
  no	
  
layers	
  are	
  provided	
  at	
  all	
  when	
  
needed)	
  
Layer&A&
Layer&B&
DAL&
Layer&A&
Layer&B&
Refactoring “violated
layering” smell
Layer&A&
Layer&B&
Layer&C&
Layer&A&
Layer&B&
Layer&C&
Architecture)
smells)
Duplicate)
design)
ar3facts)
Unclear)role)
of)en33es)
Inexpressive)
or)complex)
architecture)
Everything)
centralized)
Over>generic)
design)
Asymmetric)
structure)or)
behavior)
Dependency)
cycles)
Unnecessary)
dependencies)
Implicit)
dependencies)
Conway’ law
The structure of a
system mirrors the
structure of the
organisation that
designed it
“Any organization that designs a system (defined broadly) will produce a design whose structure is a copy of the organization's communication structure.”
Melvin E. Conway. "How do committees invent?", Datamation, 14(4):28–31, April 1968
Structure of a compiler team
Front-end team
Back-end team
Front-end team
Back-end team
Platform I Platform 2
Component interfaces vs.
team boundaries
“Don't publish
interfaces prematurely.
Modify your code
ownership policies to
smooth refactoring.”
– Martin Fowler (Refactoring,
Addison-Wesley, 1999)
A guideline for
code refactoring
A guideline for
architecture refactoring
“Respect code
ownership and retain
team boundaries to
ensure smooth
refactoring.”
Code refactoring Architecture refactoring
A module-level or class-level concern
A system level concern that cuts across
modules or sub-systems
Impact of refactoring is within a team Impact of refactoring is often across teams
Typically performed to improve the internal
structure of the code
Performed for various reasons: cost, legal,
security, performance, availability, …
Management buy-in typically not required Management buy-in is typically required
Upfront planning is typically (relatively)
limited
Upfront planning and co-ordination
(sometimes between teams) is often required
Unit tests are important to ensure that
“behaviour is preserved”
Unit tests, integration tests, system tests,
NFR tests, … are required
Risk of breaking the working software is
relatively low
Risk of breaking the working software is
relatively high
Real-world analogy:
“fixing potholes”
Real-world analogy:
“metro construction”
Agenda
• Introduction & motivation
• What is architectural
refactoring?
• Case studies in
architectural refactoring
• Challenges in architecture
refactoring
Architecture represents the significant
design decisions that shape a
system, where significant is
measured by cost of change.
- Grady Booch (2006)
NFRs
Constraints
TechnologyCross-cutting
concerns
Others
(e.g.: overall
structure)
Dimensions of ADs
Case study: Skipping
security layer
Case study: Platform L & F
The example of “how much effort &
time” it requires to provide the feature
to change the color of a button!
Case study: OSS in a
product
COTS
(Commercial Off The Shelf)
FOSS
(Free and Open Source Software)
Make
Buy
/ Reuse
Proven
Modern
/ Latest
Cross-cutting concerns
Error/Exception handling
ConcurrencyPersistence
Event handling
Interaction and presentation
Source: SWEBOK v3
Case study: Using
Structured EH
Source: https://msdn.microsoft.com/en-us/library/windows/desktop/ms681409(v=vs.85).aspx
Structured Exception
Handling in VC++
Standard Exception
Handling supported in
modern C++ compilers
bool SafeDiv(Number dividend, Number divisor,
Number &result) {
try {
result = dividend / divisor;
} catch(Number::divide_by_zero ex) {
return false;
}
return true;
}
BOOL SafeDiv(Number dividend, Number divisor,
Number &result) {
__try {
result = dividend / divisor;
} __catch(GetExceptionCode() == EXCEPTION_INT_DIVIDE_BY_ZERO
? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) {
return FALSE;
}
return TRUE;
}
Handling persistence
Oracle DB
Compo
nent-1
Compo
nent-2
Compo
nent-N
[establish
connection, SQL
queries, close
connection…]
No clone within a
component, but
duplication of code
across components
How to support
different databases?
[establish
connection, SQL
queries, close
connection…]
[establish
connection, SQL
queries, close
connection…]
Handling persistence
Compo
nent-1
Compo
nent-2
Compo
nent-N
Service layer /
DAL
Agenda
• Introduction & motivation
• What is architectural
refactoring?
• Case studies in
architectural refactoring
• Challenges in
architecture refactoring
Key challenges in
architecture refactoring
Getting
management
buy-in
Fear of breaking
working software
Lack of tool
support
Merge process
problems
How to get management
buy-in?
logger.severe(“details”)
errlog.log(“details”)logger.error(“details”)
System.err.println(“details”)
Since ROI (Return On Investment)
is not clear, how to get
management buy-in for this
architectural refactoring?
Log4j java.util.logging custom log library SOPs
Dealing with the fear of
“breaking the working software”
Module 1 Module 2 Module N
How to validate architectural
refactoring changes?
Currently through architecture, design, and code reviews
+ running system, integration, and unit tests =>
Can still break the working software!
Lack of tool support
Unlike code refactoring, most
architectural refactoring is manual
due to lack of tool support!
Automated code smell
detection and refactoring
Lack of tool support
Lack of automated support for
architectural refactoring
Inadequate support for
detecting smells
Limited support for
quantifying architectural debt
…
Merge process problems
Challenge I: How to handle merges from
distributed teams?
Challenge II: How to merge changes from
long-running branches?
Illustration: How to co-ordinate
changes in distributed teams?
Module 1
Country 1
Module 2
Country 2
Module N
Country N
How do co-ordinate refactoring when
code ownership is distributed with
teams across the globe? (more
pronounced in refactoring situations)
Illustration: How to deal with
changes in long-running branches?
Module 1
Module 2
Module N
6 months
Key take-aways
Architecture smells and violations contribute to technical debt (known
as architecture debt)
Architecture refactoring plays a key role in enhancing agility and
enables business success
Code refactoring and architecture refactoring are altogether different
ballgames
Architecture smells can be viewed in terms of Architectural Decisions
(ADs)
Refactoring for replaying architecture debt is an emerging topic
Image credits
• http://sustainablecitiescollective.com/pratik-dave/244831/bangalore-exclusive-metro-india-having-profit-making-public-
transport-system
• http://www.medsoftwaresys.com/mss/wp-content/uploads/2012/04/reengineering.png
• http://topnews.in/files/Bangalore-Metro-Rail-Corporation-Ltd.jpg
• https://www.itdp.org/wp-content/uploads/2014/07/Chennai-Rendering.jpg
• http://www.vectors4all.net/preview/database-clip-art.jpg
• http://static.planetminecraft.com/files/resource_media/screenshot/1231/Windows-Vs-Mac_3072108.jpg
• http://manuel.midoriparadise.com/public_html/icons/linux-icon.png
• http://mortalpowers.com/posse/1280x1280/0DSC03205.JPG
• http://images.clipartpanda.com/server-computer-clipart-1216179635943364667jcartier_central_computer_1.svg.hi.png
• http://images.clipartpanda.com/cloud-icon-png-clouds.png
• http://www.clipartbest.com/cliparts/dc6/M5L/dc6M5LBc9.jpeg
• http://cdn.ttgtmedia.com/rms/computerweekly/refactor.jpg
• http://yellowairplane.com/Adventures/Falkland_Islands_War_Guestbook/Falkands_War_Malvinas_War_Photos/
Jet_Fighter_Mirage_2000_Takeoff_Argentina.jpg
Refactoring for Software Architecture Smells

More Related Content

PDF
Business analysis compass mapping to the iiba babok v2
PPT
Creating a work breakdown structure with microsoft project
PDF
Scenarios_and_Architecture_SkillsMatter_April_2022.pdf
PDF
Resolving technical debt in software architecture
PPTX
Design engineering
PPTX
Docker Kubernetes Istio
PDF
Agile Architecture
PPTX
The Power of Azure DevOps
Business analysis compass mapping to the iiba babok v2
Creating a work breakdown structure with microsoft project
Scenarios_and_Architecture_SkillsMatter_April_2022.pdf
Resolving technical debt in software architecture
Design engineering
Docker Kubernetes Istio
Agile Architecture
The Power of Azure DevOps

What's hot (20)

PPT
Agile Engineering Practices
PDF
Practical Microservice Architecture (edition 2022).pdf
PPTX
Interview preparation full_stack_java
PPTX
Getting Started with Architecture Decision Records
PPTX
BIM Level of Development Explained | LOD 100 200 300 400 500
PPTX
The Power of Azure DevOps
PPTX
Achieving Elite and High Performance DevOps Using DORA Metrics
PDF
Secure Your Code Implement DevSecOps in Azure
PDF
Escaping Dependency Hell: A deep dive into Gradle's dependency management fea...
PDF
JPA Week3 Entity Mapping / Hexagonal Architecture
PDF
Microservices, Containers, Docker and a Cloud-Native Architecture in the Midd...
PPT
Quality Management in Software Engineering SE24
PDF
IRJET- Comparative Study on Analysis and Design of Regular Configuration of B...
PPTX
Azure DevOps Best Practices Webinar
PDF
Naviswork - Self study work.pdf
DOCX
MS Project
PPTX
Azure DevOps
PDF
Infrastructure as Code
PDF
BIM Standards( for BIM engineers and Coordinators
PDF
DevSecOps and the CI/CD Pipeline
Agile Engineering Practices
Practical Microservice Architecture (edition 2022).pdf
Interview preparation full_stack_java
Getting Started with Architecture Decision Records
BIM Level of Development Explained | LOD 100 200 300 400 500
The Power of Azure DevOps
Achieving Elite and High Performance DevOps Using DORA Metrics
Secure Your Code Implement DevSecOps in Azure
Escaping Dependency Hell: A deep dive into Gradle's dependency management fea...
JPA Week3 Entity Mapping / Hexagonal Architecture
Microservices, Containers, Docker and a Cloud-Native Architecture in the Midd...
Quality Management in Software Engineering SE24
IRJET- Comparative Study on Analysis and Design of Regular Configuration of B...
Azure DevOps Best Practices Webinar
Naviswork - Self study work.pdf
MS Project
Azure DevOps
Infrastructure as Code
BIM Standards( for BIM engineers and Coordinators
DevSecOps and the CI/CD Pipeline
Ad

Viewers also liked (20)

PDF
Architecture refactoring - accelerating business success
PPTX
Software Architecture and Agile: Is it Unrequited Love?
PPT
The Use of Agile Methods by the Entrepreneur
PDF
Crushed by technical debt
PPTX
Software architecture also needs agile
PDF
Composable Software Architecture with Spring
PPTX
Software Architecture taxonomies - Integration patterns
PPTX
Software architecture
PDF
Scrum Bangalore 18th Meetup - October 15, 2016 - Agile Architecture - Deepak ...
PPTX
Basics of Software Architecture for .NET Developers
PPT
User Driven Software Architecture
PPT
Roof notes
PPTX
Software Architecture Patterns
PPT
Lecture 1 site analysis
PDF
Software Architecture: Design Decisions
PDF
Principles of software architecture design
PPTX
Software Architecture vs design
PDF
Software Architecture: views and viewpoints
PPTX
Fundamentals Of Software Architecture
PDF
Urban design analysis, Circulation, Architecture, London, Redevelopment studies
Architecture refactoring - accelerating business success
Software Architecture and Agile: Is it Unrequited Love?
The Use of Agile Methods by the Entrepreneur
Crushed by technical debt
Software architecture also needs agile
Composable Software Architecture with Spring
Software Architecture taxonomies - Integration patterns
Software architecture
Scrum Bangalore 18th Meetup - October 15, 2016 - Agile Architecture - Deepak ...
Basics of Software Architecture for .NET Developers
User Driven Software Architecture
Roof notes
Software Architecture Patterns
Lecture 1 site analysis
Software Architecture: Design Decisions
Principles of software architecture design
Software Architecture vs design
Software Architecture: views and viewpoints
Fundamentals Of Software Architecture
Urban design analysis, Circulation, Architecture, London, Redevelopment studies
Ad

Similar to Refactoring for Software Architecture Smells (20)

PDF
ASAS 2014 - Simon Brown
PPTX
Thoughts On Architecting V4 2
PPTX
Restructuring Technical Debt - A Software and System Quality Approach
PDF
META for Microservices: Getting your enterprise migration in motion
PPT
Infrastructure code in Agile software development
PPT
PDF
The Modern Software Architect
PPT
HelloChapter6fgfg-Artifacts__of_theProcess.ppt
PPT
Design concepts and principle,
PPTX
System engineering
PPTX
L02 Architecture
PDF
Simon Brown: Software Architecture as Code at I T.A.K.E. Unconference 2015
PPTX
Software Architecture and Design CS.pptx
PPT
Technical Architecture
PDF
Modern Agile Software Architecture
PPT
Reference Architecture
PDF
Site-Reliability-Engineering-v2[6241].pdf
PPS
Management of Complexity in System Design of Large IT Solutions
PPT
A Software Factory Integrating Rational & WebSphere Tools
PPTX
Agile ppt final
ASAS 2014 - Simon Brown
Thoughts On Architecting V4 2
Restructuring Technical Debt - A Software and System Quality Approach
META for Microservices: Getting your enterprise migration in motion
Infrastructure code in Agile software development
The Modern Software Architect
HelloChapter6fgfg-Artifacts__of_theProcess.ppt
Design concepts and principle,
System engineering
L02 Architecture
Simon Brown: Software Architecture as Code at I T.A.K.E. Unconference 2015
Software Architecture and Design CS.pptx
Technical Architecture
Modern Agile Software Architecture
Reference Architecture
Site-Reliability-Engineering-v2[6241].pdf
Management of Complexity in System Design of Large IT Solutions
A Software Factory Integrating Rational & WebSphere Tools
Agile ppt final

More from Ganesh Samarthyam (20)

PDF
Wonders of the Sea
PDF
Animals - for kids
PDF
Applying Refactoring Tools in Practice
PDF
CFP - 1st Workshop on “AI Meets Blockchain”
PDF
Great Coding Skills Aren't Enough
PDF
College Project - Java Disassembler - Description
PDF
Coding Guidelines - Crafting Clean Code
PDF
Design Patterns - Compiler Case Study - Hands-on Examples
PDF
Bangalore Container Conference 2017 - Brief Presentation
PDF
Bangalore Container Conference 2017 - Poster
PDF
Software Design in Practice (with Java examples)
PDF
OO Design and Design Patterns in C++
PDF
Bangalore Container Conference 2017 - Sponsorship Deck
PDF
Let's Go: Introduction to Google's Go Programming Language
PPT
Google's Go Programming Language - Introduction
PDF
Java Generics - Quiz Questions
PDF
Java Generics - by Example
PDF
Software Architecture - Quiz Questions
PDF
Docker by Example - Quiz
PDF
Core Java: Best practices and bytecodes quiz
Wonders of the Sea
Animals - for kids
Applying Refactoring Tools in Practice
CFP - 1st Workshop on “AI Meets Blockchain”
Great Coding Skills Aren't Enough
College Project - Java Disassembler - Description
Coding Guidelines - Crafting Clean Code
Design Patterns - Compiler Case Study - Hands-on Examples
Bangalore Container Conference 2017 - Brief Presentation
Bangalore Container Conference 2017 - Poster
Software Design in Practice (with Java examples)
OO Design and Design Patterns in C++
Bangalore Container Conference 2017 - Sponsorship Deck
Let's Go: Introduction to Google's Go Programming Language
Google's Go Programming Language - Introduction
Java Generics - Quiz Questions
Java Generics - by Example
Software Architecture - Quiz Questions
Docker by Example - Quiz
Core Java: Best practices and bytecodes quiz

Recently uploaded (20)

PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PPTX
Online Work Permit System for Fast Permit Processing
PPTX
Materi-Enum-and-Record-Data-Type (1).pptx
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
top salesforce developer skills in 2025.pdf
PPTX
ManageIQ - Sprint 268 Review - Slide Deck
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PPTX
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
PDF
System and Network Administration Chapter 2
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Digital Strategies for Manufacturing Companies
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PPTX
history of c programming in notes for students .pptx
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
PTS Company Brochure 2025 (1).pdf.......
VVF-Customer-Presentation2025-Ver1.9.pptx
Online Work Permit System for Fast Permit Processing
Materi-Enum-and-Record-Data-Type (1).pptx
How Creative Agencies Leverage Project Management Software.pdf
top salesforce developer skills in 2025.pdf
ManageIQ - Sprint 268 Review - Slide Deck
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Wondershare Filmora 15 Crack With Activation Key [2025
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
System and Network Administration Chapter 2
Design an Analysis of Algorithms II-SECS-1021-03
2025 Textile ERP Trends: SAP, Odoo & Oracle
Softaken Excel to vCard Converter Software.pdf
Digital Strategies for Manufacturing Companies
Adobe Illustrator 28.6 Crack My Vision of Vector Design
history of c programming in notes for students .pptx
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Which alternative to Crystal Reports is best for small or large businesses.pdf
PTS Company Brochure 2025 (1).pdf.......

Refactoring for Software Architecture Smells

  • 1. Refactoring for Software Architecture Smells:  Managing Architecture Debt Ganesh Samarthyam, Corporate Trainer and Author www.designsmells.com
  • 2. Agenda • Introduction & motivation • What is architectural refactoring? • Case studies in architectural refactoring • Challenges in architecture refactoring
  • 3. Why care about this topic?
  • 4. City metaphor “Cities grow, cities evolve, cities have parts that simply die while other parts flourish; each city has to be renewed in order to meet the needs of its populace… Software-intensive systems are like that. They grow, they evolve, sometimes they wither away, and sometimes they flourish…” Grady Booch in the foreword for “Refactoring for Software Design Smells: Managing Technical Debt”, Girish Suryanarayana, Ganesh Samarthyam, Tushar Sharma, Morgan Kaufmann/Elsevier, 2014.
  • 6. What is technical debt? When,&due&to&constraints,&I&design& quickly&and&dirty,&my&project&is& loaded&with&technical&debt&
  • 7. What is architecture debt? … Architecture) debt) Architecture) smells) Architecture) viola2ons) Design)debt) Design)smells) Viola2ons)of) design)rules) Test)debt) Lack)of)tests) Inadequate)test) coverage) Code)debt) Sta2c)analysis) tool)viola2ons) Inconsistent) coding)style)
  • 11. Key reasons for architecture refactoring Business needs Increase feature velocity Address architecture decay Realizing NFRs Modernize Reduce costs
  • 16. Modernize and get more profitable
  • 17. What if I don’t do architecture refactoring?
  • 18. Agenda • Introduction & motivation • What is architectural refactoring? • Case studies in architectural refactoring • Challenges in architecture refactoring
  • 19. Code refactoring margin = c.getMargin(); if (c instanceof AbstractButton) { margin = ((AbstractButton)c).getMargin(); } else if (c instanceof JToolBar) { margin = ((JToolBar)c).getMargin(); } else if (c instanceof JTextComponent) { margin = ((JTextComponent)c).getMargin(); }
  • 22. Natural extension: Refactoring for architectural smells The$red$lines$in$this$ dependency$diagram$shows$ circular$dependencies$
  • 23. Example: Architectural refactoring Remove one of the dependencies Change dependency direction Move one of the dependencies
  • 24. Illustration: Refactoring for layering smells Layer&A& Layer&B& Layer&C& Layer&A& Layer&B& Layer&C& Open layering Closed layering
  • 25. Refactoring “missing layer” smell This  smell  arises  when  one  of  the   layers  is  missing  (or  when  no   layers  are  provided  at  all  when   needed)   Layer&A& Layer&B& DAL& Layer&A& Layer&B&
  • 28. Conway’ law The structure of a system mirrors the structure of the organisation that designed it “Any organization that designs a system (defined broadly) will produce a design whose structure is a copy of the organization's communication structure.” Melvin E. Conway. "How do committees invent?", Datamation, 14(4):28–31, April 1968
  • 29. Structure of a compiler team Front-end team Back-end team Front-end team Back-end team Platform I Platform 2
  • 30. Component interfaces vs. team boundaries “Don't publish interfaces prematurely. Modify your code ownership policies to smooth refactoring.” – Martin Fowler (Refactoring, Addison-Wesley, 1999) A guideline for code refactoring A guideline for architecture refactoring “Respect code ownership and retain team boundaries to ensure smooth refactoring.”
  • 31. Code refactoring Architecture refactoring A module-level or class-level concern A system level concern that cuts across modules or sub-systems Impact of refactoring is within a team Impact of refactoring is often across teams Typically performed to improve the internal structure of the code Performed for various reasons: cost, legal, security, performance, availability, … Management buy-in typically not required Management buy-in is typically required Upfront planning is typically (relatively) limited Upfront planning and co-ordination (sometimes between teams) is often required Unit tests are important to ensure that “behaviour is preserved” Unit tests, integration tests, system tests, NFR tests, … are required Risk of breaking the working software is relatively low Risk of breaking the working software is relatively high Real-world analogy: “fixing potholes” Real-world analogy: “metro construction”
  • 32. Agenda • Introduction & motivation • What is architectural refactoring? • Case studies in architectural refactoring • Challenges in architecture refactoring
  • 33. Architecture represents the significant design decisions that shape a system, where significant is measured by cost of change. - Grady Booch (2006)
  • 36. Case study: Platform L & F The example of “how much effort & time” it requires to provide the feature to change the color of a button!
  • 37. Case study: OSS in a product
  • 38. COTS (Commercial Off The Shelf) FOSS (Free and Open Source Software) Make Buy / Reuse Proven Modern / Latest
  • 39. Cross-cutting concerns Error/Exception handling ConcurrencyPersistence Event handling Interaction and presentation Source: SWEBOK v3
  • 40. Case study: Using Structured EH Source: https://msdn.microsoft.com/en-us/library/windows/desktop/ms681409(v=vs.85).aspx Structured Exception Handling in VC++ Standard Exception Handling supported in modern C++ compilers bool SafeDiv(Number dividend, Number divisor, Number &result) { try { result = dividend / divisor; } catch(Number::divide_by_zero ex) { return false; } return true; } BOOL SafeDiv(Number dividend, Number divisor, Number &result) { __try { result = dividend / divisor; } __catch(GetExceptionCode() == EXCEPTION_INT_DIVIDE_BY_ZERO ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) { return FALSE; } return TRUE; }
  • 41. Handling persistence Oracle DB Compo nent-1 Compo nent-2 Compo nent-N [establish connection, SQL queries, close connection…] No clone within a component, but duplication of code across components How to support different databases? [establish connection, SQL queries, close connection…] [establish connection, SQL queries, close connection…]
  • 43. Agenda • Introduction & motivation • What is architectural refactoring? • Case studies in architectural refactoring • Challenges in architecture refactoring
  • 44. Key challenges in architecture refactoring Getting management buy-in Fear of breaking working software Lack of tool support Merge process problems
  • 45. How to get management buy-in? logger.severe(“details”) errlog.log(“details”)logger.error(“details”) System.err.println(“details”) Since ROI (Return On Investment) is not clear, how to get management buy-in for this architectural refactoring? Log4j java.util.logging custom log library SOPs
  • 46. Dealing with the fear of “breaking the working software” Module 1 Module 2 Module N How to validate architectural refactoring changes? Currently through architecture, design, and code reviews + running system, integration, and unit tests => Can still break the working software!
  • 47. Lack of tool support Unlike code refactoring, most architectural refactoring is manual due to lack of tool support!
  • 49. Lack of tool support Lack of automated support for architectural refactoring Inadequate support for detecting smells Limited support for quantifying architectural debt …
  • 50. Merge process problems Challenge I: How to handle merges from distributed teams? Challenge II: How to merge changes from long-running branches?
  • 51. Illustration: How to co-ordinate changes in distributed teams? Module 1 Country 1 Module 2 Country 2 Module N Country N How do co-ordinate refactoring when code ownership is distributed with teams across the globe? (more pronounced in refactoring situations)
  • 52. Illustration: How to deal with changes in long-running branches? Module 1 Module 2 Module N 6 months
  • 53. Key take-aways Architecture smells and violations contribute to technical debt (known as architecture debt) Architecture refactoring plays a key role in enhancing agility and enables business success Code refactoring and architecture refactoring are altogether different ballgames Architecture smells can be viewed in terms of Architectural Decisions (ADs) Refactoring for replaying architecture debt is an emerging topic
  • 54. Image credits • http://sustainablecitiescollective.com/pratik-dave/244831/bangalore-exclusive-metro-india-having-profit-making-public- transport-system • http://www.medsoftwaresys.com/mss/wp-content/uploads/2012/04/reengineering.png • http://topnews.in/files/Bangalore-Metro-Rail-Corporation-Ltd.jpg • https://www.itdp.org/wp-content/uploads/2014/07/Chennai-Rendering.jpg • http://www.vectors4all.net/preview/database-clip-art.jpg • http://static.planetminecraft.com/files/resource_media/screenshot/1231/Windows-Vs-Mac_3072108.jpg • http://manuel.midoriparadise.com/public_html/icons/linux-icon.png • http://mortalpowers.com/posse/1280x1280/0DSC03205.JPG • http://images.clipartpanda.com/server-computer-clipart-1216179635943364667jcartier_central_computer_1.svg.hi.png • http://images.clipartpanda.com/cloud-icon-png-clouds.png • http://www.clipartbest.com/cliparts/dc6/M5L/dc6M5LBc9.jpeg • http://cdn.ttgtmedia.com/rms/computerweekly/refactor.jpg • http://yellowairplane.com/Adventures/Falkland_Islands_War_Guestbook/Falkands_War_Malvinas_War_Photos/ Jet_Fighter_Mirage_2000_Takeoff_Argentina.jpg