Facet Work - Interface in PlayerCharacter
- I received a comment from one of the code team members on the facet work and thought it would be valuable to post the answer here.
The observation was that I was leaving the interface for the facets (e.g. the HandsFacet) within PlayerCharacter (and why was I doing that)
The current work I am doing is the first stage. There is additional work that I think is necessary, but I also think we want to have a further discussion about how far the facets go toward the UI. For example, does the UI access a Facade that hides the Facets, or is the UI Facet-aware?
So generally, there are three primary reasons I haven't inlined the items:
(1) Keep the old interface for things within or closely related to PlayerCharacter that may use the old referencing system (smoothes the transition so refactoring is easier)
(2) Want to have a discussion on how the UI interacts with the Facades. Specifically this interacts with the work Connor is doing in the cdomui branch... I don't want to inline items in Trunk and force a by-hand transition during a merge if that work gets put back into the Trunk. I would prefer to find a time to freeze Trunk and cdomui branch at the same time, do a merge, and then do the inline to reduces headaches.
(3) Avoid wasted work - assuming we do down a DI path (Spring or some similar framework), I think it would be valuable to do some planning on how integration might work and not produce a ton of linkage code that the DI framework would subsume [such as into the XML associated with Spring] ... which I think generally deserves more of a discussion on this in a code team meeting. (Specifically the problem here is that my current use of the Facets using FacetLibrary during object construction is reckless and prone to a stack overflow [or would be reckless if I wasn't using it only a small subset of circumstances]. By keeping items in PlayerCharacter, I dodge having to build code that does the linkages between the Facets until we know how those linkages will be done)
You may also note I'm not rewriting the logic to cache any information at this time - just moving the logic... so these are 1 step at a time. (and you'll note on my progress page http://wiki.pcgen.org/Architecture_Changes_5.17 that things like the LegsFacet have an SVN # against them, but are not struck out, indicating there is still work to be done on that Facet).