Re: [pcgen_developers] Re: Facets Implementation Feedback
The addToken calls are dealing with Tokens that are different interfaces and don't share common characteristics. So generics there would be a lot less valuable. In the case of the PObjects/CDOMObjects, we have a dozen or so items that share behavior and how they should be processed. This is the exact use case Generics was designed for, in order to avoid the copy-paste anti-pattern.
thpr@... and tppublic@...
--- On Wed, 8/26/09, Connor Petty <mistercpp2000@...> wrote:
From: Connor Petty <mistercpp2000@...>
Subject: Re: [pcgen_developers] Re: Facets Implementation Feedback
Date: Wednesday, August 26, 2009, 10:09 PMI agree, when it comes to dealing with the Class class, generics
becomes extremely difficult to handle. I just don't bother using
generics in this particular instance. You can see what I mean in the
addToken calls in my PluginLibrary class!
On Wed, Aug 26, 2009 at 2:43 PM, thpr<thpr@...> wrote:
> --- In firstname.lastname@example.org, James Dempsey <jdempsey@...> wrote:
>> I was
>> surprised by the generics hitting quite so quickly, such that the
>> concrete object DomainFacet was empty. :) I can see the benefit in
>> reused code though.
> It's almost to the point of being hard for me NOT to use Generics ... It
> does save effort though since things like TemplateFacet can leverage the
> same code (and tests, etc.) to avoid duplication and copy/paste error. At
> some point you have to wonder if the DomainFacet is worth it, or whether you
> simply store it in PlayerCharacter as a ListFacet<Domain> similar to how the
> LST file loaders are stored as GenericLoader<T> in LstSystemLoader.
>> One question - is there any benefit using Class<?> in the cache key
>> rather than the plain Class ?
> Eliminating a compiler warning for Generics. I run with those warnings on,
> because there are actual issues that can be exposed by not using Generics
> (especially when you are dealing with classes coded for Generics). Therefore
> it reduces the number of warnings I have to look at in the PCGen code.
> Functionally, Generics are stripped out when the .class file is created, so
> regardless of the value in the angled brackets (or lack of angled brackets),
> the resulting code is identical.
>> The FacetLibrary works well for a demo, but if we are going down the DI
>> route, it will not be necessary. [snip]
> Absolutely agree. I hope we do DI and thus FacetLibrary is just a bridge to
> that implementation.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
start: 0000-00-00 end: 0000-00-00