SlideShare una empresa de Scribd logo
1 de 60
Descargar para leer sin conexión
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/

Más contenido relacionado

Destacado

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 firstHenry 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 2010Mundo Contact
 
Presentacio etwinning Secundària
Presentacio etwinning SecundàriaPresentacio etwinning Secundària
Presentacio etwinning Secundàriamartap
 
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 mensagensBruno Borges
 
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 environmentalismTudor Girba
 

Destacado (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 a 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-12Tudor 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 2010Tudor 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 assessmentTudor 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 2010Tudor Girba
 
Software in Pictures 2008-03-12
Software in Pictures 2008-03-12Software in Pictures 2008-03-12
Software in Pictures 2008-03-12Tudor Girba
 
ncr annual reports 2002
ncr annual reports 2002ncr annual reports 2002
ncr annual reports 2002finance46
 

Similar a Restructuring (EVO 2008) (13)

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

Más de 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
 
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 cardsTudor Girba
 
Underneath Scrum: Reflective Thinking
Underneath Scrum: Reflective ThinkingUnderneath Scrum: Reflective Thinking
Underneath Scrum: Reflective ThinkingTudor Girba
 
1800+ TED talks later
1800+ TED talks later1800+ TED talks later
1800+ TED talks laterTudor 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 roomTudor 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 codeTudor 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 systemsTudor 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 teaserTudor 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 2011Tudor 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 2011Tudor 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 ZurichTudor Girba
 

Más de 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
 
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
 

Último

2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfChris Hunter
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesShubhangi Sonawane
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 

Último (20)

2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 

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/