SlideShare une entreprise Scribd logo
1  sur  34
Télécharger pour lire hors ligne
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

Contenu connexe

Tendances

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
 

Tendances (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
 

En vedette

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
 

En vedette (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 ミニチュートリアル 「データマイニング技術を応用したソフトウェア構築・保守支援」
 

Similaire à 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
 

Similaire à 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
 

Plus de 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
 

Plus de 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
 
ソフトウェア工学勉強会への誘い
ソフトウェア工学勉強会への誘いソフトウェア工学勉強会への誘い
ソフトウェア工学勉強会への誘い
 

Dernier

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
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
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
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
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
 
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
 
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
 
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
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
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
 
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
 

Dernier (20)

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
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.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
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
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
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
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
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
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
 
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
 

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