General Discussion (#1) - parameterizing iterators (#6) - Message List

parameterizing iterators

I must say that in my early exploration of the core, I didn't think much of parameterizing anything as the core had numerous raw types already and I thought of it as normal.

From all my sources/teachings/practices however, I'm told never to use raw types as you can't properly subclass raws. Core doesn't subclass raws, but I'm wondering why we purposely neglect them? this goes especially with the player iterators.

  • Message #6

    (It's been a while since I've been in school, and the only knowledge I have of Java 5 and 6 is practical — TWCore, basically — so I might confuse the terms.)

    I think the biggest reason is that all of the core was written before Java 5, where type parameterization in the form it does today didn't exist… as for not subclassing raws, probably just .. raw laziness! :> It might also be something to do with keeping the appearance of classes down to a minimum. At the very least, you're right that the player Iterators could/should be parameterized with the Player type, and Iterators over IDs and such could still use Integer because of the handy assignment conversion from that to int.

    If you get bored and want to do this, of course, all the more power to you. I think mostly how good changes in TWCore are brought about is by people noticing something and being interested enough to want to change it.

    • Message #40

      I've been doing a lot work on fixing these raw typed objects. I noticed that Iterator is almost always never done correctly. But yes defining what type of object it is, IS Highly important as it causes the core to work harder because it has to figure out what the type is instead of expecting it to be the one defined.