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

Post on 16-Apr-2017

227 Views

Category:

Software

5 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Refactoring for Software Architecture Smells

International Workshop on Refactoring Singapore, Sept. 4 2016

Ganesh Samarthyam CodeOps Technologiesganesh@codeops.tech

www.codeops.tech

Refactoring for Software Architecture Smells

“Functional Chaos!”

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.

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

}

Refactoring design smells

Earlier (relatively) mature work

Tangles in JDK

Refactoring for Architecture Smells

Remove one of the dependencies

Change dependency direction Move one of the dependencies

Architectural refactoring

Architectural refactoring …

Key reasons for architecture refactoring

Business needs

Increase feature velocity

Address architecture

decay

Realizing NFRs

Modernize

Reduce costs

Increase feature velocity

Reduce costs

Address architecture decay

Modernize

Refactoring Windows

Refactoring Windows

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.

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.

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.

Refactoring JDK

Tangles in JDK

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

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

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

Project Jigsaw in Java 9

Modularize JDK & JRE

Hide platform internal details such as sun.misc

Provide a module system for Java developers

Related work

"architectural bad smells" "architecture smells"

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

"contra-indicated patterns" "architectural defects"

"[accidental] architectural anti-patterns"

Related work

"high-impact refactorings" "architecture transformation"

"large refactorings" "architecture-oriented refactorings"

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”

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

• …

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

Example: Lack of tool support

Unlike code refactoring, most architectural refactoring is manual

due to lack of tool support!

Automated code smell detection and refactoring

ganesh@codeops.tech @GSamarthyam

www.codeops.tech slideshare.net/sgganesh

+91 98801 64463 bit.ly/ganeshsg

top related