>I wonder if someone has ever tried to convert Java 1.4 style code into
>code that is using generics? What tools did you use and what was your
>overall experience?
Just put the generics on the declare and the allocations. Compile. Fix
the errors. Run IntelliJ inspector and it will tell point you to the
places to pull the casts.
USING generic classes is a snap once you get the hang of it. You can
convert a program is a few minutes. The tricky part is writing a
Collections class. There you do it by monkey-see-monkey do looking
for a similar collection.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Daniel Pitts - 13 Feb 2008 22:26 GMT
>> I wonder if someone has ever tried to convert Java 1.4 style code into
>> code that is using generics? What tools did you use and what was your
[quoted text clipped - 8 lines]
> Collections class. There you do it by monkey-see-monkey do looking
> for a similar collection.
Programming should *never* be monkey-see-monkey-do! If you don't
understand what you're writing, then you're probably making a bug.
> --
>
> Roedy Green Canadian Mind Products
> The Java Glossary
> http://mindprod.com

Signature
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
RedGrittyBrick - 14 Feb 2008 10:38 GMT
>>> I wonder if someone has ever tried to convert Java 1.4 style code into
>>> code that is using generics? What tools did you use and what was your
[quoted text clipped - 8 lines]
>> Collections class. There you do it by monkey-see-monkey do looking
>> for a similar collection.
> Programming should *never* be monkey-see-monkey-do! If you don't
> understand what you're writing, then you're probably making a bug.
OTOH I find reading examples can be a useful way of arriving at a better
understanding.
According to Wikipedia monkey-see-monkey-do means different things in
different locales.
Daniel Pitts - 14 Feb 2008 18:46 GMT
>>>> I wonder if someone has ever tried to convert Java 1.4 style code into
>>>> code that is using generics? What tools did you use and what was your
[quoted text clipped - 14 lines]
> OTOH I find reading examples can be a useful way of arriving at a better
> understanding.
Agreed. Acceptable for training for programming. Not production
programming.
> According to Wikipedia monkey-see-monkey-do means different things in
> different locales.
But they both involve mimicry without understanding.

Signature
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
Roedy Green - 15 Feb 2008 07:14 GMT
On Wed, 13 Feb 2008 15:18:23 GMT, Roedy Green
<see_website@mindprod.com.invalid> wrote, quoted or indirectly quoted
someone who said :
> There you do it by monkey-see-monkey do looking
>for a similar collection.
What I meant by that is you can copy techniques without going to the
work of creating them from scratch. You have to understand them only
weakly -- knowing what the syntax means, without necessarily
developing the skill to compose them.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Royan - 15 Feb 2008 10:18 GMT
Ok, thank you everyone! I was also wondering what other people think
about this and I guess I got the common point :)
Royan a écrit :
> Hi all,
>
> I wonder if someone has ever tried to convert Java 1.4 style code into
> code that is using generics? What tools did you use and what was your
> overall experience?
In eclipse, select your project, right click on it, and then Refactor -> Infer Generic Type Arguments...
I guess you will have to check/correct some piece by hand, but most of it will be done automaticaly, depending how complexe is the code.
Patricia Shanahan - 15 Feb 2008 14:35 GMT
> Royan a écrit :
>> Hi all,
[quoted text clipped - 8 lines]
> I guess you will have to check/correct some piece by hand, but most of
> it will be done automaticaly, depending how complexe is the code.
However, in my experience it works much better if the programmer has
some experience with generics.
I tried that technique shortly after I moved to 1.5, and got in such a
muddle that I had to revert out the changes and live with the warnings.
A few months later, I tried again on the same program and it all went
through very smoothly.
The difference was that I had been using generics in new code and
reading about them. During the first attempt, I was essentially
guessing, and making a lot of wrong choices, when Eclipse did not know
what to do. During the second attempt, I knew what I was doing.
Patricia