This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Java in General and the fly likes Applying generics to old code? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Applying generics to old code?" Watch "Applying generics to old code?" New topic
Author

Applying generics to old code?

Shiva.Om Kumar
Ranch Hand

Joined: Jun 14, 2010
Posts: 68
I am working on a project which is quite old. But as usual, JDK is already upgraded to JDK 6.

Application works good and there are no big issues. But periodical enhancements are on.
Can you please suggests if it is good to spend time on replacing existing data-structure code with generics?

thanks.
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7081
    
  16

Shiva.Om Kumar wrote:I am working on a project which is quite old. But as usual, JDK is already upgraded to JDK 6.

Application works good and there are no big issues. But periodical enhancements are on.
Can you please suggests if it is good to spend time on replacing existing data-structure code with generics?
Without seeing the code, it very difficult to answer.

On the one hand, there's the old adage: if it ain't broke, don't fix it.
On the other, adding generics may make things easier (and safer) for future enhancements.

One approach might be to add generics piecemeal as and when a structure gets changed, but as I said, without seeing the project itself, it's awfully difficult to advise.

Winston


Isn't it funny how there's always time and money enough to do it WRONG?
Artlicles by Winston can be found here
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4339
    
    2

i have faced this question with some of my old code, and so far i always choose against it. at least against a total rewrite. i might add a new feature that happens to use generics, but for now i just ignore the compiler warnings when i dont rewrite the whole thing. like someone famous once said "if it aint broke dont fix it"

but then i am talking about homework and you are talking real code so......


SCJP
Visit my download page
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Applying generics to old code?
 
Similar Threads
generics
Generics
Generics
Generics
Comparable and Generics