refactoring for software architecture smells - international workshop on refactoring - sept 2016

36
Refactoring for Software Architecture Smells International Workshop on Refactoring Singapore, Sept. 4 2016 Ganesh Samarthyam CodeOps Technologies [email protected] www.codeops.tech Refactoring for Software Architecture Smells

Upload: ganesh-samarthyam

Post on 16-Apr-2017

227 views

Category:

Software


5 download

TRANSCRIPT

Page 1: Refactoring for Software Architecture Smells - International Workshop on Refactoring - Sept 2016

Refactoring for Software Architecture Smells

International Workshop on Refactoring Singapore, Sept. 4 2016

Ganesh Samarthyam CodeOps [email protected]

www.codeops.tech

Refactoring for Software Architecture Smells

Page 2: Refactoring for Software Architecture Smells - International Workshop on Refactoring - Sept 2016

“Functional Chaos!”

Page 3: Refactoring for Software Architecture Smells - International Workshop on Refactoring - Sept 2016

City Metaphor for Refactoring

“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.

Page 4: Refactoring for Software Architecture Smells - International Workshop on Refactoring - Sept 2016

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();

}

Page 5: Refactoring for Software Architecture Smells - International Workshop on Refactoring - Sept 2016

Refactoring design smells

Page 6: Refactoring for Software Architecture Smells - International Workshop on Refactoring - Sept 2016

Earlier (relatively) mature work

Page 7: Refactoring for Software Architecture Smells - International Workshop on Refactoring - Sept 2016

Tangles in JDK

Page 8: Refactoring for Software Architecture Smells - International Workshop on Refactoring - Sept 2016

Refactoring for Architecture Smells

Remove one of the dependencies

Change dependency direction Move one of the dependencies

Page 9: Refactoring for Software Architecture Smells - International Workshop on Refactoring - Sept 2016

Architectural refactoring

Page 10: Refactoring for Software Architecture Smells - International Workshop on Refactoring - Sept 2016

Architectural refactoring …

Page 11: Refactoring for Software Architecture Smells - International Workshop on Refactoring - Sept 2016

Key reasons for architecture refactoring

Business needs

Increase feature velocity

Address architecture

decay

Realizing NFRs

Modernize

Reduce costs

Page 12: Refactoring for Software Architecture Smells - International Workshop on Refactoring - Sept 2016

Increase feature velocity

Page 13: Refactoring for Software Architecture Smells - International Workshop on Refactoring - Sept 2016

Reduce costs

Page 14: Refactoring for Software Architecture Smells - International Workshop on Refactoring - Sept 2016

Address architecture decay

Page 15: Refactoring for Software Architecture Smells - International Workshop on Refactoring - Sept 2016

Modernize

Page 16: Refactoring for Software Architecture Smells - International Workshop on Refactoring - Sept 2016

Refactoring Windows

Page 17: Refactoring for Software Architecture Smells - International Workshop on Refactoring - Sept 2016

Refactoring Windows

Page 18: Refactoring for Software Architecture Smells - International Workshop on Refactoring - Sept 2016

Refactoring Windows

“A large number of dependencies at the module level could be reduced and optimized to: * make modular reasoning of the system more efficient* maximize parallel development efficiency* avoid unwanted parallel change interference* selectively rebuild and retest subsystems effectively”

Refactoring performed to reduce and optimize dependencies - by creating and enforcing layering

Source: Kim, Miryung, Thomas Zimmermann, and Nachiappan Nagappan. "An Empirical Study of RefactoringChallenges and Benefits at Microsoft." IEEE Transactions on Software Engineering 7 (2014): 1-1.

Page 19: Refactoring for Software Architecture Smells - International Workshop on Refactoring - Sept 2016

Refactoring Windows: Significant Characteristics

Refactoring decisions made after substantial analysis of existing dependency structure

Refactoring effort was centralized and top down with designated team for refactoring

Use of custom refactoring tools (MaX) and processes (quality gate check)

Source: Kim, Miryung, Thomas Zimmermann, and Nachiappan Nagappan. "An Empirical Study of RefactoringChallenges and Benefits at Microsoft." IEEE Transactions on Software Engineering 7 (2014): 1-1.

Page 20: Refactoring for Software Architecture Smells - International Workshop on Refactoring - Sept 2016

Refactoring Windows

Source: Kim, Miryung, Thomas Zimmermann, and Nachiappan Nagappan. "An Empirical Study of RefactoringChallenges and Benefits at Microsoft." IEEE Transactions on Software Engineering 7 (2014): 1-1.

Page 21: Refactoring for Software Architecture Smells - International Workshop on Refactoring - Sept 2016

Refactoring JDK

Page 22: Refactoring for Software Architecture Smells - International Workshop on Refactoring - Sept 2016

Tangles in JDK

Page 23: Refactoring for Software Architecture Smells - International Workshop on Refactoring - Sept 2016

Copyright © 2015, Oracle and/or its affiliates. All rights reserved

Page 24: Refactoring for Software Architecture Smells - International Workshop on Refactoring - Sept 2016

Copyright © 2015, Oracle and/or its affiliates. All rights reserved

Page 25: Refactoring for Software Architecture Smells - International Workshop on Refactoring - Sept 2016

Copyright © 2015, Oracle and/or its affiliates. All rights reserved

Page 26: Refactoring for Software Architecture Smells - International Workshop on Refactoring - Sept 2016

Project Jigsaw in Java 9

Modularize JDK & JRE

Hide platform internal details such as sun.misc

Provide a module system for Java developers

Page 27: Refactoring for Software Architecture Smells - International Workshop on Refactoring - Sept 2016

Related work

"architectural bad smells" "architecture smells"

"anti-patterns" "architecturally-relevant code smells"

"contra-indicated patterns" "architectural defects"

"[accidental] architectural anti-patterns"

Page 28: Refactoring for Software Architecture Smells - International Workshop on Refactoring - Sept 2016

Related work

"high-impact refactorings" "architecture transformation"

"large refactorings" "architecture-oriented refactorings"

Page 29: Refactoring for Software Architecture Smells - International Workshop on Refactoring - Sept 2016

Related work

• Catalog architecture smells or refactorings • Architecture smell catalog by Garcia et al. • Catalog of smells and refactoring by M. Stal (2007)

• Specific categories of architecture smells • Ouni et al. “web service antipatterns" in the context of Service Oriented Architectures

• Rama et al. discusses “modularity smells”

Page 30: Refactoring for Software Architecture Smells - International Workshop on Refactoring - Sept 2016

Related work

•Architecture refactoring case studies performed on industrial projects

• Exploratory studies on emerging topics in architecture refactoring

• Architecture refactoring in software product lines • Architecture technical debt

• …

Page 31: Refactoring for Software Architecture Smells - International Workshop on Refactoring - Sept 2016

Potential Research Directions

Catalog of architecture smells and refactoring

Tool support

Economics of architecture refactoring (quantifying

architecture technical debt)

Refactoring and emerging architecture styles

and patterns

Page 32: Refactoring for Software Architecture Smells - International Workshop on Refactoring - Sept 2016

Example: Lack of tool support

Unlike code refactoring, most architectural refactoring is manual

due to lack of tool support!

Page 33: Refactoring for Software Architecture Smells - International Workshop on Refactoring - Sept 2016

Automated code smell detection and refactoring

Page 34: Refactoring for Software Architecture Smells - International Workshop on Refactoring - Sept 2016
Page 35: Refactoring for Software Architecture Smells - International Workshop on Refactoring - Sept 2016