Recommending Refactorings to Reverse Software Architecture Erosion (CSMR 2012)

Recommending Refactorings to Reverse Software Architecture Erosion (CSMR 2012)

Architectural erosion is a recurrent problem faced by software architects. Despite this fact, the process is usually tackled in ad hoc way, without adequate tool support at the architecture level. To address this issue, we describe the preliminary design of a recommendation system whose main purpose is to provide refactoring guidelines for developers and maintainers during the task of reversing an architectural erosion process. The paper formally describes first recommendations proposed in our current research and results of their application in a web-based application.

13beaa3b7239eca3319d54c6a9f3a85a?s=128

ASERG, DCC, UFMG

March 29, 2012
Tweet

Transcript

  1. Recommending Refactorings to Reverse Software Architecture Erosion Ricardo Terra Marco

    Túlio Valente Krzysztof Czarnecki Roberto S. Bigonha {terra,bigonha,mtov}@dcc.ufmg.br kczarnec@gsd.uwaterloo.ca CSMR ERA, 2012 CSMR ERA, 2012 Recommending Refactorings to Reverse Software Architecture Erosion 1 / 10
  2. Introduction CSMR ERA, 2012 Recommending Refactorings to Reverse Software Architecture

    Erosion 2 / 10 Intended
  3. Introduction CSMR ERA, 2012 Recommending Refactorings to Reverse Software Architecture

    Erosion 2 / 10 Intended Implemented
  4. Introduction CSMR ERA, 2012 Recommending Refactorings to Reverse Software Architecture

    Erosion 2 / 10 Intended Implemented
  5. Introduction CSMR ERA, 2012 Recommending Refactorings to Reverse Software Architecture

    Erosion 2 / 10 Intended Implemented
  6. Introduction CSMR ERA, 2012 Recommending Refactorings to Reverse Software Architecture

    Erosion 2 / 10 Intended Implemented
  7. Motivation CSMR ERA, 2012 Recommending Refactorings to Reverse Software Architecture

    Erosion 3 / 10 Detecting...
  8. Motivation CSMR ERA, 2012 Recommending Refactorings to Reverse Software Architecture

    Erosion 3 / 10 Detecting... But... ? expertise waste of time ad hoc procedures
  9. Architectural Recommendation Engine – Overview Architectural Recommendation Engine Architectural_Rule Code_With_Violation

    =⇒ Recommendation, if Preconditions CSMR ERA, 2012 Recommending Refactorings to Reverse Software Architecture Erosion 4 / 10
  10. Architectural Recommendation Engine – Overview Architectural Recommendation Engine Architectural_Rule Code_With_Violation

    =⇒ Recommendation, if Preconditions Sounds like? CSMR ERA, 2012 Recommending Refactorings to Reverse Software Architecture Erosion 4 / 10
  11. Architectural Recommendation Engine – Overview CSMR ERA, 2012 Recommending Refactorings

    to Reverse Software Architecture Erosion 5 / 10 Exactly! However, focus on the architectural level DCL
  12. Architectural Recommendation Engine – Overview CSMR ERA, 2012 Recommending Refactorings

    to Reverse Software Architecture Erosion 5 / 10 Exactly! However, focus on the architectural level DCL only FactoryB can-create B
  13. Architectural Recommendation Engine – Overview CSMR ERA, 2012 Recommending Refactorings

    to Reverse Software Architecture Erosion 5 / 10 Exactly! However, focus on the architectural level DCL only FactoryB can-create B
  14. Architectural Recommendation Engine – Overview CSMR ERA, 2012 Recommending Refactorings

    to Reverse Software Architecture Erosion 5 / 10 Exactly! However, focus on the architectural level DCL only FactoryB can-create B
  15. Architectural Recommendation Engine – Overview CSMR ERA, 2012 Recommending Refactorings

    to Reverse Software Architecture Erosion 5 / 10 Exactly! However, focus on the architectural level DCL only FactoryB can-create B
  16. Architectural Recommendation Engine – Overview CSMR ERA, 2012 Recommending Refactorings

    to Reverse Software Architecture Erosion 5 / 10 Exactly! However, focus on the architectural level DCL only FactoryB can-create B
  17. Architectural Recommendation Engine – Overview CSMR ERA, 2012 Recommending Refactorings

    to Reverse Software Architecture Erosion 5 / 10 Exactly! However, focus on the architectural level DCL only FactoryB can-create B analyzes the violation
  18. Architectural Recommendation Engine – Overview CSMR ERA, 2012 Recommending Refactorings

    to Reverse Software Architecture Erosion 5 / 10 Exactly! However, focus on the architectural level DCL only FactoryB can-create B analyzes the violation A / ∈ FactoryB A cannot-create B
  19. Architectural Recommendation Engine – Overview CSMR ERA, 2012 Recommending Refactorings

    to Reverse Software Architecture Erosion 5 / 10 Exactly! However, focus on the architectural level DCL only FactoryB can-create B analyzes the violation checks constraints A / ∈ FactoryB A cannot-create B
  20. Architectural Recommendation Engine – Overview CSMR ERA, 2012 Recommending Refactorings

    to Reverse Software Architecture Erosion 5 / 10 Exactly! However, focus on the architectural level DCL only FactoryB can-create B analyzes the violation checks constraints A / ∈ FactoryB A cannot-create B
  21. Architectural Recommendation Engine – Overview CSMR ERA, 2012 Recommending Refactorings

    to Reverse Software Architecture Erosion 5 / 10 Exactly! However, focus on the architectural level DCL only FactoryB can-create B analyzes the violation checks constraints performs SCA A / ∈ FactoryB A cannot-create B
  22. Architectural Recommendation Engine – Overview CSMR ERA, 2012 Recommending Refactorings

    to Reverse Software Architecture Erosion 5 / 10 Exactly! However, focus on the architectural level DCL only FactoryB can-create B analyzes the violation checks constraints performs SCA A / ∈ FactoryB A cannot-create B + getB() : B
  23. Architectural Recommendation Engine – Overview Bingo! CSMR ERA, 2012 Recommending

    Refactorings to Reverse Software Architecture Erosion 6 / 10
  24. Architectural Recommendation Engine – Overview Bingo! Triggered Refactoring Recommendation A

    cannot-create B new B(exp) =⇒ replace( [new B(exp)], [FB.getB(exp)] ), if FB = factory(B, [exp] ) ∧ can(A, access, FB) CSMR ERA, 2012 Recommending Refactorings to Reverse Software Architecture Erosion 6 / 10
  25. Refactoring Recommendations – Table A cannot-create B, where A ∈

    MA ∧ B ∈ MB new B(exp) = ⇒ replace( [new B(exp)], [FB.getB(exp)] ), if FB = factory(B, [exp] ) ∧ can(A, access, FB) new B(exp) = ⇒ replace( [new B(exp)], [FB.getB(exp)] ), if FB = gen_factory(B, [exp] ) ∧ can(A, access, FB) A cannot-declare B B b; S = ⇒ replace( [B], [B ] ), if B ∈ super(B) ∧ typecheck( [B b ; S] ) ∧ B / ∈ MB B b = exp; S = ⇒ propagate( [exp], b, [S] ), if can(A, access, B) A cannot-access B b.f = ⇒ replace( [b.f], [D; c.g] ), if g = delegate(f) ∧ D = gen_decl(type(c), g) ∧ type(c) / ∈ MB b.f = ⇒ g = extract( [b.f] ), move(g, C), if C = suitable_class(g) ∧ can(A, access, C) g { T v = exp_b } = ⇒ promote(g, v, [exp_b] ), if ∀C ∈ call_sites(g), can(C, access, B) A cannot-throw B g (p) throws B { S } = ⇒ remove( [throws B] ), if typecheck( [g (p) { S }] ) g (p) throws B { S } = ⇒ remove( [throws B] ), replace( [S], [try {S} catch (B b){S }] ), if can(A, declare, B) ∧ S = user_code() A cannot-derive B A extends | implements B = ⇒ move(A, M), if M = suitable_module(A) ∧ can(A, extends | implements, B) CSMR ERA, 2012 Recommending Refactorings to Reverse Software Architecture Erosion 7 / 10 We have formalized a set of more than 20 refactoring recommendations!
  26. Preliminary Evaluation CSMR ERA, 2012 Recommending Refactorings to Reverse Software

    Architecture Erosion 8 / 10 MyWebMarket simple web-based e-commerce system
  27. Preliminary Evaluation CSMR ERA, 2012 Recommending Refactorings to Reverse Software

    Architecture Erosion 8 / 10 MyWebMarket simple web-based e-commerce system mirrors architecture, constraints, and violations from a previously evaluated system
  28. Preliminary Evaluation CSMR ERA, 2012 Recommending Refactorings to Reverse Software

    Architecture Erosion 8 / 10 MyWebMarket simple web-based e-commerce system mirrors architecture, constraints, and violations from a previously evaluated system #1: only DAOFactory can-create HibernateDAO #2: Controller cannot-handle HibernateDAO #3: Model can-only-throw DAOException #4: only SystemScheduling can-depend QuartzAPI
  29. Preliminary Evaluation CSMR ERA, 2012 Recommending Refactorings to Reverse Software

    Architecture Erosion 8 / 10 MyWebMarket simple web-based e-commerce system mirrors architecture, constraints, and violations from a previously evaluated system #1: only DAOFactory can-create HibernateDAO #2: Controller cannot-handle HibernateDAO #3: Model can-only-throw DAOException #4: only SystemScheduling can-depend QuartzAPI Constraint # Violations # Recs. # Violations before after #1 21 21 0 #2 43 15 12 #3 44 44 0 #4 9 9 0
  30. Preliminary Evaluation CSMR ERA, 2012 Recommending Refactorings to Reverse Software

    Architecture Erosion 8 / 10 MyWebMarket simple web-based e-commerce system mirrors architecture, constraints, and violations from a previously evaluated system #1: only DAOFactory can-create HibernateDAO #2: Controller cannot-handle HibernateDAO #3: Model can-only-throw DAOException #4: only SystemScheduling can-depend QuartzAPI Constraint # Violations # Recs. # Violations before after #1 21 21 0 #2 43 15 12 #3 44 44 0 #4 9 9 0 ∼90%!
  31. Ongoing work Evaluation in real systems (in progress) Medium-size (30KLOC)

    Large-size (750KLOC) More refactoring recommendations (in progress) Divergences and also absences The dclsuite tool (in progress) dclcheck + dclfix CSMR ERA, 2012 Recommending Refactorings to Reverse Software Architecture Erosion 9 / 10
  32. Thanks!!! CSMR ERA, 2012 Recommending Refactorings to Reverse Software Architecture

    Erosion 10 / 10
  33. CSMR 2012 Presentation: Thursday, March 29, 2012, at 11am Poster

    Session: On the Afternoon of the same day CSMR ERA, 2012 Recommending Refactorings to Reverse Software Architecture Erosion 10 / 10