Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Recommending Refactorings to Reverse Software A...

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.

ASERG, DCC, UFMG

March 29, 2012
Tweet

More Decks by ASERG, DCC, UFMG

Other Decks in Research

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 [email protected] CSMR ERA, 2012 CSMR ERA, 2012 Recommending Refactorings to Reverse Software Architecture Erosion 1 / 10
  2. Motivation CSMR ERA, 2012 Recommending Refactorings to Reverse Software Architecture

    Erosion 3 / 10 Detecting... But... ? expertise waste of time ad hoc procedures
  3. 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
  4. 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
  5. Architectural Recommendation Engine – Overview CSMR ERA, 2012 Recommending Refactorings

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

    Refactorings to Reverse Software Architecture Erosion 6 / 10
  18. 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
  19. 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!
  20. Preliminary Evaluation CSMR ERA, 2012 Recommending Refactorings to Reverse Software

    Architecture Erosion 8 / 10 MyWebMarket simple web-based e-commerce system
  21. 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
  22. 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
  23. 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
  24. 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%!
  25. 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
  26. 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