SlideShare une entreprise Scribd logo
1  sur  28
Télécharger pour lire hors ligne
Identifying Traits with
Formal Concept Analysis
Adrian Lienhard, Stéphane Ducasse and Gabriela Arévalo
                             Software Composition Group
                           University of Berne, Switzerland
Overview
        “too high”...
   ...cancelled




                          duplicated
                          methods




ASE‘05 - Identifying Traits with FCA   Adrian Lienhard - lienhard@iam.unibe.ch   2 / 16
Overview
        “too high”...
   ...cancelled




                          duplicated
                          methods




ASE‘05 - Identifying Traits with FCA   Adrian Lienhard - lienhard@iam.unibe.ch   2 / 16
Overview
        “too high”...
   ...cancelled




                          duplicated
                          methods                                   traits




ASE‘05 - Identifying Traits with FCA   Adrian Lienhard - lienhard@iam.unibe.ch   2 / 16
Overview
        “too high”...
   ...cancelled
                                          FCA



                          duplicated
                          methods                                   traits




ASE‘05 - Identifying Traits with FCA   Adrian Lienhard - lienhard@iam.unibe.ch   2 / 16
Background: Traits in a Nutshell
                                                             Generic properties
         GraphicalObject
                                                           Colored        Bordered
   Circle                Polygon




ASE‘05 - Identifying Traits with FCA   Adrian Lienhard - lienhard@iam.unibe.ch   3 / 16
Background: Traits in a Nutshell
                                                              Generic properties
          GraphicalObject
                                                            Colored        Bordered
    Circle                Polygon

ColoredCircle        BorderedColoredPol.

  Colored                Bordered
                          Colored




 ASE‘05 - Identifying Traits with FCA   Adrian Lienhard - lienhard@iam.unibe.ch   3 / 16
Background: Traits in a Nutshell
                                                              Generic properties
          GraphicalObject
                                                            Colored        Bordered
    Circle                Polygon

ColoredCircle        BorderedColoredPol.               Single inheritance: limited
                                                       expressiveness
  Colored                Bordered
                                                       Multiple inheritance:
                          Colored
                                                       complexity
                                                       Mixin inheritance: fragility
Goal of traits: reuse mechanism                        due to linearization
avoiding complexity
 ASE‘05 - Identifying Traits with FCA   Adrian Lienhard - lienhard@iam.unibe.ch   3 / 16
Background: Traits in a Nutshell
Reuse mechanism                                Trait = “interface with implementation”
complementary to                                               TColored
inheritance [ECOOP’03]


                                                     {                       }
                                                             red      rgb
                                               provided      green    rgb:         required
Today in Perl 6, Squeak,                                     =
Scala, Fortress, ...                           methods                             methods
                                                             hash
                                                             ...
               ...                       ...

       ColoredCircle         BorderedColoredPol.
                                                            trait composition
                     TColored           TBordered



 ASE‘05 - Identifying Traits with FCA   Adrian Lienhard - lienhard@iam.unibe.ch   4 / 16
Roadmap

   ‣ FCA in a nutshell
   ‣ Approach overview
   ‣ Illustration of our approach on case study
   ‣ Evaluation of case study
   ‣ Conclusion


ASE‘05 - Identifying Traits with FCA   Adrian Lienhard - lienhard@iam.unibe.ch   5 / 16
FCA in a Nutshell
                         properties
                   small    far moon
           Mercur x
elements




              y
            Mars    x               x
           Jupiter           x      x
            Pluto   x        x      x


Concept: maximal group of elements
based on their common properties




      ASE‘05 - Identifying Traits with FCA   Adrian Lienhard - lienhard@iam.unibe.ch   6 / 16
FCA in a Nutshell
                         properties
                   small    far moon
           Mercur x
elements




              y
            Mars    x               x
           Jupiter           x      x
            Pluto   x        x      x


Concept: maximal group of elements
based on their common properties


 {Mars, Pluto, Jupiter},{moon}



      ASE‘05 - Identifying Traits with FCA   Adrian Lienhard - lienhard@iam.unibe.ch   6 / 16
FCA in a Nutshell
                         properties
                   small    far moon
           Mercur x
elements




              y
            Mars    x               x
           Jupiter           x      x
            Pluto   x        x      x


Concept: maximal group of elements
based on their common properties


 {Mars, Pluto, Jupiter},{moon}
     {Pluto, Jupiter},{moon, far}

      ASE‘05 - Identifying Traits with FCA   Adrian Lienhard - lienhard@iam.unibe.ch   6 / 16
FCA in a Nutshell
                         properties                                     Me, Ma, Ju, Pl
                   small    far moon
           Mercur x
elements




              y
            Mars    x               x                           Me, Ma, Pl         Ma, Ju, Pl
           Jupiter           x      x                            small              moon
            Pluto   x        x      x
                                                                 Ma, Pl             Ju, Pl
                                                               small, moon         moon, far
Concept: maximal group of elements
                                                                             Pl
based on their common properties
                                                                      small, moon, far

                                                                 Concept Lattice
 {Mars, Pluto, Jupiter},{moon}
     {Pluto, Jupiter},{moon, far}

      ASE‘05 - Identifying Traits with FCA   Adrian Lienhard - lienhard@iam.unibe.ch     6 / 16
FCA in a Nutshell
                         properties                                     Me, Ma, Ju, Pl
                   small    far moon
           Mercur x
elements




              y
            Mars    x               x                           Me, Ma, Pl         Ma, Ju, Pl
           Jupiter           x      x                            small              moon
            Pluto   x        x      x
                                                                 Ma, Pl             Ju, Pl
                                                               small, moon         moon, far
Concept: maximal group of elements
                                                                             Pl
based on their common properties
                                                                      small, moon, far

                                                                 Concept Lattice
 {Mars, Pluto, Jupiter},{moon}               less elements
     {Pluto, Jupiter},{moon, far}            more properties

      ASE‘05 - Identifying Traits with FCA   Adrian Lienhard - lienhard@iam.unibe.ch     6 / 16
Approach Overview
  Stage 1

           input generation FCA application              filtering      manual selection




                    {
  Stage 2
   for each class
        and trait
                             input generation       FCA application manual selection


ASE‘05 - Identifying Traits with FCA   Adrian Lienhard - lienhard@iam.unibe.ch   7 / 16
Case Study

   ‣ ST-80 Stream and Collection libraries
   ‣ Comparison with purely manual refactoring
       [OOPSLA’03]
   ‣ Illustration of our approach on example of
       Stream hierarchy...



ASE‘05 - Identifying Traits with FCA   Adrian Lienhard - lienhard@iam.unibe.ch   8 / 16
Generating Input for FCA
            Detecting cancellations and duplications                                            Stage 1


Identify real interface of a class taking into account...

              ...
                     Stream
                                                      Idiom “too high”
              next
              boolean                                   ‣ implement methods “too
                                 sends message next
              int32
              ...
                                                          high” in common superclass
                                                        ‣ (implicitly) cancel methods
       WriteStream             ReadStream
                                                          in inappropriate subclasses
 ...                     ...

   next                  next
 ...                     ....

 ReadWriteStream
 ...
 next                                                 Fact ST-80 Collection library:
 ...                                                  131 methods too high (~10%), and
                                                      of those, 106 implicitly cancelled

       ASE‘05 - Identifying Traits with FCA      Adrian Lienhard - lienhard@iam.unibe.ch   9 / 16
Generating Input for FCA
              Detecting cancellations and duplications                                            Stage 1


  Identify real interface of a class taking into account...

invokes         ...
                       Stream
                                                        Idiom “too high”
cancelled       next
                                                          ‣ implement methods “too
                boolean
method          int32              sends message next
                                                            high” in common superclass
                ...
                                                          ‣ (implicitly) cancel methods
         WriteStream             ReadStream
                                                            in inappropriate subclasses
   ...                     ...

     next                  next
   ...                     ....

   ReadWriteStream
   ...
   next                                                 Fact ST-80 Collection library:
   ...                                                  131 methods too high (~10%), and
                                                        of those, 106 implicitly cancelled

         ASE‘05 - Identifying Traits with FCA      Adrian Lienhard - lienhard@iam.unibe.ch   9 / 16
Applying FCA                                                          Stage 1
Elements: all concrete classes
Properties: all concrete methods (identifying duplications)
Mapping: method in the real interface of the class
                                       WS, RWS, RS
                                          atEnd

                            WS, RWS                    RWS, RS
                         atEnd, nextPut:,             atEnd, next,
                            next:put:                   boolean

                  WS                         RWS                         RS
            atEnd, nextPut:,           atEnd, nextPut:,              atEnd, next,
               next:put:,               next:put:, next,               boolean,
               contents1              boolean, contents2              contents3


                                      atEnd, nextPut:,
                                       next:put: next,
                                    boolean, contents1,2,3


ASE‘05 - Identifying Traits with FCA        Adrian Lienhard - lienhard@iam.unibe.ch 10 / 16
Filtering                                                Stage 1


   ‣ reduce properties-sets to delta between
     sub-/superconcept
   ‣ remove concepts with no classes
                                       WS, RWS, RS
                                           atEnd

                             WS, RWS                  RWS, RS
                             nextPut:,
                                                   next, boolean
                             next:put:

                    WS                      RWS                    RS
                 contents1                contents2             contents3




ASE‘05 - Identifying Traits with FCA     Adrian Lienhard - lienhard@iam.unibe.ch 11 / 16
Selecting Traits and Hierarchy
       Reconstruction                                                                Stage 1



     Partly manual task: deciding whether a
     concept becomes a class or a trait

                                        Stream


               WriteStream         ReadWriteStream         ReadStream


                      TWriteableStream            TReadableStream




ASE‘05 - Identifying Traits with FCA   Adrian Lienhard - lienhard@iam.unibe.ch 12 / 16
Invocation Analysis                                                       Stage 2




 Generating input: analyzing transitive method
 invocations of the class/trait
 Applying FCA
  ‣ elements: all methods of the class/trait

  ‣ properties: (transitive) method invocations

  ‣ mapping: identifying invocations with methods




ASE‘05 - Identifying Traits with FCA   Adrian Lienhard - lienhard@iam.unibe.ch 13 / 16
Selecting Traits                                                    Stage 2

     Manual task of selecting traits.
     Lattice provides interesting alternatives:
      ‣ Additional methods in super-concepts
      ‣ Fewer methods in sub-concepts
                                        Stream


                 ReadStream       ReadWriteStream       WriteStream


                      TReadableStream            TWriteableStream

                        TReadableMultiple           TWriteablePutData

                         TReadableFileIn         TWriteablePutCharacter

                                                    TWriteableMultiple


ASE‘05 - Identifying Traits with FCA    Adrian Lienhard - lienhard@iam.unibe.ch 14 / 16
Comparison with
          Manual Refactoring
  Stream library
   ‣ almost identical result: inheritance reshaping + two
     main traits
   ‣ difference: conceptual vs. functional sub-traits

  Collection library
   ‣ Manual refactoring has identified more traits
   ‣ Different layers of traits with overriding behavior
   ‣ Our approach curative, manual approach speculative


ASE‘05 - Identifying Traits with FCA   Adrian Lienhard - lienhard@iam.unibe.ch 15 / 16
Conclusion
   ‣ Succeeded in curing problems by
       restructuring hierarchy with traits (stage 1)
   ‣ Successful identification of fine-grained traits
       also when code is not shared (stage 2).
   ‣ Limitations:
       • Detection based on conceptual meaning of
         methods alone not possible
       • Missing methods can cause too small traits



ASE‘05 - Identifying Traits with FCA   Adrian Lienhard - lienhard@iam.unibe.ch 16 / 16
Conclusion
   ‣ Succeeded in curing problems by
       restructuring hierarchy with traits (stage 1)
   ‣ Successful identification of fine-grained traits
       also when code is not shared (stage 2).
   ‣ Limitations:
       • Detection based on conceptual meaning of
         methods alone not possible
       • Missing methods can cause too small traits

                                Questions?
ASE‘05 - Identifying Traits with FCA   Adrian Lienhard - lienhard@iam.unibe.ch 16 / 16
Refactored Collection
          Hierarchy
                                                           Legend:

                        Collection                                     inherits from
                                                                       composed from

        Set                             SequenceableCollection



                  SortedCollection         OrderedCollection             Array


   TRemoving-               TOrderedSorted-             TSequenced-
    Elements                   Common                  ElementAccess




ASE‘05 - Identifying Traits with FCA   Adrian Lienhard - lienhard@iam.unibe.ch 17 / 16

Contenu connexe

En vedette (19)

Master Teset Specification SRCP
Master Teset Specification SRCPMaster Teset Specification SRCP
Master Teset Specification SRCP
 
Week9
Week9Week9
Week9
 
Phenomenal Oct 1, 2009
Phenomenal Oct 1, 2009Phenomenal Oct 1, 2009
Phenomenal Oct 1, 2009
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 
Biopython at BOSC 2010
Biopython at BOSC 2010Biopython at BOSC 2010
Biopython at BOSC 2010
 
Mpv2010
Mpv2010Mpv2010
Mpv2010
 
Itf ipp ch08_2012_final
Itf ipp ch08_2012_finalItf ipp ch08_2012_final
Itf ipp ch08_2012_final
 
Phenomenal Oct 8, 2009
Phenomenal Oct 8, 2009Phenomenal Oct 8, 2009
Phenomenal Oct 8, 2009
 
Gr trav f. risk cv s.metabolique
Gr trav f. risk cv s.metaboliqueGr trav f. risk cv s.metabolique
Gr trav f. risk cv s.metabolique
 
Uzbekistan caving 2011
Uzbekistan caving 2011Uzbekistan caving 2011
Uzbekistan caving 2011
 
Farma
FarmaFarma
Farma
 
Contention
ContentionContention
Contention
 
201505 CSE340 Lecture 02
201505 CSE340 Lecture 02201505 CSE340 Lecture 02
201505 CSE340 Lecture 02
 
Final programme 27 06
Final programme 27 06Final programme 27 06
Final programme 27 06
 
201506 CSE340 Lecture 23
201506 CSE340 Lecture 23201506 CSE340 Lecture 23
201506 CSE340 Lecture 23
 
201505 CSE340 Lecture 03
201505 CSE340 Lecture 03201505 CSE340 Lecture 03
201505 CSE340 Lecture 03
 
201003 Alice (part 1/15)
201003 Alice (part 1/15)201003 Alice (part 1/15)
201003 Alice (part 1/15)
 
A73A CQWW 2012 Contest operation from the Desert of Qatar
A73A CQWW 2012 Contest operation from the Desert of QatarA73A CQWW 2012 Contest operation from the Desert of Qatar
A73A CQWW 2012 Contest operation from the Desert of Qatar
 
Eddie Slide Show
Eddie Slide ShowEddie Slide Show
Eddie Slide Show
 

Plus de lienhard

Virtual Machines Lecture
Virtual Machines LectureVirtual Machines Lecture
Virtual Machines Lecturelienhard
 
Flow-Centric, Back-In-Time Debugging
Flow-Centric, Back-In-Time DebuggingFlow-Centric, Back-In-Time Debugging
Flow-Centric, Back-In-Time Debugginglienhard
 
OORPT Dynamic Analysis
OORPT Dynamic AnalysisOORPT Dynamic Analysis
OORPT Dynamic Analysislienhard
 
Dynamic Object Flow Analysis (PhD Defense)
Dynamic Object Flow Analysis (PhD Defense)Dynamic Object Flow Analysis (PhD Defense)
Dynamic Object Flow Analysis (PhD Defense)lienhard
 
Rapid Prototyping Of Visualizations Using Mondrian
Rapid Prototyping Of Visualizations Using MondrianRapid Prototyping Of Visualizations Using Mondrian
Rapid Prototyping Of Visualizations Using Mondrianlienhard
 
Tracking Objects To Detect Feature Dependencies
Tracking Objects To Detect Feature DependenciesTracking Objects To Detect Feature Dependencies
Tracking Objects To Detect Feature Dependencieslienhard
 
Practical Object-Oriented Back-in-Time Debugging
Practical Object-Oriented Back-in-Time DebuggingPractical Object-Oriented Back-in-Time Debugging
Practical Object-Oriented Back-in-Time Debugginglienhard
 
Test Blueprints
Test BlueprintsTest Blueprints
Test Blueprintslienhard
 
Object Flow Analysis
Object Flow AnalysisObject Flow Analysis
Object Flow Analysislienhard
 

Plus de lienhard (10)

Chicken
ChickenChicken
Chicken
 
Virtual Machines Lecture
Virtual Machines LectureVirtual Machines Lecture
Virtual Machines Lecture
 
Flow-Centric, Back-In-Time Debugging
Flow-Centric, Back-In-Time DebuggingFlow-Centric, Back-In-Time Debugging
Flow-Centric, Back-In-Time Debugging
 
OORPT Dynamic Analysis
OORPT Dynamic AnalysisOORPT Dynamic Analysis
OORPT Dynamic Analysis
 
Dynamic Object Flow Analysis (PhD Defense)
Dynamic Object Flow Analysis (PhD Defense)Dynamic Object Flow Analysis (PhD Defense)
Dynamic Object Flow Analysis (PhD Defense)
 
Rapid Prototyping Of Visualizations Using Mondrian
Rapid Prototyping Of Visualizations Using MondrianRapid Prototyping Of Visualizations Using Mondrian
Rapid Prototyping Of Visualizations Using Mondrian
 
Tracking Objects To Detect Feature Dependencies
Tracking Objects To Detect Feature DependenciesTracking Objects To Detect Feature Dependencies
Tracking Objects To Detect Feature Dependencies
 
Practical Object-Oriented Back-in-Time Debugging
Practical Object-Oriented Back-in-Time DebuggingPractical Object-Oriented Back-in-Time Debugging
Practical Object-Oriented Back-in-Time Debugging
 
Test Blueprints
Test BlueprintsTest Blueprints
Test Blueprints
 
Object Flow Analysis
Object Flow AnalysisObject Flow Analysis
Object Flow Analysis
 

Dernier

Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
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 Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
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
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
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
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 

Dernier (20)

Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
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 Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 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
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
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
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 

Identifying Traits with Formal Concept Analysis

  • 1. Identifying Traits with Formal Concept Analysis Adrian Lienhard, Stéphane Ducasse and Gabriela Arévalo Software Composition Group University of Berne, Switzerland
  • 2. Overview “too high”... ...cancelled duplicated methods ASE‘05 - Identifying Traits with FCA Adrian Lienhard - lienhard@iam.unibe.ch 2 / 16
  • 3. Overview “too high”... ...cancelled duplicated methods ASE‘05 - Identifying Traits with FCA Adrian Lienhard - lienhard@iam.unibe.ch 2 / 16
  • 4. Overview “too high”... ...cancelled duplicated methods traits ASE‘05 - Identifying Traits with FCA Adrian Lienhard - lienhard@iam.unibe.ch 2 / 16
  • 5. Overview “too high”... ...cancelled FCA duplicated methods traits ASE‘05 - Identifying Traits with FCA Adrian Lienhard - lienhard@iam.unibe.ch 2 / 16
  • 6. Background: Traits in a Nutshell Generic properties GraphicalObject Colored Bordered Circle Polygon ASE‘05 - Identifying Traits with FCA Adrian Lienhard - lienhard@iam.unibe.ch 3 / 16
  • 7. Background: Traits in a Nutshell Generic properties GraphicalObject Colored Bordered Circle Polygon ColoredCircle BorderedColoredPol. Colored Bordered Colored ASE‘05 - Identifying Traits with FCA Adrian Lienhard - lienhard@iam.unibe.ch 3 / 16
  • 8. Background: Traits in a Nutshell Generic properties GraphicalObject Colored Bordered Circle Polygon ColoredCircle BorderedColoredPol. Single inheritance: limited expressiveness Colored Bordered Multiple inheritance: Colored complexity Mixin inheritance: fragility Goal of traits: reuse mechanism due to linearization avoiding complexity ASE‘05 - Identifying Traits with FCA Adrian Lienhard - lienhard@iam.unibe.ch 3 / 16
  • 9. Background: Traits in a Nutshell Reuse mechanism Trait = “interface with implementation” complementary to TColored inheritance [ECOOP’03] { } red rgb provided green rgb: required Today in Perl 6, Squeak, = Scala, Fortress, ... methods methods hash ... ... ... ColoredCircle BorderedColoredPol. trait composition TColored TBordered ASE‘05 - Identifying Traits with FCA Adrian Lienhard - lienhard@iam.unibe.ch 4 / 16
  • 10. Roadmap ‣ FCA in a nutshell ‣ Approach overview ‣ Illustration of our approach on case study ‣ Evaluation of case study ‣ Conclusion ASE‘05 - Identifying Traits with FCA Adrian Lienhard - lienhard@iam.unibe.ch 5 / 16
  • 11. FCA in a Nutshell properties small far moon Mercur x elements y Mars x x Jupiter x x Pluto x x x Concept: maximal group of elements based on their common properties ASE‘05 - Identifying Traits with FCA Adrian Lienhard - lienhard@iam.unibe.ch 6 / 16
  • 12. FCA in a Nutshell properties small far moon Mercur x elements y Mars x x Jupiter x x Pluto x x x Concept: maximal group of elements based on their common properties {Mars, Pluto, Jupiter},{moon} ASE‘05 - Identifying Traits with FCA Adrian Lienhard - lienhard@iam.unibe.ch 6 / 16
  • 13. FCA in a Nutshell properties small far moon Mercur x elements y Mars x x Jupiter x x Pluto x x x Concept: maximal group of elements based on their common properties {Mars, Pluto, Jupiter},{moon} {Pluto, Jupiter},{moon, far} ASE‘05 - Identifying Traits with FCA Adrian Lienhard - lienhard@iam.unibe.ch 6 / 16
  • 14. FCA in a Nutshell properties Me, Ma, Ju, Pl small far moon Mercur x elements y Mars x x Me, Ma, Pl Ma, Ju, Pl Jupiter x x small moon Pluto x x x Ma, Pl Ju, Pl small, moon moon, far Concept: maximal group of elements Pl based on their common properties small, moon, far Concept Lattice {Mars, Pluto, Jupiter},{moon} {Pluto, Jupiter},{moon, far} ASE‘05 - Identifying Traits with FCA Adrian Lienhard - lienhard@iam.unibe.ch 6 / 16
  • 15. FCA in a Nutshell properties Me, Ma, Ju, Pl small far moon Mercur x elements y Mars x x Me, Ma, Pl Ma, Ju, Pl Jupiter x x small moon Pluto x x x Ma, Pl Ju, Pl small, moon moon, far Concept: maximal group of elements Pl based on their common properties small, moon, far Concept Lattice {Mars, Pluto, Jupiter},{moon} less elements {Pluto, Jupiter},{moon, far} more properties ASE‘05 - Identifying Traits with FCA Adrian Lienhard - lienhard@iam.unibe.ch 6 / 16
  • 16. Approach Overview Stage 1 input generation FCA application filtering manual selection { Stage 2 for each class and trait input generation FCA application manual selection ASE‘05 - Identifying Traits with FCA Adrian Lienhard - lienhard@iam.unibe.ch 7 / 16
  • 17. Case Study ‣ ST-80 Stream and Collection libraries ‣ Comparison with purely manual refactoring [OOPSLA’03] ‣ Illustration of our approach on example of Stream hierarchy... ASE‘05 - Identifying Traits with FCA Adrian Lienhard - lienhard@iam.unibe.ch 8 / 16
  • 18. Generating Input for FCA Detecting cancellations and duplications Stage 1 Identify real interface of a class taking into account... ... Stream Idiom “too high” next boolean ‣ implement methods “too sends message next int32 ... high” in common superclass ‣ (implicitly) cancel methods WriteStream ReadStream in inappropriate subclasses ... ... next next ... .... ReadWriteStream ... next Fact ST-80 Collection library: ... 131 methods too high (~10%), and of those, 106 implicitly cancelled ASE‘05 - Identifying Traits with FCA Adrian Lienhard - lienhard@iam.unibe.ch 9 / 16
  • 19. Generating Input for FCA Detecting cancellations and duplications Stage 1 Identify real interface of a class taking into account... invokes ... Stream Idiom “too high” cancelled next ‣ implement methods “too boolean method int32 sends message next high” in common superclass ... ‣ (implicitly) cancel methods WriteStream ReadStream in inappropriate subclasses ... ... next next ... .... ReadWriteStream ... next Fact ST-80 Collection library: ... 131 methods too high (~10%), and of those, 106 implicitly cancelled ASE‘05 - Identifying Traits with FCA Adrian Lienhard - lienhard@iam.unibe.ch 9 / 16
  • 20. Applying FCA Stage 1 Elements: all concrete classes Properties: all concrete methods (identifying duplications) Mapping: method in the real interface of the class WS, RWS, RS atEnd WS, RWS RWS, RS atEnd, nextPut:, atEnd, next, next:put: boolean WS RWS RS atEnd, nextPut:, atEnd, nextPut:, atEnd, next, next:put:, next:put:, next, boolean, contents1 boolean, contents2 contents3 atEnd, nextPut:, next:put: next, boolean, contents1,2,3 ASE‘05 - Identifying Traits with FCA Adrian Lienhard - lienhard@iam.unibe.ch 10 / 16
  • 21. Filtering Stage 1 ‣ reduce properties-sets to delta between sub-/superconcept ‣ remove concepts with no classes WS, RWS, RS atEnd WS, RWS RWS, RS nextPut:, next, boolean next:put: WS RWS RS contents1 contents2 contents3 ASE‘05 - Identifying Traits with FCA Adrian Lienhard - lienhard@iam.unibe.ch 11 / 16
  • 22. Selecting Traits and Hierarchy Reconstruction Stage 1 Partly manual task: deciding whether a concept becomes a class or a trait Stream WriteStream ReadWriteStream ReadStream TWriteableStream TReadableStream ASE‘05 - Identifying Traits with FCA Adrian Lienhard - lienhard@iam.unibe.ch 12 / 16
  • 23. Invocation Analysis Stage 2 Generating input: analyzing transitive method invocations of the class/trait Applying FCA ‣ elements: all methods of the class/trait ‣ properties: (transitive) method invocations ‣ mapping: identifying invocations with methods ASE‘05 - Identifying Traits with FCA Adrian Lienhard - lienhard@iam.unibe.ch 13 / 16
  • 24. Selecting Traits Stage 2 Manual task of selecting traits. Lattice provides interesting alternatives: ‣ Additional methods in super-concepts ‣ Fewer methods in sub-concepts Stream ReadStream ReadWriteStream WriteStream TReadableStream TWriteableStream TReadableMultiple TWriteablePutData TReadableFileIn TWriteablePutCharacter TWriteableMultiple ASE‘05 - Identifying Traits with FCA Adrian Lienhard - lienhard@iam.unibe.ch 14 / 16
  • 25. Comparison with Manual Refactoring Stream library ‣ almost identical result: inheritance reshaping + two main traits ‣ difference: conceptual vs. functional sub-traits Collection library ‣ Manual refactoring has identified more traits ‣ Different layers of traits with overriding behavior ‣ Our approach curative, manual approach speculative ASE‘05 - Identifying Traits with FCA Adrian Lienhard - lienhard@iam.unibe.ch 15 / 16
  • 26. Conclusion ‣ Succeeded in curing problems by restructuring hierarchy with traits (stage 1) ‣ Successful identification of fine-grained traits also when code is not shared (stage 2). ‣ Limitations: • Detection based on conceptual meaning of methods alone not possible • Missing methods can cause too small traits ASE‘05 - Identifying Traits with FCA Adrian Lienhard - lienhard@iam.unibe.ch 16 / 16
  • 27. Conclusion ‣ Succeeded in curing problems by restructuring hierarchy with traits (stage 1) ‣ Successful identification of fine-grained traits also when code is not shared (stage 2). ‣ Limitations: • Detection based on conceptual meaning of methods alone not possible • Missing methods can cause too small traits Questions? ASE‘05 - Identifying Traits with FCA Adrian Lienhard - lienhard@iam.unibe.ch 16 / 16
  • 28. Refactored Collection Hierarchy Legend: Collection inherits from composed from Set SequenceableCollection SortedCollection OrderedCollection Array TRemoving- TOrderedSorted- TSequenced- Elements Common ElementAccess ASE‘05 - Identifying Traits with FCA Adrian Lienhard - lienhard@iam.unibe.ch 17 / 16