Вы находитесь на странице: 1из 16

REFACTORING

Martin Nad martin_m_nad@yahoo.com


OVERVIEW

This documentation is about Refactoring, what it, why


we should use it and how often we should refactoring
an application
I will try to describe Refactoring to everybody can
understand very easy and fast.
Table of context:

Foreword…………………………………………………………...
..3
Introduction………………………………………………………
…..4
Definiation of Refactoring….
………………………………………..9
What is refactoring about.….
………………………………………10
My other documentation
Refactoring

FORWORD

There is lot of different books with different


volumes on market about Refactoring. But what is
refactoring about?
This documentation is about Refactoring and I will
discuss about it and try to find out what refactoring
exactly about and why we should think about it. I
will try to give you some example of refactory.
INTRODUCTION

During an application life, debugging and add new


feature to an application, without thinking about
refactoring, it gets bigger, slower and it can't be
handleable very easy and in perspective of time- It
will get more difficult to debug and add feature,
because those, refactoring is an important task
that every organization should think about it and
put time for it.
Here is some example of refactoring, I will discuss
about them: extracts function, extracts constant,
extract supper class, extract interface, extract
class, converting of members type, converting
local variable to field and so on.
We will look at each term here and see what kind
of changing is refactoring and what kind of
changing is not!
Before we talking more detail about refactoring, I
would point to if we have a good design from
beginning (not very beginning after we are finished
with implemented all requirement-specification
both functionally and none functionally
specification), we could save lot of time to
refactoring and adding feature to an application.
I usually make a dirty-working version with all or
mostly basic functionality and then begin to look at
the structure and design.
As I said before, the dirty-working version depends
to experiments.
Sometime this dirty-working-version it has is much
better and it is well-structure-design of final
version of other developer whit less experiments.
To have experiments developer is a very big
advantages, and it is not very easy to measurable.
When you have a application that it is very flexible,
and you've done it in very short time. You will save
lot of the time, and as I said before time is equal
money.

Of course we shouldn’t forget that everything is


relative and here it is depend on the application
size, importance and the frequency of using of the
application. Every application are important,
otherwise it shouldn’t exist.
In view of frequency and size of application, the
organization should have a plane for refactory and
reviewing the whole applications.
It should be very good idea to have some group
developer just working on debugging as adhoc-
group or refactoring-group to improve design,
debug application, and/or finally refactoring.
We should look at an application regularly and see
if we used the right tools, concept and technique to
implement the application, and try to generalizing
the application.
Right now, we are in a very hard staging of
developing of application.
Almost every month comes a new tool, concept
and new technology and after just one year our
application gets very old. And at least we should
look at the whole application once per year. And
also our knowledge if we don’t update it by time,
get very old.
It is necessary to look at the application once per
year, and see if we should use a newer technique
which we are working with them right now or not.
I believe every organization should work very
flexible and every time can move from a
technology to the other and try to rewrite or
refactoring the old application to the new or at
least use some technology with standard interfaces
as WSDL or SOAP.
Using WSDL or SOADP get us flexibility to
use/adapt old application with new application
without any rewriting or changing. Here we can use
of benefit of SOA too.
Using XML-base languages-tools, get us ability to
use other application that those are written in
other languages too.

I assume that every person and company shouldn’t


work with the same technology that they did for
example for at least 5 years. Every developer and
software companies should look forward to update
the knowledge and those technology that they use.
As I said before, refactoring is try to simplifying the
application, and makes the application design to
more simple. Here we can get the advantages of
the new tools and concept. Those help us to keep
your application more simple more effective and
more flexible.
For example, think about frontend applications
without using to the features of MVC. Think about
differences between JBE2 and Spring, using
hibernate as database persistence and object-
relation-method instead of the jdbc and relation-
database. How everything gets easier whit the
newer concepts. Of course it takes some time and
you need some practicing with the new concepts
and technology but, it helps you very much.
Refactoring should make easier to understand the
application. And we can talk about “the style of our
codes” (I will very soon write about how we can
improve our coding style).
Refactoring should make cheaper to modify and
debugging the application too.
Some people believe that Refactoring is not just
about internal structure and design. It can be about
changing of behavior of application too. In this case
we get some problem.
But refactoring is not about find any bug in your
application, Refactoring for me it is like you leave
you car to service, your car need service time to
time.
It is the same, the application that it is on live, you
should take hand about it and update it, debug it,
improve it, and try to generalizing it and/or finally
Refactoring it.
There many software or editor that in some way
automatited the refractory processes as:
Eclips
Java NetBean
intellJ IDEA
Those you can use at least in java, but as long as I
know you can use boths Java NetBean and Eclips
for C++ too
and there are some software/editor for .Net too as:
Visual Studio 2008
DEFINITION OF REFACATORY

The definition of the Refactoring is not far way to


what it is about also refactory is a series of task to
simplify, and to make more understandable and to
make to more flexible of an application or to get
better design and codes without changing the
behaviors of application and functionality of
application.
WHAT REFACTORING IS ABOUT
Refactoring is about what you did miss, or hadn’t
time to do a good design and structure during
developing your application.
If you read my documentation about “how to write
effective codes”, you should have some idea about
what you should think about and how you should
write the codes.
Refactoring just about 5 different tasks:
1-Improving functions, classes, if they are
two long extended to other function or
classes, to find some structures’ problem as
Demeter and so on.
2- Remove duplication functions, classes, and
so on
3-Improving communication,
4-Simplifying of application, classes and
function and finally
5-Put more flexibility
6-Generalizing of application.
Or in other points of view, it is about different
techniques
1-Changing an application to make easier
understanding
As, rename function name, class names,
variables names
2-Changing an application to more abstract
3-Simplifying the application by extracting of
function, classes.
I believe that if you are writing an application
from beginning in the right way, the refactoring get
very faster and easier.
But one of the typically problem in software
engineering is:, every projects is almost unique
and before you have a nice working application,
you should improve your solution, when you are
sure that your solution is right and it should work,
you can think about writing code to well structure
and well design.
Otherwise before your test your solution to how
you should implement your application and you
just begin working with a very good structure and
nice coding, you can in the middle of you
application find that this solution is not correct and
you have to rewrite your code and change your
design that have used and beginning from
beginning and of course it takes lot of time.
Verification and validation is most important phase
in a software engineering.

Be continuing…..
DONATION

If you like this documentation and it was


helpful you can just donate 7$ by using
this
https://www.paypal.com/cgi-bin/webscr?cmd=_s-
or use this to put
xclick&hosted_button_id=5814019
any amont you like to donate
https://www.paypal.com/cgi-bin/webscr?cmd=_s-
xclick&hosted_button_id=5813954 and if it doesn’t work copy
the link and put it on your browser.

if it doesn’t work copy the link and put it on your browser.


MY OTHER DOCUMENTATION

Properties in Java and Spring by Martin Nad


Spring and Cxf by Example
Jboss and Perm Gen Error
Using Ftp Service With Spring
JunIt
How to use Maven
ReFactoring
Maven and Custome Archetype
How to Write Effective Code