SlideShare ist ein Scribd-Unternehmen logo
1 von 34
Downloaden Sie, um offline zu lesen
Supporting Design Model Refactoring
           for Improving
  Class Responsibility Assignment




Motohiro Akiyama†,
Shinpei Hayashi†,
Takashi Kobayashi‡, and   † Tokyo Institute of Technology, Japan
Motoshi Saeki†            ‡ Nagoya University, Japan
Abstract
   Aim
    − Computerized support of
      Class Responsibility Assignment (CRA)
   Approach: automated CRA refactoring
    − Usage of GRASP
    − Defining detection rules of bad smells
    − Defining transformation rules of refactoring operations
   Result
    − Defined 5 CRA refactorings based on GRASP
    − Implemented an automated tool
    − Preliminary evaluated our approach
      by a controlled experiment with 4 human subjects
                                                                2
Background
   Design of high quality
                 Highly maintainable products
   Our focus:
    Class Responsibility Assignment (CRA)
    − A design task before completing class diagrams
    − Assigning responsibilities to classes
   Responsibility [Wirfs-Brock 90]
    − Representing
       • The actions an object performs
       • The knowledge an object maintains
       • Major decisions an object makes that affect others
    − Basis of the design of methods/attributes
                                                              3
CRA: an example                      Login
                                     account    hayashi

   How to model this?               password deadbeef        Login


    − Menu available after authentication
    − Different menu required according to roles
          for users                    for admins
• Display user menu                          • Display admin menu

   A solution:
    • Display admin menu                 Menu
    • Display user menu       + displayMenu(authority: int)
      Responsibilities                Classes
                                                                      4
“Bad smells” in CRA
   • Display admin menu                    Menu
   • Display user menu          + displayMenu(authority: int)
                                             (authority:

                  Low maintainability
         Branches               New option causes modification
public void                       if (authority == ADMIN) {
displayMenu(int authoriuty) {         ……
  if (authority == ADMIN) {       }
    ……                            else if (authority == VIP) {
  }                                   ……
  else {                          }
    ……                            else {
  }                                   ……
}                                 }
                                                                 5
General Responsibility
GRASP [Larman 04]                       Assignment Software Pattern


   9 patterns/principles of CRA; e.g.
    − Polymorphism:
      When related alternatives or behaviors vary by class,
      assign responsibility for the behavior using polymorphic
      operations to the classes for which the behavior varies.
    − Protected Variations:
      Identify points of predicted variation or instability; assign
      responsibilities to create a stable “interface” around them.


   Can combine multiple patterns
    − Polymorphism + Protected Variations
                                                                      6
CRA Refactoring
                                              Menu
     • Display admin menu
     • Display user menu           + displayMenu(authority: int)


                 Refactor         based on Polymorphism
                                           Protected Variations

                             Admin-Menu
 • Display admin menu       + displayMenu()               Menu

                              User-Menu              + displayMenu()
 • Display user menu
                            + displayMenu()
            How to achieve
 automated support of CRA refactorings?                                7
Challenges
1.   How to analyze relationships of
     responsibilities?
           • Display admin menu   • Display admin menu
similar.                                                           similar?
           • Display user menu    • To display the menu of users


2.   How to deal with informal
     descriptions of GRASP?
       When related alternatives or behaviors vary by class,
                                                        class
       assign responsibility for the behavior using polymorphic
       operations to the classes for which the behavior varies.
                                                         varies

                                                                         8
Our Solutions
1.   How to analyze relationships of
     responsibilities?
        Giving a special form for responsibility
        descriptions enabling easier analysis of
        responsibilities
2.   How to deal with informal
     descriptions of GRASP?
        Giving formal definition of smell detection rules
        based on GRASP

                                                            9
Our Approach
    Requirements
      documents      1.   Describing responsibilities in a
(e.g. use case desc.)
                          special form
                          − enable us to analyze them easily

 Responsibilities
                    2. Automated CRA refactoring
                          − Detecting CRA smells
           Refactor       − Suggesting CRA refactorings
                          − Applying CRA refactoring when accepted
       CRA
                                                                     10
Responsibility Form
   Finer-grained than sentence
    − Describe a responsibility as 7 components
    − who does what to whom when
    − Similar to the Case Grammar [Fillmore 68]

    ID (id): unique identifier number
    Action (action): the verb
    Target (target): the target of the action
    Modifier (mod): the modifier of the target
    Possessive (pos): the modifier which is a possessive case
    Condition (cond): whether the action is executed or not
    Dependency (dep): responsibilities to which are referred by this
                                                                       11
Responsibility Form
• #1: Display admin menu
   id: 1
   action: Display                     Menu
   target: menu
   mod: admin
   pos: (nil)
   cond: (nil)
   dep: #4



• #4: Check authority of account
  id: 4
  action: Check
  target: authority
                                   LoginController
  mod: (nil)
  pos: account
  cond: (nil)
  dep: (nil)
                                                     12
coordinate Relationship
   Detecting using similarity of
    responsibility descriptions

    • #1: Display user menu   • #2: Display admin menu
       id: 1                     id: 2
       action: Display           action: Display            same
       target: menu              target: menu               same
       mod: user                 mod: admin              different
       pos: (nil)                pos: (nil)                 same
       cond: (nil)               cond: (nil)
       dep: (nil)                dep: (nil)



                                                                     13
CRA Refactorings
1. Move Responsibility
   − moves a responsibility to more appropriate class
2. Introduce Simple Factory
   − unifies creation responsibilities which instantiate the same class
3. Introduce Creator
   − moves responsibilities of instantiating a class to an appropriate class
4. Introduce Polymorphism
   − separately assigns coordinate responsibilities to individual classes
     having a common parent class
5. Introduce Facade
   − reorganizes a CRA having complex dependencies among owner
     classes of the responsibilities

                                                                            14
Introduce Polymorphism
   Based on:
    − Polymorphism
      When related alternatives or behaviors vary by class,
      assign responsibility for the behavior using polymorphic
      operations to the classes for which the behavior varies.
    − Protected Variations
      Identify points of predicted variation or instability; assign
      responsibilities to create a stable “interface” around them.

   Detection Condition:
    1. Finding coordinate relationships
    2. Satisfying pre-conditions
      • There is no common parent class of the target classes
                                                                  15
Introduce Polymorphism
1.   Create new child classes
2.   Move responsibilities
3.   Create a parent class
4.   Rename

                        Menu
 • Display admin menu
 • Display user menu




                                16
Introduce Polymorphism
1.   Create new child classes
2.   Move responsibilities
3.   Create a parent class
4.   Rename

                        Menu
 • Display admin menu
 • Display user menu

                        Child1

                                 17
Introduce Polymorphism
1.   Create new child classes
2.   Move responsibilities
3.   Create a parent class
4.   Rename

                        Menu
 • Display admin menu

                        Child1
 • Display user menu
                                 18
Introduce Polymorphism
1.   Create new child classes
2.   Move responsibilities
3.   Create a parent class
4.   Rename

                        Menu
 • Display admin menu            Base

                        Child1
 • Display user menu
                                        19
Introduce Polymorphism
1.   Create new child classes
2.   Move responsibilities
3.   Create a parent class
4.   Rename

                        Admin-Menu
 • Display admin menu                Menu

                        User-Menu
 • Display user menu
                                            20
Supporting Tool: RAST




                        21
Supporting Tool: RAST
                       Responsibilities




Class diagram editor



                       Responsibility
                          editor


                                          22
Supporting Tool: RAST
                             metrics view:
                             • CLCr
                             • LCOMr
                             lower is better

Suggested CRA refactorings




                                               23
Supporting Tool: RAST



     Related classes
     are highlighted




                        24
Supporting Tool: RAST


          Refactored




                        25
Supported GRASPs
    8 / 9 patterns are supported in RAST
     GRASP           supports              CRA refactorings
 ✓ Information Expert         Move Responsibility
   ✓ Pure Fabrication         Introduce Simple Factory
         ✓ Indirection        Introduce Facade
            ✓ Creator         Introduce Creator
✓ Protected Variations        Introduce Polymorphism
     ✓ Polymorphism
     ✓ Low Coupling               The metrics
    ✓ High Cohesion              view in RAST
         ✗ Controller    (Unsupported)
                                                              26
Preliminary Evaluation
   RQ1: Does our method improve the
    design quality of CRA?
    Obtained positive results!

   RQ2: Do CRA alternatives suggested by
    our tool support designers appropriately?
    Obtained positive results!

                                            27
Experimental Design (1)
   Subjects
          Student 1       Expert 1      Student 2      Expert 2
            (S1)            (E1)          (S2)           (E2)


   Given data
    − Use case descriptions for the target system
    − Responsibilities extracted from the use case descriptions
   Tasks
    − Preparation: Usage lecture (10 min)
    − Extracting (creating) classes
                                                    (2 hrs)
    − Assigning given responsibilities to classes

                                                                  28
Experimental Design (2)
         RQ1:              RQ2:
         Quality of design Support for designers

            • CLCr
Metric      • NCr                  Questionnaires
            • LCOMr
       Supply chain management system
System for a virtual winery
           • 5 use cases
           • 46 responsibilities
                                                    29
RQ1: Results                                  : RAST’s CRA refactoring
                                                available




                 S1      E1       S2      E2      average
                                 0.67    1.04       0.86
 CLCr
               2.53     1.30                        1.92
                                 0.85    1.07       0.96
  NCr
               1.27     1.60                        1.43
                                 0.72    0.79       0.76
 LCOMr
               0.80     0.97                        0.89
  (Although the result is far from statistical evidence,)
      All metric values with tool support are better.
                                                                   30
RQ2: Results
   Move Responsibility
     Tool suggested just what I intend to move.
     Reasonable suggestions.
    ✗ However many unnecessary suggestions included.
   Introduce Facade
    ✗ Makes my design more complicated rather than reduce complexity.
   Introduce Creator
     Reasonable and useful suggestions.
   Introduce Polymorphism
     I just realized coordinate responsibilities when tool suggested this refactoring.
     Tool suggested a responsibility split just what I intend to.
   Introduce Simple Factory
    − (No suggestions)
                                Mostly the answers are positive:
                             The subjects prefer the suggested CRA.
                                                                                          31
Future Work
   Improving refactoring rules
    − Usage of architecture information; e.g. MVC
   Evaluation++
    − Statistical evidences
    − Costs for describing responsibilities
    − Usability of RAST




                                                    32
CRA Refactoring                                                   Our Approach
                                                                      Requirements
                                                                        documents         1. Describing responsibilities in a
                                                                  (e.g. use case desc.)
              Refactor       based on Polymorphism                                           special form
                                      Protected Variations                                  − enable us to analyze them easily

                                                                   Responsibilities
                                                                                          2. Automated CRA refactoring
                                                                                            − Detecting CRA smells
                                                                             Refactor       − Suggesting CRA refactorings
                                                                                            − Applying CRA refactoring when accepted
             How to achieve
  automated support of CRA refactorings?                     7
                                                                         CRA
                                                                                                                                       10




Supporting Tool: RAST                                             Preliminary Evaluation
                                        metrics view:                 RQ1: Does our method improve the
                                        •CLCr                          design quality of CRA?
                                        •LCOMr
                                                                        Obtained positive results!
                                        lower is better

Suggested CRA refactorings                                            RQ2: Do CRA alternatives suggested by
                                                                       our tool support designers appropriately?


                                                                                          Conclusion
                                                                        Obtained positive results!

                                                             23                                                                        27
Credits
   Photo by teamaskins
    − CRC Cards | Flickr
      http://www.flickr.com/photos/teamaskins/130003950/


   Illustration by M/Y/D/S
    − Illustration = http://myds.jp/
    − http://motoki-y.sakura.ne.jp/illust/skeleton.shtml




                                                           34

Weitere ähnliche Inhalte

Was ist angesagt?

Chapter 9 & chapter 10 solutions
Chapter 9 & chapter 10 solutionsChapter 9 & chapter 10 solutions
Chapter 9 & chapter 10 solutionsSaeed Iqbal
 
Automated Refactoring of Legacy Java Software to Default Methods Talk at GMU
Automated Refactoring of Legacy Java Software to Default Methods Talk at GMUAutomated Refactoring of Legacy Java Software to Default Methods Talk at GMU
Automated Refactoring of Legacy Java Software to Default Methods Talk at GMURaffi Khatchadourian
 
Aspect-Oriented Programming and Depedency Injection
Aspect-Oriented Programming and Depedency InjectionAspect-Oriented Programming and Depedency Injection
Aspect-Oriented Programming and Depedency InjectionRobert Lemke
 
Automated Refactoring of Legacy Java Software to Default Methods Talk at ICSE...
Automated Refactoring of Legacy Java Software to Default Methods Talk at ICSE...Automated Refactoring of Legacy Java Software to Default Methods Talk at ICSE...
Automated Refactoring of Legacy Java Software to Default Methods Talk at ICSE...Raffi Khatchadourian
 
Poster on Automated Refactoring of Legacy Java Software to Default Methods
Poster on Automated Refactoring of Legacy Java Software to Default MethodsPoster on Automated Refactoring of Legacy Java Software to Default Methods
Poster on Automated Refactoring of Legacy Java Software to Default MethodsRaffi Khatchadourian
 
Towards Improving Interface Modularity in Legacy Java Software Through Automa...
Towards Improving Interface Modularity in Legacy Java Software Through Automa...Towards Improving Interface Modularity in Legacy Java Software Through Automa...
Towards Improving Interface Modularity in Legacy Java Software Through Automa...Raffi Khatchadourian
 
Java interfaces
Java interfacesJava interfaces
Java interfacesjehan1987
 
Software Architecture for Robotics
Software Architecture for RoboticsSoftware Architecture for Robotics
Software Architecture for RoboticsLorran Pegoretti
 
Big Java Chapter 1
Big Java Chapter 1Big Java Chapter 1
Big Java Chapter 1Maria Joslin
 
SysProg-Tutor 01 Introduction to C Programming Language
SysProg-Tutor 01 Introduction to C Programming LanguageSysProg-Tutor 01 Introduction to C Programming Language
SysProg-Tutor 01 Introduction to C Programming LanguageWongyos Keardsri
 
GUI Programming in JAVA (Using Netbeans) - A Review
GUI Programming in JAVA (Using Netbeans) -  A ReviewGUI Programming in JAVA (Using Netbeans) -  A Review
GUI Programming in JAVA (Using Netbeans) - A ReviewFernando Torres
 

Was ist angesagt? (20)

Chapter 9 & chapter 10 solutions
Chapter 9 & chapter 10 solutionsChapter 9 & chapter 10 solutions
Chapter 9 & chapter 10 solutions
 
Automated Refactoring of Legacy Java Software to Default Methods Talk at GMU
Automated Refactoring of Legacy Java Software to Default Methods Talk at GMUAutomated Refactoring of Legacy Java Software to Default Methods Talk at GMU
Automated Refactoring of Legacy Java Software to Default Methods Talk at GMU
 
Java interfaces
Java interfacesJava interfaces
Java interfaces
 
Aspect-Oriented Programming and Depedency Injection
Aspect-Oriented Programming and Depedency InjectionAspect-Oriented Programming and Depedency Injection
Aspect-Oriented Programming and Depedency Injection
 
Automated Refactoring of Legacy Java Software to Default Methods Talk at ICSE...
Automated Refactoring of Legacy Java Software to Default Methods Talk at ICSE...Automated Refactoring of Legacy Java Software to Default Methods Talk at ICSE...
Automated Refactoring of Legacy Java Software to Default Methods Talk at ICSE...
 
Poster on Automated Refactoring of Legacy Java Software to Default Methods
Poster on Automated Refactoring of Legacy Java Software to Default MethodsPoster on Automated Refactoring of Legacy Java Software to Default Methods
Poster on Automated Refactoring of Legacy Java Software to Default Methods
 
Interfaces in java
Interfaces in javaInterfaces in java
Interfaces in java
 
Java interface
Java interfaceJava interface
Java interface
 
Towards Improving Interface Modularity in Legacy Java Software Through Automa...
Towards Improving Interface Modularity in Legacy Java Software Through Automa...Towards Improving Interface Modularity in Legacy Java Software Through Automa...
Towards Improving Interface Modularity in Legacy Java Software Through Automa...
 
Ppt chapter07
Ppt chapter07Ppt chapter07
Ppt chapter07
 
Java interfaces
Java interfacesJava interfaces
Java interfaces
 
Software Architecture for Robotics
Software Architecture for RoboticsSoftware Architecture for Robotics
Software Architecture for Robotics
 
Big Java Chapter 1
Big Java Chapter 1Big Java Chapter 1
Big Java Chapter 1
 
Gui
GuiGui
Gui
 
MexADL
MexADLMexADL
MexADL
 
SysProg-Tutor 01 Introduction to C Programming Language
SysProg-Tutor 01 Introduction to C Programming LanguageSysProg-Tutor 01 Introduction to C Programming Language
SysProg-Tutor 01 Introduction to C Programming Language
 
GUI Programming in JAVA (Using Netbeans) - A Review
GUI Programming in JAVA (Using Netbeans) -  A ReviewGUI Programming in JAVA (Using Netbeans) -  A Review
GUI Programming in JAVA (Using Netbeans) - A Review
 
Pptchapter04
Pptchapter04Pptchapter04
Pptchapter04
 
Java interfaces
Java   interfacesJava   interfaces
Java interfaces
 
Krml203
Krml203Krml203
Krml203
 

Andere mochten auch

Sentence-to-Code Traceability Recovery with Domain Ontologies
Sentence-to-Code Traceability Recovery with Domain OntologiesSentence-to-Code Traceability Recovery with Domain Ontologies
Sentence-to-Code Traceability Recovery with Domain OntologiesShinpei Hayashi
 
Modeling and Utilizing Security Knowledge for Eliciting Security Requirements
Modeling and Utilizing Security Knowledge for Eliciting Security RequirementsModeling and Utilizing Security Knowledge for Eliciting Security Requirements
Modeling and Utilizing Security Knowledge for Eliciting Security RequirementsShinpei Hayashi
 
Feature Location for Multi-Layer System Based on Formal Concept Analysis
Feature Location for Multi-Layer System Based on Formal Concept AnalysisFeature Location for Multi-Layer System Based on Formal Concept Analysis
Feature Location for Multi-Layer System Based on Formal Concept AnalysisHiroshi Kazato
 
Generating Assertion Code from OCL: A Transformational Approach Based on Simi...
Generating Assertion Code from OCL: A Transformational Approach Based on Simi...Generating Assertion Code from OCL: A Transformational Approach Based on Simi...
Generating Assertion Code from OCL: A Transformational Approach Based on Simi...Shinpei Hayashi
 
How Can You Improve Your As-is Models? Requirements Analysis Methods Meet GQM
How Can You Improve Your As-is Models? Requirements Analysis Methods Meet GQMHow Can You Improve Your As-is Models? Requirements Analysis Methods Meet GQM
How Can You Improve Your As-is Models? Requirements Analysis Methods Meet GQMShinpei Hayashi
 
Terminology Matching of Requirements Specification Documents and Regulations ...
Terminology Matching of Requirements Specification Documents and Regulations ...Terminology Matching of Requirements Specification Documents and Regulations ...
Terminology Matching of Requirements Specification Documents and Regulations ...Shinpei Hayashi
 
Incremental Feature Location and Identification in Source Code
Incremental Feature Location and Identification in Source CodeIncremental Feature Location and Identification in Source Code
Incremental Feature Location and Identification in Source CodeHiroshi Kazato
 
Historef: A Tool for Edit History Refactoring
Historef: A Tool  for Edit History RefactoringHistoref: A Tool  for Edit History Refactoring
Historef: A Tool for Edit History RefactoringShinpei Hayashi
 
Detecting Occurrences of Refactoring with Heuristic Search
Detecting Occurrences of Refactoring with Heuristic SearchDetecting Occurrences of Refactoring with Heuristic Search
Detecting Occurrences of Refactoring with Heuristic SearchShinpei Hayashi
 
Refactoring Edit History of Source Code
Refactoring Edit History of Source CodeRefactoring Edit History of Source Code
Refactoring Edit History of Source CodeShinpei Hayashi
 
Establishing Regulatory Compliance in Goal-Oriented Requirements Analysis
Establishing Regulatory Compliance in Goal-Oriented Requirements AnalysisEstablishing Regulatory Compliance in Goal-Oriented Requirements Analysis
Establishing Regulatory Compliance in Goal-Oriented Requirements AnalysisShinpei Hayashi
 
Class Responsibility Assignment as Fuzzy Constraint Satisfaction
Class Responsibility Assignment as Fuzzy Constraint SatisfactionClass Responsibility Assignment as Fuzzy Constraint Satisfaction
Class Responsibility Assignment as Fuzzy Constraint SatisfactionShinpei Hayashi
 
Understanding Source Code Differences by Separating Refactoring Effects
Understanding Source Code Differences by Separating Refactoring EffectsUnderstanding Source Code Differences by Separating Refactoring Effects
Understanding Source Code Differences by Separating Refactoring EffectsShinpei Hayashi
 
FOSE2010 ミニチュートリアル 「データマイニング技術を応用したソフトウェア構築・保守支援」
FOSE2010 ミニチュートリアル 「データマイニング技術を応用したソフトウェア構築・保守支援」FOSE2010 ミニチュートリアル 「データマイニング技術を応用したソフトウェア構築・保守支援」
FOSE2010 ミニチュートリアル 「データマイニング技術を応用したソフトウェア構築・保守支援」Takashi Kobayashi
 

Andere mochten auch (14)

Sentence-to-Code Traceability Recovery with Domain Ontologies
Sentence-to-Code Traceability Recovery with Domain OntologiesSentence-to-Code Traceability Recovery with Domain Ontologies
Sentence-to-Code Traceability Recovery with Domain Ontologies
 
Modeling and Utilizing Security Knowledge for Eliciting Security Requirements
Modeling and Utilizing Security Knowledge for Eliciting Security RequirementsModeling and Utilizing Security Knowledge for Eliciting Security Requirements
Modeling and Utilizing Security Knowledge for Eliciting Security Requirements
 
Feature Location for Multi-Layer System Based on Formal Concept Analysis
Feature Location for Multi-Layer System Based on Formal Concept AnalysisFeature Location for Multi-Layer System Based on Formal Concept Analysis
Feature Location for Multi-Layer System Based on Formal Concept Analysis
 
Generating Assertion Code from OCL: A Transformational Approach Based on Simi...
Generating Assertion Code from OCL: A Transformational Approach Based on Simi...Generating Assertion Code from OCL: A Transformational Approach Based on Simi...
Generating Assertion Code from OCL: A Transformational Approach Based on Simi...
 
How Can You Improve Your As-is Models? Requirements Analysis Methods Meet GQM
How Can You Improve Your As-is Models? Requirements Analysis Methods Meet GQMHow Can You Improve Your As-is Models? Requirements Analysis Methods Meet GQM
How Can You Improve Your As-is Models? Requirements Analysis Methods Meet GQM
 
Terminology Matching of Requirements Specification Documents and Regulations ...
Terminology Matching of Requirements Specification Documents and Regulations ...Terminology Matching of Requirements Specification Documents and Regulations ...
Terminology Matching of Requirements Specification Documents and Regulations ...
 
Incremental Feature Location and Identification in Source Code
Incremental Feature Location and Identification in Source CodeIncremental Feature Location and Identification in Source Code
Incremental Feature Location and Identification in Source Code
 
Historef: A Tool for Edit History Refactoring
Historef: A Tool  for Edit History RefactoringHistoref: A Tool  for Edit History Refactoring
Historef: A Tool for Edit History Refactoring
 
Detecting Occurrences of Refactoring with Heuristic Search
Detecting Occurrences of Refactoring with Heuristic SearchDetecting Occurrences of Refactoring with Heuristic Search
Detecting Occurrences of Refactoring with Heuristic Search
 
Refactoring Edit History of Source Code
Refactoring Edit History of Source CodeRefactoring Edit History of Source Code
Refactoring Edit History of Source Code
 
Establishing Regulatory Compliance in Goal-Oriented Requirements Analysis
Establishing Regulatory Compliance in Goal-Oriented Requirements AnalysisEstablishing Regulatory Compliance in Goal-Oriented Requirements Analysis
Establishing Regulatory Compliance in Goal-Oriented Requirements Analysis
 
Class Responsibility Assignment as Fuzzy Constraint Satisfaction
Class Responsibility Assignment as Fuzzy Constraint SatisfactionClass Responsibility Assignment as Fuzzy Constraint Satisfaction
Class Responsibility Assignment as Fuzzy Constraint Satisfaction
 
Understanding Source Code Differences by Separating Refactoring Effects
Understanding Source Code Differences by Separating Refactoring EffectsUnderstanding Source Code Differences by Separating Refactoring Effects
Understanding Source Code Differences by Separating Refactoring Effects
 
FOSE2010 ミニチュートリアル 「データマイニング技術を応用したソフトウェア構築・保守支援」
FOSE2010 ミニチュートリアル 「データマイニング技術を応用したソフトウェア構築・保守支援」FOSE2010 ミニチュートリアル 「データマイニング技術を応用したソフトウェア構築・保守支援」
FOSE2010 ミニチュートリアル 「データマイニング技術を応用したソフトウェア構築・保守支援」
 

Ähnlich wie Supporting Design Model Refactoring for Improving Class Responsibility Assignment

Programming Paradigm Seminar 4
Programming Paradigm Seminar 4Programming Paradigm Seminar 4
Programming Paradigm Seminar 4neoxiuting
 
Le roy ward
Le roy wardLe roy ward
Le roy wardNASAPMC
 
2009 Dotnet Information Day: More effective c#
2009 Dotnet Information Day: More effective c#2009 Dotnet Information Day: More effective c#
2009 Dotnet Information Day: More effective c#Daniel Fisher
 
Zen and the art of the controller
Zen and the art of the controllerZen and the art of the controller
Zen and the art of the controllerMichael Kelly
 
G3 manageing seucrity_setupstep_final
G3 manageing seucrity_setupstep_finalG3 manageing seucrity_setupstep_final
G3 manageing seucrity_setupstep_finalsakpob
 
principles of object oriented class design
principles of object oriented class designprinciples of object oriented class design
principles of object oriented class designNeetu Mishra
 
Secure Coding: Field-level Security, CRUD, and Sharing
Secure Coding: Field-level Security, CRUD, and SharingSecure Coding: Field-level Security, CRUD, and Sharing
Secure Coding: Field-level Security, CRUD, and SharingSalesforce Developers
 
M03_1_Structur alDiagrams.ppt
M03_1_Structur                         alDiagrams.pptM03_1_Structur                         alDiagrams.ppt
M03_1_Structur alDiagrams.pptnesarahmad37
 
Chapter 5: Names, Bindings and Scopes (review Questions and Problem Set)
Chapter 5: Names, Bindings and Scopes (review Questions and Problem Set)Chapter 5: Names, Bindings and Scopes (review Questions and Problem Set)
Chapter 5: Names, Bindings and Scopes (review Questions and Problem Set)Farwa Ansari
 
Object Oriented Design SOLID Principles
Object Oriented Design SOLID PrinciplesObject Oriented Design SOLID Principles
Object Oriented Design SOLID Principlesrainynovember12
 
Reuse Contracts
Reuse ContractsReuse Contracts
Reuse ContractsESUG
 
OOP in Java Presentation.pptx
OOP in Java Presentation.pptxOOP in Java Presentation.pptx
OOP in Java Presentation.pptxmrxyz19
 
Design-Principles.ppt
Design-Principles.pptDesign-Principles.ppt
Design-Principles.pptnazimsattar
 
Software Design Trilogy Part I - Responsibility Driven Design for Rubyists
Software Design Trilogy Part I - Responsibility Driven Design for RubyistsSoftware Design Trilogy Part I - Responsibility Driven Design for Rubyists
Software Design Trilogy Part I - Responsibility Driven Design for RubyistsAndy Maleh
 
Boston ML - Architecting Recommender Systems
Boston ML - Architecting Recommender SystemsBoston ML - Architecting Recommender Systems
Boston ML - Architecting Recommender SystemsJames Kirk
 
human computer Interaction cognitive models.ppt
human computer Interaction cognitive models.ppthuman computer Interaction cognitive models.ppt
human computer Interaction cognitive models.pptJayaprasanna4
 
human computer Interaction cognitive models.ppt
human computer Interaction cognitive models.ppthuman computer Interaction cognitive models.ppt
human computer Interaction cognitive models.pptJayaprasanna4
 
Ood and solid principles
Ood and solid principlesOod and solid principles
Ood and solid principlesAvinash Kadam
 
B vb script11
B vb script11B vb script11
B vb script11oakhrd
 

Ähnlich wie Supporting Design Model Refactoring for Improving Class Responsibility Assignment (20)

Programming Paradigm Seminar 4
Programming Paradigm Seminar 4Programming Paradigm Seminar 4
Programming Paradigm Seminar 4
 
Le roy ward
Le roy wardLe roy ward
Le roy ward
 
2009 Dotnet Information Day: More effective c#
2009 Dotnet Information Day: More effective c#2009 Dotnet Information Day: More effective c#
2009 Dotnet Information Day: More effective c#
 
Zen and the art of the controller
Zen and the art of the controllerZen and the art of the controller
Zen and the art of the controller
 
G3 manageing seucrity_setupstep_final
G3 manageing seucrity_setupstep_finalG3 manageing seucrity_setupstep_final
G3 manageing seucrity_setupstep_final
 
principles of object oriented class design
principles of object oriented class designprinciples of object oriented class design
principles of object oriented class design
 
Secure Coding: Field-level Security, CRUD, and Sharing
Secure Coding: Field-level Security, CRUD, and SharingSecure Coding: Field-level Security, CRUD, and Sharing
Secure Coding: Field-level Security, CRUD, and Sharing
 
M03_1_Structur alDiagrams.ppt
M03_1_Structur                         alDiagrams.pptM03_1_Structur                         alDiagrams.ppt
M03_1_Structur alDiagrams.ppt
 
Chapter 5: Names, Bindings and Scopes (review Questions and Problem Set)
Chapter 5: Names, Bindings and Scopes (review Questions and Problem Set)Chapter 5: Names, Bindings and Scopes (review Questions and Problem Set)
Chapter 5: Names, Bindings and Scopes (review Questions and Problem Set)
 
Object Oriented Design SOLID Principles
Object Oriented Design SOLID PrinciplesObject Oriented Design SOLID Principles
Object Oriented Design SOLID Principles
 
Unit-V.pptx
Unit-V.pptxUnit-V.pptx
Unit-V.pptx
 
Reuse Contracts
Reuse ContractsReuse Contracts
Reuse Contracts
 
OOP in Java Presentation.pptx
OOP in Java Presentation.pptxOOP in Java Presentation.pptx
OOP in Java Presentation.pptx
 
Design-Principles.ppt
Design-Principles.pptDesign-Principles.ppt
Design-Principles.ppt
 
Software Design Trilogy Part I - Responsibility Driven Design for Rubyists
Software Design Trilogy Part I - Responsibility Driven Design for RubyistsSoftware Design Trilogy Part I - Responsibility Driven Design for Rubyists
Software Design Trilogy Part I - Responsibility Driven Design for Rubyists
 
Boston ML - Architecting Recommender Systems
Boston ML - Architecting Recommender SystemsBoston ML - Architecting Recommender Systems
Boston ML - Architecting Recommender Systems
 
human computer Interaction cognitive models.ppt
human computer Interaction cognitive models.ppthuman computer Interaction cognitive models.ppt
human computer Interaction cognitive models.ppt
 
human computer Interaction cognitive models.ppt
human computer Interaction cognitive models.ppthuman computer Interaction cognitive models.ppt
human computer Interaction cognitive models.ppt
 
Ood and solid principles
Ood and solid principlesOod and solid principles
Ood and solid principles
 
B vb script11
B vb script11B vb script11
B vb script11
 

Mehr von Shinpei Hayashi

Revisiting the Effect of Branch Handling Strategies on Change Recommendation
Revisiting the Effect of Branch Handling Strategies on Change RecommendationRevisiting the Effect of Branch Handling Strategies on Change Recommendation
Revisiting the Effect of Branch Handling Strategies on Change RecommendationShinpei Hayashi
 
An Extensive Study on Smell Aware Bug Localization
An Extensive Study on Smell Aware Bug LocalizationAn Extensive Study on Smell Aware Bug Localization
An Extensive Study on Smell Aware Bug LocalizationShinpei Hayashi
 
RefactorHub: A Commit Annotator for Refactoring
RefactorHub: A Commit Annotator for RefactoringRefactorHub: A Commit Annotator for Refactoring
RefactorHub: A Commit Annotator for RefactoringShinpei Hayashi
 
Can Automated Impact Analysis Technique Help Predicting Decaying Modules?
Can Automated Impact Analysis Technique Help Predicting Decaying Modules?Can Automated Impact Analysis Technique Help Predicting Decaying Modules?
Can Automated Impact Analysis Technique Help Predicting Decaying Modules?Shinpei Hayashi
 
The Impact of Systematic Edits in History Slicing
The Impact of Systematic Edits in History SlicingThe Impact of Systematic Edits in History Slicing
The Impact of Systematic Edits in History SlicingShinpei Hayashi
 
ChangeMacroRecorder: Recording Fine-Grained Textual Changes of Source Code
ChangeMacroRecorder: Recording Fine-Grained Textual Changes of Source CodeChangeMacroRecorder: Recording Fine-Grained Textual Changes of Source Code
ChangeMacroRecorder: Recording Fine-Grained Textual Changes of Source CodeShinpei Hayashi
 
Inference-Based Detection of Architectural Violations in MVC2
Inference-Based Detection of Architectural Violations in MVC2Inference-Based Detection of Architectural Violations in MVC2
Inference-Based Detection of Architectural Violations in MVC2Shinpei Hayashi
 
Detecting Bad Smells of Refinement in Goal-Oriented Requirements Analysis
Detecting Bad Smells of Refinement in Goal-Oriented Requirements AnalysisDetecting Bad Smells of Refinement in Goal-Oriented Requirements Analysis
Detecting Bad Smells of Refinement in Goal-Oriented Requirements AnalysisShinpei Hayashi
 
ソフトウェア工学勉強会への誘い
ソフトウェア工学勉強会への誘いソフトウェア工学勉強会への誘い
ソフトウェア工学勉強会への誘いShinpei Hayashi
 

Mehr von Shinpei Hayashi (9)

Revisiting the Effect of Branch Handling Strategies on Change Recommendation
Revisiting the Effect of Branch Handling Strategies on Change RecommendationRevisiting the Effect of Branch Handling Strategies on Change Recommendation
Revisiting the Effect of Branch Handling Strategies on Change Recommendation
 
An Extensive Study on Smell Aware Bug Localization
An Extensive Study on Smell Aware Bug LocalizationAn Extensive Study on Smell Aware Bug Localization
An Extensive Study on Smell Aware Bug Localization
 
RefactorHub: A Commit Annotator for Refactoring
RefactorHub: A Commit Annotator for RefactoringRefactorHub: A Commit Annotator for Refactoring
RefactorHub: A Commit Annotator for Refactoring
 
Can Automated Impact Analysis Technique Help Predicting Decaying Modules?
Can Automated Impact Analysis Technique Help Predicting Decaying Modules?Can Automated Impact Analysis Technique Help Predicting Decaying Modules?
Can Automated Impact Analysis Technique Help Predicting Decaying Modules?
 
The Impact of Systematic Edits in History Slicing
The Impact of Systematic Edits in History SlicingThe Impact of Systematic Edits in History Slicing
The Impact of Systematic Edits in History Slicing
 
ChangeMacroRecorder: Recording Fine-Grained Textual Changes of Source Code
ChangeMacroRecorder: Recording Fine-Grained Textual Changes of Source CodeChangeMacroRecorder: Recording Fine-Grained Textual Changes of Source Code
ChangeMacroRecorder: Recording Fine-Grained Textual Changes of Source Code
 
Inference-Based Detection of Architectural Violations in MVC2
Inference-Based Detection of Architectural Violations in MVC2Inference-Based Detection of Architectural Violations in MVC2
Inference-Based Detection of Architectural Violations in MVC2
 
Detecting Bad Smells of Refinement in Goal-Oriented Requirements Analysis
Detecting Bad Smells of Refinement in Goal-Oriented Requirements AnalysisDetecting Bad Smells of Refinement in Goal-Oriented Requirements Analysis
Detecting Bad Smells of Refinement in Goal-Oriented Requirements Analysis
 
ソフトウェア工学勉強会への誘い
ソフトウェア工学勉強会への誘いソフトウェア工学勉強会への誘い
ソフトウェア工学勉強会への誘い
 

Kürzlich hochgeladen

Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 

Kürzlich hochgeladen (20)

Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 

Supporting Design Model Refactoring for Improving Class Responsibility Assignment

  • 1. Supporting Design Model Refactoring for Improving Class Responsibility Assignment Motohiro Akiyama†, Shinpei Hayashi†, Takashi Kobayashi‡, and † Tokyo Institute of Technology, Japan Motoshi Saeki† ‡ Nagoya University, Japan
  • 2. Abstract  Aim − Computerized support of Class Responsibility Assignment (CRA)  Approach: automated CRA refactoring − Usage of GRASP − Defining detection rules of bad smells − Defining transformation rules of refactoring operations  Result − Defined 5 CRA refactorings based on GRASP − Implemented an automated tool − Preliminary evaluated our approach by a controlled experiment with 4 human subjects 2
  • 3. Background  Design of high quality Highly maintainable products  Our focus: Class Responsibility Assignment (CRA) − A design task before completing class diagrams − Assigning responsibilities to classes  Responsibility [Wirfs-Brock 90] − Representing • The actions an object performs • The knowledge an object maintains • Major decisions an object makes that affect others − Basis of the design of methods/attributes 3
  • 4. CRA: an example Login account hayashi  How to model this? password deadbeef Login − Menu available after authentication − Different menu required according to roles for users for admins • Display user menu • Display admin menu  A solution: • Display admin menu Menu • Display user menu + displayMenu(authority: int) Responsibilities Classes 4
  • 5. “Bad smells” in CRA • Display admin menu Menu • Display user menu + displayMenu(authority: int) (authority: Low maintainability Branches New option causes modification public void if (authority == ADMIN) { displayMenu(int authoriuty) { …… if (authority == ADMIN) { } …… else if (authority == VIP) { } …… else { } …… else { } …… } } 5
  • 6. General Responsibility GRASP [Larman 04] Assignment Software Pattern  9 patterns/principles of CRA; e.g. − Polymorphism: When related alternatives or behaviors vary by class, assign responsibility for the behavior using polymorphic operations to the classes for which the behavior varies. − Protected Variations: Identify points of predicted variation or instability; assign responsibilities to create a stable “interface” around them.  Can combine multiple patterns − Polymorphism + Protected Variations 6
  • 7. CRA Refactoring Menu • Display admin menu • Display user menu + displayMenu(authority: int) Refactor based on Polymorphism Protected Variations Admin-Menu • Display admin menu + displayMenu() Menu User-Menu + displayMenu() • Display user menu + displayMenu() How to achieve automated support of CRA refactorings? 7
  • 8. Challenges 1. How to analyze relationships of responsibilities? • Display admin menu • Display admin menu similar. similar? • Display user menu • To display the menu of users 2. How to deal with informal descriptions of GRASP? When related alternatives or behaviors vary by class, class assign responsibility for the behavior using polymorphic operations to the classes for which the behavior varies. varies 8
  • 9. Our Solutions 1. How to analyze relationships of responsibilities? Giving a special form for responsibility descriptions enabling easier analysis of responsibilities 2. How to deal with informal descriptions of GRASP? Giving formal definition of smell detection rules based on GRASP 9
  • 10. Our Approach Requirements documents 1. Describing responsibilities in a (e.g. use case desc.) special form − enable us to analyze them easily Responsibilities 2. Automated CRA refactoring − Detecting CRA smells Refactor − Suggesting CRA refactorings − Applying CRA refactoring when accepted CRA 10
  • 11. Responsibility Form  Finer-grained than sentence − Describe a responsibility as 7 components − who does what to whom when − Similar to the Case Grammar [Fillmore 68] ID (id): unique identifier number Action (action): the verb Target (target): the target of the action Modifier (mod): the modifier of the target Possessive (pos): the modifier which is a possessive case Condition (cond): whether the action is executed or not Dependency (dep): responsibilities to which are referred by this 11
  • 12. Responsibility Form • #1: Display admin menu id: 1 action: Display Menu target: menu mod: admin pos: (nil) cond: (nil) dep: #4 • #4: Check authority of account id: 4 action: Check target: authority LoginController mod: (nil) pos: account cond: (nil) dep: (nil) 12
  • 13. coordinate Relationship  Detecting using similarity of responsibility descriptions • #1: Display user menu • #2: Display admin menu id: 1 id: 2 action: Display action: Display same target: menu target: menu same mod: user mod: admin different pos: (nil) pos: (nil) same cond: (nil) cond: (nil) dep: (nil) dep: (nil) 13
  • 14. CRA Refactorings 1. Move Responsibility − moves a responsibility to more appropriate class 2. Introduce Simple Factory − unifies creation responsibilities which instantiate the same class 3. Introduce Creator − moves responsibilities of instantiating a class to an appropriate class 4. Introduce Polymorphism − separately assigns coordinate responsibilities to individual classes having a common parent class 5. Introduce Facade − reorganizes a CRA having complex dependencies among owner classes of the responsibilities 14
  • 15. Introduce Polymorphism  Based on: − Polymorphism When related alternatives or behaviors vary by class, assign responsibility for the behavior using polymorphic operations to the classes for which the behavior varies. − Protected Variations Identify points of predicted variation or instability; assign responsibilities to create a stable “interface” around them.  Detection Condition: 1. Finding coordinate relationships 2. Satisfying pre-conditions • There is no common parent class of the target classes 15
  • 16. Introduce Polymorphism 1. Create new child classes 2. Move responsibilities 3. Create a parent class 4. Rename Menu • Display admin menu • Display user menu 16
  • 17. Introduce Polymorphism 1. Create new child classes 2. Move responsibilities 3. Create a parent class 4. Rename Menu • Display admin menu • Display user menu Child1 17
  • 18. Introduce Polymorphism 1. Create new child classes 2. Move responsibilities 3. Create a parent class 4. Rename Menu • Display admin menu Child1 • Display user menu 18
  • 19. Introduce Polymorphism 1. Create new child classes 2. Move responsibilities 3. Create a parent class 4. Rename Menu • Display admin menu Base Child1 • Display user menu 19
  • 20. Introduce Polymorphism 1. Create new child classes 2. Move responsibilities 3. Create a parent class 4. Rename Admin-Menu • Display admin menu Menu User-Menu • Display user menu 20
  • 22. Supporting Tool: RAST Responsibilities Class diagram editor Responsibility editor 22
  • 23. Supporting Tool: RAST metrics view: • CLCr • LCOMr lower is better Suggested CRA refactorings 23
  • 24. Supporting Tool: RAST Related classes are highlighted 24
  • 25. Supporting Tool: RAST Refactored 25
  • 26. Supported GRASPs  8 / 9 patterns are supported in RAST GRASP supports CRA refactorings ✓ Information Expert Move Responsibility ✓ Pure Fabrication Introduce Simple Factory ✓ Indirection Introduce Facade ✓ Creator Introduce Creator ✓ Protected Variations Introduce Polymorphism ✓ Polymorphism ✓ Low Coupling The metrics ✓ High Cohesion view in RAST ✗ Controller (Unsupported) 26
  • 27. Preliminary Evaluation  RQ1: Does our method improve the design quality of CRA? Obtained positive results!  RQ2: Do CRA alternatives suggested by our tool support designers appropriately? Obtained positive results! 27
  • 28. Experimental Design (1)  Subjects Student 1 Expert 1 Student 2 Expert 2 (S1) (E1) (S2) (E2)  Given data − Use case descriptions for the target system − Responsibilities extracted from the use case descriptions  Tasks − Preparation: Usage lecture (10 min) − Extracting (creating) classes (2 hrs) − Assigning given responsibilities to classes 28
  • 29. Experimental Design (2) RQ1: RQ2: Quality of design Support for designers • CLCr Metric • NCr Questionnaires • LCOMr Supply chain management system System for a virtual winery • 5 use cases • 46 responsibilities 29
  • 30. RQ1: Results : RAST’s CRA refactoring available S1 E1 S2 E2 average 0.67 1.04 0.86 CLCr 2.53 1.30 1.92 0.85 1.07 0.96 NCr 1.27 1.60 1.43 0.72 0.79 0.76 LCOMr 0.80 0.97 0.89 (Although the result is far from statistical evidence,) All metric values with tool support are better. 30
  • 31. RQ2: Results  Move Responsibility  Tool suggested just what I intend to move.  Reasonable suggestions. ✗ However many unnecessary suggestions included.  Introduce Facade ✗ Makes my design more complicated rather than reduce complexity.  Introduce Creator  Reasonable and useful suggestions.  Introduce Polymorphism  I just realized coordinate responsibilities when tool suggested this refactoring.  Tool suggested a responsibility split just what I intend to.  Introduce Simple Factory − (No suggestions) Mostly the answers are positive: The subjects prefer the suggested CRA. 31
  • 32. Future Work  Improving refactoring rules − Usage of architecture information; e.g. MVC  Evaluation++ − Statistical evidences − Costs for describing responsibilities − Usability of RAST 32
  • 33. CRA Refactoring Our Approach Requirements documents 1. Describing responsibilities in a (e.g. use case desc.) Refactor based on Polymorphism special form Protected Variations − enable us to analyze them easily Responsibilities 2. Automated CRA refactoring − Detecting CRA smells Refactor − Suggesting CRA refactorings − Applying CRA refactoring when accepted How to achieve automated support of CRA refactorings? 7 CRA 10 Supporting Tool: RAST Preliminary Evaluation metrics view:  RQ1: Does our method improve the •CLCr design quality of CRA? •LCOMr Obtained positive results! lower is better Suggested CRA refactorings  RQ2: Do CRA alternatives suggested by our tool support designers appropriately? Conclusion Obtained positive results! 23 27
  • 34. Credits  Photo by teamaskins − CRC Cards | Flickr http://www.flickr.com/photos/teamaskins/130003950/  Illustration by M/Y/D/S − Illustration = http://myds.jp/ − http://motoki-y.sakura.ne.jp/illust/skeleton.shtml 34