Re: generics fun
Re: generics fun
- Subject: Re: generics fun
- From: Lachlan Deck <email@hidden>
- Date: Tue, 22 Jul 2008 08:15:23 +1000
On 22/07/2008, at 8:04 AM, Mike Schrag wrote:
one of the things that frustrates me about generics is working
with collections.
Just that one? Generics are the worst thing since Windows
3.11 ... I try to keep my code clean and add generics where they
make sense but I hate them. There is absolutely NO GAIN in using
them, just annoyance.
Yes, there is added complexity, but "no gain" I really disagree
with. Your API's become much clearer when you use them, and
especially with a big framework like WO, knowing what objects are
coming back out of methods is really helpful.
Yep I agree that it's really useful. But it seems like in a
framework you need to duplicate each method to allow interaction
within the framework as well as from without :-/
e.g.,
public CustomSet<? extends AbstractType> recordSet();
public CustomSet<AbstractType> _recordSet();
Not sure what you mean here. I've never had to do this. It should
only require the "? extends" variant.
Example:
public class AbstractEntity
{
public void addAll... (NSArray<AbstractB> foo);
}
Application can't call the method. Incompatible. So you change it to:
public void addAll... (NSArray<? extends AbstractB> foo);
Now you iterate through foo (within addAll in the framework), but now
you can't call
public void add(AbstractB foo) or something.
It's like pulling a string... you never find the end ;-)
with regards,
--
Lachlan Deck
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden