SlideShare une entreprise Scribd logo
1  sur  15
Télécharger pour lire hors ligne
AS – Global Business Services




Refactoring

     For Programmers
     Camilo Lopes




     Brazilian Java AS Competency    12/12/08   © 2007 IBM Corporation
AS – Global Business Services




Topics to be addressed
     Objective
     Why Refactoring?
     What is Refactoring ?
     Advantage
     When Refactoring
     Tools
     Results
     Example Java
     Questions



                                                     © 2007 IBM Corporation
2          Brazilian Java AS Competency   12/12/08
AS – Global Business Services




Objective

    Assist in the development of system Object Oriented
implements in the Java language that have fall reusability of
code, maintaining hard and the add or adequacy of news
requirement sue a lot of work of engineer Software,
programmer, Analyst System, points that can generate big cost
the project.




                                                    © 2007 IBM Corporation
3         Brazilian Java AS Competency   12/12/08
AS – Global Business Services




                                           Time x Spent




                                                                         Time
                                                                         Spent




Picture 1 believe that about 50% of time of an engineer Software is spent with task of maintaining
and comprehension of code.
Fonte: Maia (2004)
                                                                                 © 2007 IBM Corporation
  4             Brazilian Java AS Competency               12/12/08
AS – Global Business Services




 Cost x Spent




                                                                     Cost
                                                                     Spent




Picture 2 The long of last three decade more of 60% of cost of development of Software of
enterprise was spent with

                                                                               © 2007 IBM Corporation
 5             Brazilian Java AS Competency              12/12/08
AS – Global Business Services




Why Refactoring?

    Refactoring help the become the code
    more legible and solve problem of bad
    code write




                                                    © 2007 IBM Corporation
6         Brazilian Java AS Competency   12/12/08
AS – Global Business Services




Definition Refactoring

    Refactoring is the process of re-structure
    the system without change your
    functionality (Fowler,2004).




                                                    © 2007 IBM Corporation
7         Brazilian Java AS Competency   12/12/08
AS – Global Business Services




Motive to use Refactoring

     Improve the project Software
     Have a Software easier of comprehension the level
     code
     Programmer faster




                                                     © 2007 IBM Corporation
8          Brazilian Java AS Competency   12/12/08
AS – Global Business Services




Advantage

     The technical of refactoring can be applicate in the
     development and maintaining of Software;
     Refactoring possibility the add of new functionality of
     mode easy averting the re-structure of code;
     With the use of refactoring spent less time possible in
     maintaining the level code, improve the legibility and
     structure the code.




                                                        © 2007 IBM Corporation
9             Brazilian Java AS Competency   12/12/08
AS – Global Business Services




Tools

  Xrefactoring: the languages compatible are C and Java
     this tools possibility the generation of documentation
     on format HTML;
  RefactorIT: is a tools to refactoring that can be integrate
     in several IDEs.
  Jfactor: is a tools that permit the application automatic
     of refactoring the program in Java.




                                                       © 2007 IBM Corporation
10           Brazilian Java AS Competency   12/12/08
AS – Global Business Services




When Refactoring ?

      Code duplicate;
      Method long;
      Comments superfluous;
      Command switch




                                                      © 2007 IBM Corporation
11          Brazilian Java AS Competency   12/12/08
AS – Global Business Services




Results

      Easy in the process of maintaining and
      development of Software;
      Can be applicate the any language Oriented
      Object;
      Become the Software flexible to add of new
      functionality without re-structure of code;
      Maintain the behavior of Software;




                                                      © 2007 IBM Corporation
12          Brazilian Java AS Competency   12/12/08
AS – Global Business Services



Example – Substitute a number literal by constant
symbolic
      Are numbers with value special in system;
      Sometimes are use in more of a place;
      To make the reading and comprehension
      double energiaPotencial(double massa,
      double altura{
     return massa * 9.81 * altura;
     } // code do not refactoring



                                                      © 2007 IBM Corporation
13          Brazilian Java AS Competency   12/12/08
AS – Global Business Services




Code Factored

     static final double CONSTANTE_GRAVITACIONAL = 9.81;

     double energiaPotencial(double massa, double altura){

     return massa * CONSTANTE_GRAVITACIONAL * altura;

     }

                                             MECHANICS

     declare a constant and attribute a value to number
     literal;

     find where this number appear;

     see if the change can be to do, case positive change the
     number by constant;

     compile and test.
                                                                    © 2007 IBM Corporation
14            Brazilian Java AS Competency               12/12/08
AS – Global Business Services




Questions?!

                                         Thanks!
                             http://camilolopes.wordpress.com




                                                                © 2007 IBM Corporation
15        Brazilian Java AS Competency               12/12/08

Contenu connexe

Tendances

The CIO Innovation Toolkit | G2iX
The CIO Innovation Toolkit | G2iXThe CIO Innovation Toolkit | G2iX
The CIO Innovation Toolkit | G2iXg2ix
 
Resume_Sanjay_parab_SAP_ABAP_Consultant(1) - Copy
Resume_Sanjay_parab_SAP_ABAP_Consultant(1) - CopyResume_Sanjay_parab_SAP_ABAP_Consultant(1) - Copy
Resume_Sanjay_parab_SAP_ABAP_Consultant(1) - Copysanjay parab
 
Klausing, Patrick Resume Consultant2
Klausing, Patrick Resume Consultant2Klausing, Patrick Resume Consultant2
Klausing, Patrick Resume Consultant2pklausing
 
Resume_SushilJalan
Resume_SushilJalanResume_SushilJalan
Resume_SushilJalanSushil Jalan
 
Ibm log differentiators for strategic network planning 2011 v6
Ibm log differentiators for strategic network planning 2011 v6Ibm log differentiators for strategic network planning 2011 v6
Ibm log differentiators for strategic network planning 2011 v6Artem Vinogradov
 
Bpc 10.1 classic training
Bpc 10.1 classic trainingBpc 10.1 classic training
Bpc 10.1 classic traininggriteshkaran
 
Learn SAP BPC by Yourself
Learn SAP BPC by YourselfLearn SAP BPC by Yourself
Learn SAP BPC by Yourselfgriteshkaran
 
comForte CSL: a messaging middleware framework for HP NonStop
comForte CSL: a messaging middleware framework for HP NonStopcomForte CSL: a messaging middleware framework for HP NonStop
comForte CSL: a messaging middleware framework for HP NonStopThomas Burg
 
Next-Generation Enterprise Application Development with SpringSource dm Serve...
Next-Generation Enterprise Application Development with SpringSource dm Serve...Next-Generation Enterprise Application Development with SpringSource dm Serve...
Next-Generation Enterprise Application Development with SpringSource dm Serve...Aditya Jha
 
Enhanced Automation Framework delivers Business Outcomes
Enhanced Automation Framework delivers Business OutcomesEnhanced Automation Framework delivers Business Outcomes
Enhanced Automation Framework delivers Business OutcomesSTAG Software Private Limited
 
Ranjit gupta(mainframe 6.1 years)
Ranjit gupta(mainframe 6.1 years)Ranjit gupta(mainframe 6.1 years)
Ranjit gupta(mainframe 6.1 years)Ranjit Gupta
 
NIHIT SRIVASTAVA_2.6Years_Resume
NIHIT SRIVASTAVA_2.6Years_ResumeNIHIT SRIVASTAVA_2.6Years_Resume
NIHIT SRIVASTAVA_2.6Years_ResumeNihit Srivastava
 
IBM Certified Deployment Professional
IBM Certified Deployment ProfessionalIBM Certified Deployment Professional
IBM Certified Deployment ProfessionalMaharaja P
 
Ten questions-c folders
Ten questions-c foldersTen questions-c folders
Ten questions-c foldersNayeem Rahman
 
Resume_Jegatheesan-JKT
Resume_Jegatheesan-JKTResume_Jegatheesan-JKT
Resume_Jegatheesan-JKTJag Jagdeesh
 

Tendances (16)

The CIO Innovation Toolkit | G2iX
The CIO Innovation Toolkit | G2iXThe CIO Innovation Toolkit | G2iX
The CIO Innovation Toolkit | G2iX
 
Resume_Sanjay_parab_SAP_ABAP_Consultant(1) - Copy
Resume_Sanjay_parab_SAP_ABAP_Consultant(1) - CopyResume_Sanjay_parab_SAP_ABAP_Consultant(1) - Copy
Resume_Sanjay_parab_SAP_ABAP_Consultant(1) - Copy
 
Klausing, Patrick Resume Consultant2
Klausing, Patrick Resume Consultant2Klausing, Patrick Resume Consultant2
Klausing, Patrick Resume Consultant2
 
Resume_SushilJalan
Resume_SushilJalanResume_SushilJalan
Resume_SushilJalan
 
Ibm log differentiators for strategic network planning 2011 v6
Ibm log differentiators for strategic network planning 2011 v6Ibm log differentiators for strategic network planning 2011 v6
Ibm log differentiators for strategic network planning 2011 v6
 
Bpc 10.1 classic training
Bpc 10.1 classic trainingBpc 10.1 classic training
Bpc 10.1 classic training
 
Learn SAP BPC by Yourself
Learn SAP BPC by YourselfLearn SAP BPC by Yourself
Learn SAP BPC by Yourself
 
comForte CSL: a messaging middleware framework for HP NonStop
comForte CSL: a messaging middleware framework for HP NonStopcomForte CSL: a messaging middleware framework for HP NonStop
comForte CSL: a messaging middleware framework for HP NonStop
 
Next-Generation Enterprise Application Development with SpringSource dm Serve...
Next-Generation Enterprise Application Development with SpringSource dm Serve...Next-Generation Enterprise Application Development with SpringSource dm Serve...
Next-Generation Enterprise Application Development with SpringSource dm Serve...
 
Enhanced Automation Framework delivers Business Outcomes
Enhanced Automation Framework delivers Business OutcomesEnhanced Automation Framework delivers Business Outcomes
Enhanced Automation Framework delivers Business Outcomes
 
KBACE Acquisitions & Divestitures
KBACE Acquisitions & Divestitures KBACE Acquisitions & Divestitures
KBACE Acquisitions & Divestitures
 
Ranjit gupta(mainframe 6.1 years)
Ranjit gupta(mainframe 6.1 years)Ranjit gupta(mainframe 6.1 years)
Ranjit gupta(mainframe 6.1 years)
 
NIHIT SRIVASTAVA_2.6Years_Resume
NIHIT SRIVASTAVA_2.6Years_ResumeNIHIT SRIVASTAVA_2.6Years_Resume
NIHIT SRIVASTAVA_2.6Years_Resume
 
IBM Certified Deployment Professional
IBM Certified Deployment ProfessionalIBM Certified Deployment Professional
IBM Certified Deployment Professional
 
Ten questions-c folders
Ten questions-c foldersTen questions-c folders
Ten questions-c folders
 
Resume_Jegatheesan-JKT
Resume_Jegatheesan-JKTResume_Jegatheesan-JKT
Resume_Jegatheesan-JKT
 

Similaire à Refactoring

Gregor Hohpe Track Intro The Cloud As Middle Ware
Gregor Hohpe Track Intro The Cloud As Middle WareGregor Hohpe Track Intro The Cloud As Middle Ware
Gregor Hohpe Track Intro The Cloud As Middle Waredeimos
 
How Amazon Video Uses DynamoDB Global Tables to Support Tens of Millions of G...
How Amazon Video Uses DynamoDB Global Tables to Support Tens of Millions of G...How Amazon Video Uses DynamoDB Global Tables to Support Tens of Millions of G...
How Amazon Video Uses DynamoDB Global Tables to Support Tens of Millions of G...Amazon Web Services
 
Stress Your Web App Before It Stresses You: Tools and Techniques for Extreme ...
Stress Your Web App Before It Stresses You: Tools and Techniques for Extreme ...Stress Your Web App Before It Stresses You: Tools and Techniques for Extreme ...
Stress Your Web App Before It Stresses You: Tools and Techniques for Extreme ...elliando dias
 
Sivaprasanth Rentala_Kedar profile
Sivaprasanth Rentala_Kedar profileSivaprasanth Rentala_Kedar profile
Sivaprasanth Rentala_Kedar profilesivaprasanth rentala
 
The DevOps PaaS Infusion - May meetup
The DevOps PaaS Infusion - May meetupThe DevOps PaaS Infusion - May meetup
The DevOps PaaS Infusion - May meetupNorm Leitman
 
Kiwibank: From Startup to Enterprise in 7 years
Kiwibank:  From Startup to Enterprise in 7 yearsKiwibank:  From Startup to Enterprise in 7 years
Kiwibank: From Startup to Enterprise in 7 yearsVincent Kwon
 
Java on zSystems zOS
Java on zSystems zOSJava on zSystems zOS
Java on zSystems zOSTim Ellison
 
X pages jumpstart jmp101
X pages jumpstart jmp101X pages jumpstart jmp101
X pages jumpstart jmp101pdhannan
 
Enterprise Mashups With Soa
Enterprise Mashups With SoaEnterprise Mashups With Soa
Enterprise Mashups With Soaumityalcinalp
 
Application Report: Virtualizing Tier-1 Workloads using FC SANs
Application Report: Virtualizing Tier-1 Workloads using FC SANsApplication Report: Virtualizing Tier-1 Workloads using FC SANs
Application Report: Virtualizing Tier-1 Workloads using FC SANsIT Brand Pulse
 
IBM IMPACT 2009 Conference Session 2078 - Extending and Integrating Popular P...
IBM IMPACT 2009 Conference Session 2078 - Extending and Integrating Popular P...IBM IMPACT 2009 Conference Session 2078 - Extending and Integrating Popular P...
IBM IMPACT 2009 Conference Session 2078 - Extending and Integrating Popular P...Robert Nicholson
 
We4IT lcty 2013 - infra-man - whats new in ibm domino application development
We4IT lcty 2013 - infra-man - whats new in ibm domino application developmentWe4IT lcty 2013 - infra-man - whats new in ibm domino application development
We4IT lcty 2013 - infra-man - whats new in ibm domino application developmentWe4IT Group
 
Pragmatic Model Driven Development In Java Using Smart Use Cases
Pragmatic Model Driven Development In Java Using Smart Use CasesPragmatic Model Driven Development In Java Using Smart Use Cases
Pragmatic Model Driven Development In Java Using Smart Use CasesRody Middelkoop
 
Patterns and Considerations in Service Discovery - Con327 - re:Invent 2017
Patterns and Considerations in Service Discovery - Con327 - re:Invent 2017Patterns and Considerations in Service Discovery - Con327 - re:Invent 2017
Patterns and Considerations in Service Discovery - Con327 - re:Invent 2017Roven Drabo
 
Enrique Duvos: Adobe RIA Platform
Enrique Duvos: Adobe RIA PlatformEnrique Duvos: Adobe RIA Platform
Enrique Duvos: Adobe RIA PlatformInitium
 
GigaSpaces Cloudify - The PaaS Jailbreaker
GigaSpaces Cloudify - The PaaS Jailbreaker GigaSpaces Cloudify - The PaaS Jailbreaker
GigaSpaces Cloudify - The PaaS Jailbreaker Uri Cohen
 

Similaire à Refactoring (20)

Gregor Hohpe Track Intro The Cloud As Middle Ware
Gregor Hohpe Track Intro The Cloud As Middle WareGregor Hohpe Track Intro The Cloud As Middle Ware
Gregor Hohpe Track Intro The Cloud As Middle Ware
 
Compiere ERP
Compiere ERPCompiere ERP
Compiere ERP
 
How Amazon Video Uses DynamoDB Global Tables to Support Tens of Millions of G...
How Amazon Video Uses DynamoDB Global Tables to Support Tens of Millions of G...How Amazon Video Uses DynamoDB Global Tables to Support Tens of Millions of G...
How Amazon Video Uses DynamoDB Global Tables to Support Tens of Millions of G...
 
NetWeaver Gateway- Extend the Reach of SAP Applications
NetWeaver Gateway- Extend the Reach of SAP ApplicationsNetWeaver Gateway- Extend the Reach of SAP Applications
NetWeaver Gateway- Extend the Reach of SAP Applications
 
Stress Your Web App Before It Stresses You: Tools and Techniques for Extreme ...
Stress Your Web App Before It Stresses You: Tools and Techniques for Extreme ...Stress Your Web App Before It Stresses You: Tools and Techniques for Extreme ...
Stress Your Web App Before It Stresses You: Tools and Techniques for Extreme ...
 
Sivaprasanth Rentala_Kedar profile
Sivaprasanth Rentala_Kedar profileSivaprasanth Rentala_Kedar profile
Sivaprasanth Rentala_Kedar profile
 
JasperSoft and GlassFish
JasperSoft and GlassFishJasperSoft and GlassFish
JasperSoft and GlassFish
 
The DevOps PaaS Infusion - May meetup
The DevOps PaaS Infusion - May meetupThe DevOps PaaS Infusion - May meetup
The DevOps PaaS Infusion - May meetup
 
Kiwibank: From Startup to Enterprise in 7 years
Kiwibank:  From Startup to Enterprise in 7 yearsKiwibank:  From Startup to Enterprise in 7 years
Kiwibank: From Startup to Enterprise in 7 years
 
Java on zSystems zOS
Java on zSystems zOSJava on zSystems zOS
Java on zSystems zOS
 
X pages jumpstart jmp101
X pages jumpstart jmp101X pages jumpstart jmp101
X pages jumpstart jmp101
 
Enterprise Mashups With Soa
Enterprise Mashups With SoaEnterprise Mashups With Soa
Enterprise Mashups With Soa
 
Application Report: Virtualizing Tier-1 Workloads using FC SANs
Application Report: Virtualizing Tier-1 Workloads using FC SANsApplication Report: Virtualizing Tier-1 Workloads using FC SANs
Application Report: Virtualizing Tier-1 Workloads using FC SANs
 
IBM IMPACT 2009 Conference Session 2078 - Extending and Integrating Popular P...
IBM IMPACT 2009 Conference Session 2078 - Extending and Integrating Popular P...IBM IMPACT 2009 Conference Session 2078 - Extending and Integrating Popular P...
IBM IMPACT 2009 Conference Session 2078 - Extending and Integrating Popular P...
 
What's new in designer
What's new in designerWhat's new in designer
What's new in designer
 
We4IT lcty 2013 - infra-man - whats new in ibm domino application development
We4IT lcty 2013 - infra-man - whats new in ibm domino application developmentWe4IT lcty 2013 - infra-man - whats new in ibm domino application development
We4IT lcty 2013 - infra-man - whats new in ibm domino application development
 
Pragmatic Model Driven Development In Java Using Smart Use Cases
Pragmatic Model Driven Development In Java Using Smart Use CasesPragmatic Model Driven Development In Java Using Smart Use Cases
Pragmatic Model Driven Development In Java Using Smart Use Cases
 
Patterns and Considerations in Service Discovery - Con327 - re:Invent 2017
Patterns and Considerations in Service Discovery - Con327 - re:Invent 2017Patterns and Considerations in Service Discovery - Con327 - re:Invent 2017
Patterns and Considerations in Service Discovery - Con327 - re:Invent 2017
 
Enrique Duvos: Adobe RIA Platform
Enrique Duvos: Adobe RIA PlatformEnrique Duvos: Adobe RIA Platform
Enrique Duvos: Adobe RIA Platform
 
GigaSpaces Cloudify - The PaaS Jailbreaker
GigaSpaces Cloudify - The PaaS Jailbreaker GigaSpaces Cloudify - The PaaS Jailbreaker
GigaSpaces Cloudify - The PaaS Jailbreaker
 

Plus de Camilo Lopes

Mitos e verdades startup
Mitos e verdades startupMitos e verdades startup
Mitos e verdades startupCamilo Lopes
 
Usecash - Meio de Pagamento através do Troco
Usecash - Meio de Pagamento através do TrocoUsecash - Meio de Pagamento através do Troco
Usecash - Meio de Pagamento através do TrocoCamilo Lopes
 
Tdc2014 scrum remoto rola ou nao rola
Tdc2014  scrum remoto rola ou  nao rolaTdc2014  scrum remoto rola ou  nao rola
Tdc2014 scrum remoto rola ou nao rolaCamilo Lopes
 
Apresentando Scrum ao cliente
Apresentando Scrum ao clienteApresentando Scrum ao cliente
Apresentando Scrum ao clienteCamilo Lopes
 
ITS de Startup para Startups
ITS  de Startup para StartupsITS  de Startup para Startups
ITS de Startup para StartupsCamilo Lopes
 
Overview about AngularJS Framework
Overview about AngularJS Framework Overview about AngularJS Framework
Overview about AngularJS Framework Camilo Lopes
 
Start-up adotando Scrum
Start-up adotando ScrumStart-up adotando Scrum
Start-up adotando ScrumCamilo Lopes
 
Como ser escritor no brasil
Como ser escritor no brasilComo ser escritor no brasil
Como ser escritor no brasilCamilo Lopes
 
Boas práticas com TDD
Boas práticas com TDD Boas práticas com TDD
Boas práticas com TDD Camilo Lopes
 
TDC 2012 TDD e 20 coisas que você precisa saber
TDC 2012 TDD e 20 coisas que você precisa saberTDC 2012 TDD e 20 coisas que você precisa saber
TDC 2012 TDD e 20 coisas que você precisa saberCamilo Lopes
 
Scrum in few minutes
Scrum in few minutesScrum in few minutes
Scrum in few minutesCamilo Lopes
 
Convencendo o cliente usar Scrum 5min
Convencendo o cliente usar Scrum 5minConvencendo o cliente usar Scrum 5min
Convencendo o cliente usar Scrum 5minCamilo Lopes
 
Guia JEE com Frameworks
Guia JEE com FrameworksGuia JEE com Frameworks
Guia JEE com FrameworksCamilo Lopes
 
Palestra Exchange Program - NewZealand
Palestra Exchange Program - NewZealandPalestra Exchange Program - NewZealand
Palestra Exchange Program - NewZealandCamilo Lopes
 
Guia de Bolso SCJP
Guia de Bolso SCJPGuia de Bolso SCJP
Guia de Bolso SCJPCamilo Lopes
 
Seminario Refatoracao
Seminario RefatoracaoSeminario Refatoracao
Seminario RefatoracaoCamilo Lopes
 

Plus de Camilo Lopes (19)

Mitos e verdades startup
Mitos e verdades startupMitos e verdades startup
Mitos e verdades startup
 
Usecash - Meio de Pagamento através do Troco
Usecash - Meio de Pagamento através do TrocoUsecash - Meio de Pagamento através do Troco
Usecash - Meio de Pagamento através do Troco
 
Tdc2014 scrum remoto rola ou nao rola
Tdc2014  scrum remoto rola ou  nao rolaTdc2014  scrum remoto rola ou  nao rola
Tdc2014 scrum remoto rola ou nao rola
 
Apresentando Scrum ao cliente
Apresentando Scrum ao clienteApresentando Scrum ao cliente
Apresentando Scrum ao cliente
 
ITS de Startup para Startups
ITS  de Startup para StartupsITS  de Startup para Startups
ITS de Startup para Startups
 
Overview about AngularJS Framework
Overview about AngularJS Framework Overview about AngularJS Framework
Overview about AngularJS Framework
 
Start-up adotando Scrum
Start-up adotando ScrumStart-up adotando Scrum
Start-up adotando Scrum
 
TDD na Prática
TDD na PráticaTDD na Prática
TDD na Prática
 
Como ser escritor no brasil
Como ser escritor no brasilComo ser escritor no brasil
Como ser escritor no brasil
 
Boas práticas com TDD
Boas práticas com TDD Boas práticas com TDD
Boas práticas com TDD
 
TDC 2012 TDD e 20 coisas que você precisa saber
TDC 2012 TDD e 20 coisas que você precisa saberTDC 2012 TDD e 20 coisas que você precisa saber
TDC 2012 TDD e 20 coisas que você precisa saber
 
Mock with Mockito
Mock with MockitoMock with Mockito
Mock with Mockito
 
Scrum in few minutes
Scrum in few minutesScrum in few minutes
Scrum in few minutes
 
Convencendo o cliente usar Scrum 5min
Convencendo o cliente usar Scrum 5minConvencendo o cliente usar Scrum 5min
Convencendo o cliente usar Scrum 5min
 
Guia JEE com Frameworks
Guia JEE com FrameworksGuia JEE com Frameworks
Guia JEE com Frameworks
 
Palestra Exchange Program - NewZealand
Palestra Exchange Program - NewZealandPalestra Exchange Program - NewZealand
Palestra Exchange Program - NewZealand
 
Guia de Bolso SCJP
Guia de Bolso SCJPGuia de Bolso SCJP
Guia de Bolso SCJP
 
Certificacao Java
Certificacao JavaCertificacao Java
Certificacao Java
 
Seminario Refatoracao
Seminario RefatoracaoSeminario Refatoracao
Seminario Refatoracao
 

Refactoring

  • 1. AS – Global Business Services Refactoring For Programmers Camilo Lopes Brazilian Java AS Competency 12/12/08 © 2007 IBM Corporation
  • 2. AS – Global Business Services Topics to be addressed  Objective  Why Refactoring?  What is Refactoring ?  Advantage  When Refactoring  Tools  Results  Example Java  Questions © 2007 IBM Corporation 2 Brazilian Java AS Competency 12/12/08
  • 3. AS – Global Business Services Objective Assist in the development of system Object Oriented implements in the Java language that have fall reusability of code, maintaining hard and the add or adequacy of news requirement sue a lot of work of engineer Software, programmer, Analyst System, points that can generate big cost the project. © 2007 IBM Corporation 3 Brazilian Java AS Competency 12/12/08
  • 4. AS – Global Business Services Time x Spent Time Spent Picture 1 believe that about 50% of time of an engineer Software is spent with task of maintaining and comprehension of code. Fonte: Maia (2004) © 2007 IBM Corporation 4 Brazilian Java AS Competency 12/12/08
  • 5. AS – Global Business Services Cost x Spent Cost Spent Picture 2 The long of last three decade more of 60% of cost of development of Software of enterprise was spent with © 2007 IBM Corporation 5 Brazilian Java AS Competency 12/12/08
  • 6. AS – Global Business Services Why Refactoring? Refactoring help the become the code more legible and solve problem of bad code write © 2007 IBM Corporation 6 Brazilian Java AS Competency 12/12/08
  • 7. AS – Global Business Services Definition Refactoring Refactoring is the process of re-structure the system without change your functionality (Fowler,2004). © 2007 IBM Corporation 7 Brazilian Java AS Competency 12/12/08
  • 8. AS – Global Business Services Motive to use Refactoring  Improve the project Software  Have a Software easier of comprehension the level code  Programmer faster © 2007 IBM Corporation 8 Brazilian Java AS Competency 12/12/08
  • 9. AS – Global Business Services Advantage  The technical of refactoring can be applicate in the development and maintaining of Software;  Refactoring possibility the add of new functionality of mode easy averting the re-structure of code;  With the use of refactoring spent less time possible in maintaining the level code, improve the legibility and structure the code. © 2007 IBM Corporation 9 Brazilian Java AS Competency 12/12/08
  • 10. AS – Global Business Services Tools  Xrefactoring: the languages compatible are C and Java this tools possibility the generation of documentation on format HTML;  RefactorIT: is a tools to refactoring that can be integrate in several IDEs.  Jfactor: is a tools that permit the application automatic of refactoring the program in Java. © 2007 IBM Corporation 10 Brazilian Java AS Competency 12/12/08
  • 11. AS – Global Business Services When Refactoring ?  Code duplicate;  Method long;  Comments superfluous;  Command switch © 2007 IBM Corporation 11 Brazilian Java AS Competency 12/12/08
  • 12. AS – Global Business Services Results  Easy in the process of maintaining and development of Software;  Can be applicate the any language Oriented Object;  Become the Software flexible to add of new functionality without re-structure of code;  Maintain the behavior of Software; © 2007 IBM Corporation 12 Brazilian Java AS Competency 12/12/08
  • 13. AS – Global Business Services Example – Substitute a number literal by constant symbolic  Are numbers with value special in system;  Sometimes are use in more of a place;  To make the reading and comprehension  double energiaPotencial(double massa, double altura{ return massa * 9.81 * altura; } // code do not refactoring © 2007 IBM Corporation 13 Brazilian Java AS Competency 12/12/08
  • 14. AS – Global Business Services Code Factored static final double CONSTANTE_GRAVITACIONAL = 9.81; double energiaPotencial(double massa, double altura){ return massa * CONSTANTE_GRAVITACIONAL * altura; } MECHANICS declare a constant and attribute a value to number literal; find where this number appear; see if the change can be to do, case positive change the number by constant; compile and test. © 2007 IBM Corporation 14 Brazilian Java AS Competency 12/12/08
  • 15. AS – Global Business Services Questions?! Thanks! http://camilolopes.wordpress.com © 2007 IBM Corporation 15 Brazilian Java AS Competency 12/12/08