This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Refactoring code?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Refactoring code??" Watch "Refactoring code??" New topic

Refactoring code??

Isha Mackker

Joined: Oct 18, 2005
Posts: 29
In the section 6 of the exam objective for SCJP 5.0, one objective is:
"Recognize the limitations of the non-generic Collections API and how to refactor code to use the generic versions."
Can anybody help me out in what does the term "refactor" means and how code can be refactored?
Thanks and Regards,
Steve Morrow
Ranch Hand

Joined: May 22, 2003
Posts: 657

Refactoring: The key to unraveling spaghetti code
Marcus Green
arch rival

Joined: Sep 14, 1999
Posts: 2813
Excellent Links Steve. I like the link at WikiPedia that describes refactoring as "cleaning it up" see

Here is how I comment on that topic in my new book on the JDK 1.5 exam

What does refactor mean? Refactor means to modify and improve existing code, but in such a way that it still includes its original functionality. Improving code implies that it is easier to understand and use. Refactoring is a big subject and modern development tools such as NetBeans and Eclipse include menu options entitled refactor. However refactoring generally means the programmer understands the issues behind the code that is being changed. Refactoring brings with it the obvious benefits of better code, but the danger of the introduction of new bugs. To be able to answer the questions that emphasise refactoring means you need to understand both the old versions of the Collections classes and the new Generic parameter versions.

Before GenericsGenerics are designed mainly for use with Collections, i.e. Classes that act as containers for instances of other classes. You need to be familiar with using and creating container classes for this section to make much sense. The standard Java Collections hold all elements as Object references. Because all classes are of type Object this means there is no checking for homogeneity (being of the same type).

etc etc

[ November 17, 2005: Message edited by: Marcus Green ]

SCWCD: Online Course, 50,000+ words and 200+ questions
Isha Mackker

Joined: Oct 18, 2005
Posts: 29
Thank you both for the useful links.
I agree. Here's the link:
subject: Refactoring code??
It's not a secret anymore!