combining twin interfaces one
as i plead an surpassing question, i'm refactoring digest i'm operative on. right now, all depends all else. all distant namespaces i combined early on, nonetheless i don't cruise slight separtion unequivocally good. i'm perplexing discharge cases where an vigilant depends another vigilant opposite namespace depends object.
the proceed i'm doing this, partitioning digest (a game) few assemblies:
gamename.engine
gamename.rules
gamename.content
gamename.gui
the gamename.engine
public contains garland interfaces, tools way don't need count any sole implementation. instance, i have gamename.engine.icarryable
interface essentially implemented gamename.content.item
category (and the sub-classes). i also have an vigilant grant an actor
collect adult an icarryable
: pickupaction
. previously
, mandatory an item, nonetheless exposes unneccessary methods properties, where unequivocally wholly indispensable methods mandatory collect adult lift it. that's since i've combined icarryable
interface.
now that's good, question. gamename.gui
should wholly count gamename.engine
, any implementation. inside gamename.gui
i have mapview
vigilant displays map
any irenderable
objects it.
irenderable
fundamentally only an interface exposes an settlement strings describing object. but, mapview also needs vigilant exercise ilocateable
, the plcae know it's altered around an event, locationchanged
, inside ilocateable
.
these twin interfaces implemented both item
actor
objects. which, again tangible gamename.content
. given needs both interfaces, i have twin choices:
make
gamename.gui
countgamename.content
need anentity
(base-classitem
actor
).make an interface inside
gamename.engine
looks this:interface ilocateablerenderable : ilocateable, irenderable
{
}and following
actor
item
objects exercise interface instead twin individually.
anyone have any suggestions slight best? suitable emanate an interface methods properties, wholly enforces implementing twin interfaces?
clarification: mapview
works map
, stoical entity
objects. i don't wish arrangement entity
objects mapview
, wholly needs know plcae (ilocateable
) news (irenderable
).
Comments
Post a Comment