SlideShare a Scribd company logo
Restructuring



Tudor Gîrba
www.tudorgirba.com
fo
                                                              rw
                                              g
                                            rin




                                                                ar
                                         ee




                                                                  d
                                        gin




                                                                   en
                                                                       gin
                                       en




                                                                        ee
                                   se




                                                                         rin
                                 erv




                                                                             g
                                re




{               {
                        {                                                        {               {
    {
                            }                                                        {               {
        }
        }                                         actual development                     }               }
            }       {       }                                                                }               }
fo
                                                              rw
                                              g
                                            rin




                                                               ar
                                         ee




                                                                   d
                                        gin




                                                                   en
                                                                       gin
                                       en




                                                                        ee
                                   se




                                                                         rin
                                 erv




                                                                             g
                                re




{               {
                        {                                                        {               {
    {
                            }                                                        {               {
        }
        }                                     restructuring                              }               }
            }       {       }                                                                }               }
cycle
     ginee ring life
Reen




                                                              fo
                                                              rw
                                              g
                                            rin




                                                               ar
                                         ee




                                                                   d
                                        gin




                                                                   en
                                                                       gin
                                       en




                                                                        ee
                                   se




                                                                         rin
                                 erv




                                                                             g
                                re




{               {
                        {                                                        {               {
    {
                            }                                                        {               {
        }
        }                                     restructuring                              }               }
            }       {       }                                                                }               }
{               {
                                   What?
                        {                       {               {
    {
                            }                       {               {
        }
        }                       restructuring           }               }
            }       {       }                               }               }
Restructuring is often taken
as a synonym of refactoring
Refactoring is a disciplined
technique for restructuring an
existing body of code, altering its
internal structure without
changing its external behavior
Refactoring is
behavior-preserving
transformation
Restructuring is transforming
a program to fit current needs
Why?
{               {
                                   What?
                        {                       {               {
    {
                            }                       {               {
        }
        }                       restructuring           }               }
            }       {       }                               }               }
Software should be
habitable
The secret to tidiness is to have a
place for every thing




                                             Denker
                                      Markus
The secret to tidiness is to find the right
place for every thing




                                                    Denker
                                             Markus
If it stinks, change it




                                   Be   ck
                          Gr andma
How?
                                   Why?
{               {
                                   What?
                        {                       {               {
    {
                            }                       {               {
        }
        }                       restructuring           }               }
            }       {       }                               }               }
Take a critical look at design
A God Class centralizes too much intelligence


    Class uses directly more than a
    few attributes of other classes

            ATFD > FEW




     Functional complexity of the
          class is very high
                                      AND      GodClass
         WMC ! VERY HIGH




        Class cohesion is low


         TCC < ONE THIRD

                                                                  006
                                                      ari nescu 2
                                            L anza, M
ModelFacade
from ArgoUML
p God Class
Split u
                     ModelFacade
                     from ArgoUML




                                        2
                          er etal 200
                     Demey
d than done
Easi er sai




                                               2
                                 er etal 200
                            Demey
also w rap it
You can




                                           2
                             er etal 200
                        Demey
you do not
 Maybe uch it at all
need to to


           God Class
       in the last version

       isGodClass(last)


                             AND   Harmless God Class


       Stable throughout
          the history

        Stability > 90%



                                                          4
                                           Ratiu etal, 200
Client   Provider
         service()
Client   Intermediary    Provider
         getProvider()   service()
Client           Intermediary           Provider
                 getProvider()          service()




this.intermediary.provider.service();
Provider2
                                          service2()



Client           Intermediary             Provider
                 getProvider()            service()



                                          Provider3
                                          service3()
this.intermediary.provider.service();
this.intermediary.provider2.service2();
this.intermediary.provider3.service3();
Provider2
                                          service2()



Client            Intermediary            Provider
                  getProvider()           service()



                                          Provider3
                                          service3()
this.intermediary.provider.service();
this.intermediary.provider2.service2();
this.intermediary.provider3.service3();


                                              to str angers
                         eter : D on’t talk
                  of Dem
         T he Law
Code
         te Nav igation
E limina                                   Provider2
                                           service2()



      Client            Intermediary       Provider
                        fullService()      service()



                                           Provider3
                                           service3()
       this.intermediary.fullService();




                                                          2
                                               er etal 200
                                          Demey
ge inte rfaces
                    ad to hu
     t: This can le                           Provider2
Cavea                                         service2()



       Client            Intermediary         Provider
                         fullService()        service()



                                              Provider3
                                              service3()
        this.intermediary.fullService();




                                                             2
                                                  er etal 200
                                             Demey
Middl e Man
R emove                            Provider2
                                   service2()



     Client                        Provider
                                   service()



                                   Provider3
                                   service3()
      this.provider.service();
      this.provider2.service2();
      this.provider3.service3();




                                     Fow ler 1999
An Envious Method is more interested
in data from a handful of other classes

Method uses directly more than
a few attributes of other classes

         ATFD > FEW




Method uses far more attributes
 of other classes than its own
                                    AND     Feature Envy
      LAA < ONE THIRD




  The used quot;foreignquot; attributes
belong to very few other classes

          FDP ! FEW

                                                                006
                                                    ari nescu 2
                                          L anza, M
ser to Data
       Behavi or Clo
Move
Data Classes are dumb data holders




   Interface of class reveals data
    rather than offering services

       WOC < ONE THIRD
                                       AND      Data Class


Class reveals many attributes and is
           not complex




                                                                   006
                                                       ari nescu 2
                                             L anza, M
ser to Data
       Behavi or Clo
Move
Significant Duplication




                                               006
                                   ari nescu 2
                         L anza, M
A         A

m1
         m1'


                          m3


m2
         m2'




                                      6
                           ne scu 200
               Lanza, Mari
A                          A

                               m3




     B            C        B                 C

m1           m2       m1                m2




                                                  6
                                       ne scu 200
                           Lanza, Mari
Restructuring can also improve performance
BusinessObject




Client   BusinessSessionBean




         BusinessEntityBean
BusinessObject


         SessionFacade

Client                   BusinessSessionBean




                         BusinessEntityBean




                                  java .sun.com
ModelFacade
        from ArgoUML




              es are good,
Not al l Facad od :)
    some    are G
Trouble never comes alone




                            Ano nymous
Redistribute                      Transform conditionals
         responsibilities                      to Polymorphism



   Eliminate         Split up      Transform Client        ...
Navigation Code     God Class        Type Checks



        Move Behavior           Introduce Null Object
        Closer to Data
es pro blems
   ode co rrelat
inC
When?
                                   How?
                                   Why?
{               {
                                   What?
                        {                       {               {
    {
                            }                       {               {
        }
        }                       restructuring           }               }
            }       {       }                               }               }
Restructure all the time
Restructure all the time

                      his fea sible?
         … hm m, is t
It is feasible
Development   Maintenance
are evolution
Softw
Tudor Gîrba
       www.tudorgirba.com




creativecommons.org/licenses/by/3.0/

More Related Content

Viewers also liked

Software understanding in the large (EVO 2008)
Software understanding in the large (EVO 2008)Software understanding in the large (EVO 2008)
Software understanding in the large (EVO 2008)
Tudor Girba
 
Think tablet first
Think tablet firstThink tablet first
Think tablet first
Henry Jacob
 
Our Shared Fashion Mission - form
Our Shared Fashion Mission - formOur Shared Fashion Mission - form
Our Shared Fashion Mission - formmartap
 
Demo-driven innovation (University of Zurich, June 2013)
Demo-driven innovation (University of Zurich, June 2013)Demo-driven innovation (University of Zurich, June 2013)
Demo-driven innovation (University of Zurich, June 2013)
Tudor Girba
 
Social goes mobile - TNS May 2010
Social goes mobile - TNS May 2010Social goes mobile - TNS May 2010
Social goes mobile - TNS May 2010
Mundo Contact
 
Presentacio etwinning Secundària
Presentacio etwinning SecundàriaPresentacio etwinning Secundària
Presentacio etwinning Secundària
martap
 
Apache Camel: rotas para as suas mensagens
Apache Camel: rotas para as suas mensagensApache Camel: rotas para as suas mensagens
Apache Camel: rotas para as suas mensagens
Bruno Borges
 
Sonrie siempre
Sonrie siempreSonrie siempre
Sonrie siempre
Lilian Gonzalez
 
Migration and Testing (EVO 2008)
Migration and Testing (EVO 2008)Migration and Testing (EVO 2008)
Migration and Testing (EVO 2008)
Tudor Girba
 
Software Visualization (EVO 2008)
Software Visualization (EVO 2008)Software Visualization (EVO 2008)
Software Visualization (EVO 2008)
Tudor Girba
 
Spanish catalan analysis of the results
Spanish catalan analysis of the resultsSpanish catalan analysis of the results
Spanish catalan analysis of the resultsmartap
 
Beyond software evolution: Software environmentalism
Beyond software evolution: Software environmentalismBeyond software evolution: Software environmentalism
Beyond software evolution: Software environmentalism
Tudor Girba
 

Viewers also liked (12)

Software understanding in the large (EVO 2008)
Software understanding in the large (EVO 2008)Software understanding in the large (EVO 2008)
Software understanding in the large (EVO 2008)
 
Think tablet first
Think tablet firstThink tablet first
Think tablet first
 
Our Shared Fashion Mission - form
Our Shared Fashion Mission - formOur Shared Fashion Mission - form
Our Shared Fashion Mission - form
 
Demo-driven innovation (University of Zurich, June 2013)
Demo-driven innovation (University of Zurich, June 2013)Demo-driven innovation (University of Zurich, June 2013)
Demo-driven innovation (University of Zurich, June 2013)
 
Social goes mobile - TNS May 2010
Social goes mobile - TNS May 2010Social goes mobile - TNS May 2010
Social goes mobile - TNS May 2010
 
Presentacio etwinning Secundària
Presentacio etwinning SecundàriaPresentacio etwinning Secundària
Presentacio etwinning Secundària
 
Apache Camel: rotas para as suas mensagens
Apache Camel: rotas para as suas mensagensApache Camel: rotas para as suas mensagens
Apache Camel: rotas para as suas mensagens
 
Sonrie siempre
Sonrie siempreSonrie siempre
Sonrie siempre
 
Migration and Testing (EVO 2008)
Migration and Testing (EVO 2008)Migration and Testing (EVO 2008)
Migration and Testing (EVO 2008)
 
Software Visualization (EVO 2008)
Software Visualization (EVO 2008)Software Visualization (EVO 2008)
Software Visualization (EVO 2008)
 
Spanish catalan analysis of the results
Spanish catalan analysis of the resultsSpanish catalan analysis of the results
Spanish catalan analysis of the results
 
Beyond software evolution: Software environmentalism
Beyond software evolution: Software environmentalismBeyond software evolution: Software environmentalism
Beyond software evolution: Software environmentalism
 

Similar to Restructuring (EVO 2008)

Reverse Engineering (EVO 2008)
Reverse Engineering (EVO 2008)Reverse Engineering (EVO 2008)
Reverse Engineering (EVO 2008)
Tudor Girba
 
Modeling History to Understand Software Evolution with Hismo 2008-03-12
Modeling History to Understand Software Evolution with Hismo 2008-03-12Modeling History to Understand Software Evolution with Hismo 2008-03-12
Modeling History to Understand Software Evolution with Hismo 2008-03-12
Tudor Girba
 
Modeling History to Understand Software Evolution With Hismo 2008-02-25
Modeling History to Understand Software Evolution With Hismo 2008-02-25 Modeling History to Understand Software Evolution With Hismo 2008-02-25
Modeling History to Understand Software Evolution With Hismo 2008-02-25
Tudor Girba
 
05 Problem Detection
05 Problem Detection05 Problem Detection
05 Problem DetectionJorge Ressia
 
Humane assessment at ICSM 2010
Humane assessment at ICSM 2010Humane assessment at ICSM 2010
Humane assessment at ICSM 2010
Tudor Girba
 
Holistic software assessment at the University of Zurich
Holistic software assessment at the University of ZurichHolistic software assessment at the University of Zurich
Holistic software assessment at the University of Zurich
Tudor Girba
 
Pragmatic Design Quality Assessment - (Tutorial at ICSE 2008)
Pragmatic Design Quality Assessment - (Tutorial at ICSE 2008)Pragmatic Design Quality Assessment - (Tutorial at ICSE 2008)
Pragmatic Design Quality Assessment - (Tutorial at ICSE 2008)
Tudor Girba
 
History Analysis (EVO 2008)
History Analysis (EVO 2008)History Analysis (EVO 2008)
History Analysis (EVO 2008)
Tudor Girba
 
Enhancing agile development through software assessment
Enhancing agile development through software assessmentEnhancing agile development through software assessment
Enhancing agile development through software assessment
Tudor Girba
 
Humane assessment with Moose at Benevol 2010
Humane assessment with Moose at Benevol 2010Humane assessment with Moose at Benevol 2010
Humane assessment with Moose at Benevol 2010
Tudor Girba
 
Software in Pictures 2008-03-12
Software in Pictures 2008-03-12Software in Pictures 2008-03-12
Software in Pictures 2008-03-12
Tudor Girba
 
ncr annual reports 2002
ncr annual reports 2002ncr annual reports 2002
ncr annual reports 2002finance46
 

Similar to Restructuring (EVO 2008) (14)

Reverse Engineering (EVO 2008)
Reverse Engineering (EVO 2008)Reverse Engineering (EVO 2008)
Reverse Engineering (EVO 2008)
 
Modeling History to Understand Software Evolution with Hismo 2008-03-12
Modeling History to Understand Software Evolution with Hismo 2008-03-12Modeling History to Understand Software Evolution with Hismo 2008-03-12
Modeling History to Understand Software Evolution with Hismo 2008-03-12
 
Modeling History to Understand Software Evolution With Hismo 2008-02-25
Modeling History to Understand Software Evolution With Hismo 2008-02-25 Modeling History to Understand Software Evolution With Hismo 2008-02-25
Modeling History to Understand Software Evolution With Hismo 2008-02-25
 
05 Problem Detection
05 Problem Detection05 Problem Detection
05 Problem Detection
 
Humane assessment at ICSM 2010
Humane assessment at ICSM 2010Humane assessment at ICSM 2010
Humane assessment at ICSM 2010
 
Holistic software assessment at the University of Zurich
Holistic software assessment at the University of ZurichHolistic software assessment at the University of Zurich
Holistic software assessment at the University of Zurich
 
Pragmatic Design Quality Assessment - (Tutorial at ICSE 2008)
Pragmatic Design Quality Assessment - (Tutorial at ICSE 2008)Pragmatic Design Quality Assessment - (Tutorial at ICSE 2008)
Pragmatic Design Quality Assessment - (Tutorial at ICSE 2008)
 
History Analysis (EVO 2008)
History Analysis (EVO 2008)History Analysis (EVO 2008)
History Analysis (EVO 2008)
 
Enhancing agile development through software assessment
Enhancing agile development through software assessmentEnhancing agile development through software assessment
Enhancing agile development through software assessment
 
Humane assessment with Moose at Benevol 2010
Humane assessment with Moose at Benevol 2010Humane assessment with Moose at Benevol 2010
Humane assessment with Moose at Benevol 2010
 
Software in Pictures 2008-03-12
Software in Pictures 2008-03-12Software in Pictures 2008-03-12
Software in Pictures 2008-03-12
 
ncr annual reports 2002
ncr annual reports 2002ncr annual reports 2002
ncr annual reports 2002
 
Type Project1
Type Project1Type Project1
Type Project1
 
Electric bikes
Electric bikesElectric bikes
Electric bikes
 

More from Tudor Girba

Software craftsmanship meetup (Zurich 2015) on solving real problems without ...
Software craftsmanship meetup (Zurich 2015) on solving real problems without ...Software craftsmanship meetup (Zurich 2015) on solving real problems without ...
Software craftsmanship meetup (Zurich 2015) on solving real problems without ...
Tudor Girba
 
GT Spotter
GT SpotterGT Spotter
GT Spotter
Tudor Girba
 
Don't demo facts. Demo stories! (handouts)
Don't demo facts. Demo stories! (handouts)Don't demo facts. Demo stories! (handouts)
Don't demo facts. Demo stories! (handouts)
Tudor Girba
 
Don't demo facts. Demo stories!
Don't demo facts. Demo stories!Don't demo facts. Demo stories!
Don't demo facts. Demo stories!
Tudor Girba
 
Humane assessment on cards
Humane assessment on cardsHumane assessment on cards
Humane assessment on cards
Tudor Girba
 
Underneath Scrum: Reflective Thinking
Underneath Scrum: Reflective ThinkingUnderneath Scrum: Reflective Thinking
Underneath Scrum: Reflective Thinking
Tudor Girba
 
1800+ TED talks later
1800+ TED talks later1800+ TED talks later
1800+ TED talks later
Tudor Girba
 
Software assessment by example (lecture at the University of Bern)
Software assessment by example (lecture at the University of Bern)Software assessment by example (lecture at the University of Bern)
Software assessment by example (lecture at the University of Bern)
Tudor Girba
 
Humane assessment: Taming the elephant from the development room
Humane assessment: Taming the elephant from the development roomHumane assessment: Taming the elephant from the development room
Humane assessment: Taming the elephant from the development room
Tudor Girba
 
Moose: how to solve real problems without reading code
Moose: how to solve real problems without reading codeMoose: how to solve real problems without reading code
Moose: how to solve real problems without reading code
Tudor Girba
 
Software Environmentalism (ECOOP 2014 Keynote)
Software Environmentalism (ECOOP 2014 Keynote)Software Environmentalism (ECOOP 2014 Keynote)
Software Environmentalism (ECOOP 2014 Keynote)
Tudor Girba
 
The emergent nature of software systems
The emergent nature of software systemsThe emergent nature of software systems
The emergent nature of software systems
Tudor Girba
 
Presenting is storytelling at Uni Zurich - slides (2014-03-05)
Presenting is storytelling at Uni Zurich - slides (2014-03-05)Presenting is storytelling at Uni Zurich - slides (2014-03-05)
Presenting is storytelling at Uni Zurich - slides (2014-03-05)
Tudor Girba
 
Presenting is storytelling at Uni Zurich - handouts (2014-03-05)
Presenting is storytelling at Uni Zurich - handouts (2014-03-05)Presenting is storytelling at Uni Zurich - handouts (2014-03-05)
Presenting is storytelling at Uni Zurich - handouts (2014-03-05)
Tudor Girba
 
Underneath Scrum: Reflective Thinking (talk at Scrum Breakfast Bern, 2013)
Underneath Scrum: Reflective Thinking (talk at Scrum Breakfast Bern, 2013)Underneath Scrum: Reflective Thinking (talk at Scrum Breakfast Bern, 2013)
Underneath Scrum: Reflective Thinking (talk at Scrum Breakfast Bern, 2013)
Tudor Girba
 
Demo-driven innovation teaser
Demo-driven innovation teaserDemo-driven innovation teaser
Demo-driven innovation teaser
Tudor Girba
 
Software assessment essentials (lecture at the University of Bern 2013)
Software assessment essentials (lecture at the University of Bern 2013)Software assessment essentials (lecture at the University of Bern 2013)
Software assessment essentials (lecture at the University of Bern 2013)
Tudor Girba
 
Humane assessment with Moose at GOTO Aarhus 2011
Humane assessment with Moose at GOTO Aarhus 2011Humane assessment with Moose at GOTO Aarhus 2011
Humane assessment with Moose at GOTO Aarhus 2011
Tudor Girba
 
Flexible analysis with Moose at Jazoon 2011
Flexible analysis with Moose at Jazoon 2011Flexible analysis with Moose at Jazoon 2011
Flexible analysis with Moose at Jazoon 2011
Tudor Girba
 
Petitparser at the Deep into Smalltalk School 2011
Petitparser at the Deep into Smalltalk School 2011Petitparser at the Deep into Smalltalk School 2011
Petitparser at the Deep into Smalltalk School 2011
Tudor Girba
 

More from Tudor Girba (20)

Software craftsmanship meetup (Zurich 2015) on solving real problems without ...
Software craftsmanship meetup (Zurich 2015) on solving real problems without ...Software craftsmanship meetup (Zurich 2015) on solving real problems without ...
Software craftsmanship meetup (Zurich 2015) on solving real problems without ...
 
GT Spotter
GT SpotterGT Spotter
GT Spotter
 
Don't demo facts. Demo stories! (handouts)
Don't demo facts. Demo stories! (handouts)Don't demo facts. Demo stories! (handouts)
Don't demo facts. Demo stories! (handouts)
 
Don't demo facts. Demo stories!
Don't demo facts. Demo stories!Don't demo facts. Demo stories!
Don't demo facts. Demo stories!
 
Humane assessment on cards
Humane assessment on cardsHumane assessment on cards
Humane assessment on cards
 
Underneath Scrum: Reflective Thinking
Underneath Scrum: Reflective ThinkingUnderneath Scrum: Reflective Thinking
Underneath Scrum: Reflective Thinking
 
1800+ TED talks later
1800+ TED talks later1800+ TED talks later
1800+ TED talks later
 
Software assessment by example (lecture at the University of Bern)
Software assessment by example (lecture at the University of Bern)Software assessment by example (lecture at the University of Bern)
Software assessment by example (lecture at the University of Bern)
 
Humane assessment: Taming the elephant from the development room
Humane assessment: Taming the elephant from the development roomHumane assessment: Taming the elephant from the development room
Humane assessment: Taming the elephant from the development room
 
Moose: how to solve real problems without reading code
Moose: how to solve real problems without reading codeMoose: how to solve real problems without reading code
Moose: how to solve real problems without reading code
 
Software Environmentalism (ECOOP 2014 Keynote)
Software Environmentalism (ECOOP 2014 Keynote)Software Environmentalism (ECOOP 2014 Keynote)
Software Environmentalism (ECOOP 2014 Keynote)
 
The emergent nature of software systems
The emergent nature of software systemsThe emergent nature of software systems
The emergent nature of software systems
 
Presenting is storytelling at Uni Zurich - slides (2014-03-05)
Presenting is storytelling at Uni Zurich - slides (2014-03-05)Presenting is storytelling at Uni Zurich - slides (2014-03-05)
Presenting is storytelling at Uni Zurich - slides (2014-03-05)
 
Presenting is storytelling at Uni Zurich - handouts (2014-03-05)
Presenting is storytelling at Uni Zurich - handouts (2014-03-05)Presenting is storytelling at Uni Zurich - handouts (2014-03-05)
Presenting is storytelling at Uni Zurich - handouts (2014-03-05)
 
Underneath Scrum: Reflective Thinking (talk at Scrum Breakfast Bern, 2013)
Underneath Scrum: Reflective Thinking (talk at Scrum Breakfast Bern, 2013)Underneath Scrum: Reflective Thinking (talk at Scrum Breakfast Bern, 2013)
Underneath Scrum: Reflective Thinking (talk at Scrum Breakfast Bern, 2013)
 
Demo-driven innovation teaser
Demo-driven innovation teaserDemo-driven innovation teaser
Demo-driven innovation teaser
 
Software assessment essentials (lecture at the University of Bern 2013)
Software assessment essentials (lecture at the University of Bern 2013)Software assessment essentials (lecture at the University of Bern 2013)
Software assessment essentials (lecture at the University of Bern 2013)
 
Humane assessment with Moose at GOTO Aarhus 2011
Humane assessment with Moose at GOTO Aarhus 2011Humane assessment with Moose at GOTO Aarhus 2011
Humane assessment with Moose at GOTO Aarhus 2011
 
Flexible analysis with Moose at Jazoon 2011
Flexible analysis with Moose at Jazoon 2011Flexible analysis with Moose at Jazoon 2011
Flexible analysis with Moose at Jazoon 2011
 
Petitparser at the Deep into Smalltalk School 2011
Petitparser at the Deep into Smalltalk School 2011Petitparser at the Deep into Smalltalk School 2011
Petitparser at the Deep into Smalltalk School 2011
 

Recently uploaded

Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 

Recently uploaded (20)

Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 

Restructuring (EVO 2008)

  • 2. fo rw g rin ar ee d gin en gin en ee se rin erv g re { { { { { { } { { } } actual development } } } { } } }
  • 3. fo rw g rin ar ee d gin en gin en ee se rin erv g re { { { { { { } { { } } restructuring } } } { } } }
  • 4. cycle ginee ring life Reen fo rw g rin ar ee d gin en gin en ee se rin erv g re { { { { { { } { { } } restructuring } } } { } } }
  • 5. { { What? { { { { } { { } } restructuring } } } { } } }
  • 6. Restructuring is often taken as a synonym of refactoring
  • 7. Refactoring is a disciplined technique for restructuring an existing body of code, altering its internal structure without changing its external behavior
  • 9. Restructuring is transforming a program to fit current needs
  • 10. Why? { { What? { { { { } { { } } restructuring } } } { } } }
  • 12.
  • 13. The secret to tidiness is to have a place for every thing Denker Markus
  • 14. The secret to tidiness is to find the right place for every thing Denker Markus
  • 15. If it stinks, change it Be ck Gr andma
  • 16. How? Why? { { What? { { { { } { { } } restructuring } } } { } } }
  • 17.
  • 18. Take a critical look at design
  • 19. A God Class centralizes too much intelligence Class uses directly more than a few attributes of other classes ATFD > FEW Functional complexity of the class is very high AND GodClass WMC ! VERY HIGH Class cohesion is low TCC < ONE THIRD 006 ari nescu 2 L anza, M
  • 21. p God Class Split u ModelFacade from ArgoUML 2 er etal 200 Demey
  • 22. d than done Easi er sai 2 er etal 200 Demey
  • 23. also w rap it You can 2 er etal 200 Demey
  • 24. you do not Maybe uch it at all need to to God Class in the last version isGodClass(last) AND Harmless God Class Stable throughout the history Stability > 90% 4 Ratiu etal, 200
  • 25. Client Provider service()
  • 26. Client Intermediary Provider getProvider() service()
  • 27. Client Intermediary Provider getProvider() service() this.intermediary.provider.service();
  • 28. Provider2 service2() Client Intermediary Provider getProvider() service() Provider3 service3() this.intermediary.provider.service(); this.intermediary.provider2.service2(); this.intermediary.provider3.service3();
  • 29. Provider2 service2() Client Intermediary Provider getProvider() service() Provider3 service3() this.intermediary.provider.service(); this.intermediary.provider2.service2(); this.intermediary.provider3.service3(); to str angers eter : D on’t talk of Dem T he Law
  • 30. Code te Nav igation E limina Provider2 service2() Client Intermediary Provider fullService() service() Provider3 service3() this.intermediary.fullService(); 2 er etal 200 Demey
  • 31. ge inte rfaces ad to hu t: This can le Provider2 Cavea service2() Client Intermediary Provider fullService() service() Provider3 service3() this.intermediary.fullService(); 2 er etal 200 Demey
  • 32. Middl e Man R emove Provider2 service2() Client Provider service() Provider3 service3() this.provider.service(); this.provider2.service2(); this.provider3.service3(); Fow ler 1999
  • 33. An Envious Method is more interested in data from a handful of other classes Method uses directly more than a few attributes of other classes ATFD > FEW Method uses far more attributes of other classes than its own AND Feature Envy LAA < ONE THIRD The used quot;foreignquot; attributes belong to very few other classes FDP ! FEW 006 ari nescu 2 L anza, M
  • 34.
  • 35. ser to Data Behavi or Clo Move
  • 36. Data Classes are dumb data holders Interface of class reveals data rather than offering services WOC < ONE THIRD AND Data Class Class reveals many attributes and is not complex 006 ari nescu 2 L anza, M
  • 37.
  • 38. ser to Data Behavi or Clo Move
  • 39. Significant Duplication 006 ari nescu 2 L anza, M
  • 40. A A m1 m1' m3 m2 m2' 6 ne scu 200 Lanza, Mari
  • 41. A A m3 B C B C m1 m2 m1 m2 6 ne scu 200 Lanza, Mari
  • 42. Restructuring can also improve performance
  • 43. BusinessObject Client BusinessSessionBean BusinessEntityBean
  • 44. BusinessObject SessionFacade Client BusinessSessionBean BusinessEntityBean java .sun.com
  • 45. ModelFacade from ArgoUML es are good, Not al l Facad od :) some are G
  • 46. Trouble never comes alone Ano nymous
  • 47.
  • 48. Redistribute Transform conditionals responsibilities to Polymorphism Eliminate Split up Transform Client ... Navigation Code God Class Type Checks Move Behavior Introduce Null Object Closer to Data
  • 49. es pro blems ode co rrelat inC
  • 50.
  • 51.
  • 52. When? How? Why? { { What? { { { { } { { } } restructuring } } } { } } }
  • 54. Restructure all the time his fea sible? … hm m, is t
  • 55.
  • 57. Development Maintenance
  • 58.
  • 60. Tudor Gîrba www.tudorgirba.com creativecommons.org/licenses/by/3.0/