refactoring
DESCRIPTION
presentation about the tecnhical refactoring in english.TRANSCRIPT
AS – Global Business Services
Brazilian Java AS Competency 12/12/08 © 2007 IBM Corporation
Refactoring
For ProgrammersCamilo Lopes
AS – Global Business Services
© 2007 IBM Corporation2 Brazilian Java AS Competency 12/12/08
Topics to be addressed Objective Why Refactoring? What is Refactoring ? Advantage When Refactoring Tools Results Example Java Questions
AS – Global Business Services
© 2007 IBM Corporation3 Brazilian Java AS Competency 12/12/08
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.
AS – Global Business Services
© 2007 IBM Corporation4 Brazilian Java AS Competency 12/12/08
Time x 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)
TimeSpent
AS – Global Business Services
© 2007 IBM Corporation5 Brazilian Java AS Competency 12/12/08
Cost x Spent
Picture 2 The long of last three decade more of 60% of cost of development of Software of enterprise was spent with
CostSpent
AS – Global Business Services
© 2007 IBM Corporation6 Brazilian Java AS Competency 12/12/08
Why Refactoring?
Refactoring help the become the code more legible and solve problem of bad code write
AS – Global Business Services
© 2007 IBM Corporation7 Brazilian Java AS Competency 12/12/08
Definition Refactoring
Refactoring is the process of re-structure the system without change your functionality (Fowler,2004).
AS – Global Business Services
© 2007 IBM Corporation8 Brazilian Java AS Competency 12/12/08
Motive to use Refactoring
Improve the project Software
Have a Software easier of comprehension the level code
Programmer faster
AS – Global Business Services
© 2007 IBM Corporation9 Brazilian Java AS Competency 12/12/08
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.
AS – Global Business Services
© 2007 IBM Corporation10 Brazilian Java AS Competency 12/12/08
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.
AS – Global Business Services
© 2007 IBM Corporation11 Brazilian Java AS Competency 12/12/08
When Refactoring ?
Code duplicate;
Method long;
Comments superfluous;
Command switch
AS – Global Business Services
© 2007 IBM Corporation12 Brazilian Java AS Competency 12/12/08
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;
AS – Global Business Services
© 2007 IBM Corporation13 Brazilian Java AS Competency 12/12/08
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
AS – Global Business Services
© 2007 IBM Corporation14 Brazilian Java AS Competency 12/12/08
Code Factored
static final double CONSTANTE_GRAVITACIONAL = 9.81;double energiaPotencial(double massa, double altura){ return massa * CONSTANTE_GRAVITACIONAL * altura;}
MECHANICSdeclare 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.
AS – Global Business Services
© 2007 IBM Corporation15 Brazilian Java AS Competency 12/12/08
Questions?!
Thanks! http://camilolopes.wordpress.com