Re: Interface complexity problem in game



"H. S. Lahman" <h.lahman@xxxxxxxxxxx> wrote in
JwUZe.4140$qC4.425@trnddc02:">news:JwUZe.4140$qC4.425@trnddc02:

> Responding to Guild...
>
> OK, but a couple of caveats. Facades should be simple. That is,
> they should not contain problem semantics in their implementations;
> they exist purely as a decoupling agent to hide detailed
> implementations. Ideally they simple redirect a message. However,
> that segues to the second caveat...

I've got that part, no problem.

> Note that in event-based processing one needs only one processEvent
> (event id, <data packet>) method in the interface. This is
> fundamentally equivalent to a bunch of processAnEvent (<data packet>)
> methods, which is why lots of methods in a Facade interface is not a
> problem.

That's true, but some nonfundamental things are better with methods
instead of event ids. I can have compile-time checking of the type of
data packet. Methods are a little simpler and easier to document than
event ids. I'd need some kind of switching code to identify the event
ids and unpack the data packet before I pass the message on.

> The real key to decoupling, though, is that only by-value data is
> passed. The data packet may be implemented as an object (this is
> what DAO is about) but it exists only for the communication. That
> is, one does not pass objects across the subsystem boundary that are
> part of the subsystem implementation because that exposes the
> subsystem implementation.

I'm a little uncertain about this part. I am passing objects through
the facade, but they may or may not be considered part of the subsystem
implementation. I have a world filled with active entities, game
creatures, and I let them interact through a facade so that I don't
have to reveal how the entire world is implemented, but I do let them
pass objects to the facade that will go to other creatures and play an
active roll inside them.

I'm only revealing to each creature that there are other creatures on
the other side of the facade that are implemented the same way.

The facade isolates each creature from the rest of the world, so there
will be always creatures on both sides, which blurs for me what is
actually part of the subsystem.
.



Relevant Pages

  • Re: Interface complexity problem in game
    ... In that case it is a subsystem interface. ... Using the GoF Facade pattern is a common way to implement subsystem interfaces. ... Subsystem interfaces should be pure data transfer interfaces. ... That is, one just has {message id, data packet} where the data packet contains by-value data. ...
    (comp.object)
  • Re: Multiple controllers hierarchy?
    ... I'd like to design an abstract controller that is implemented depending on different communication mechanisms. ... Then let the messaging subsystem decode the message data packet into whatever message paradigm one is using. ... Conversely, the messaging subsystem decodes an external message, encodes the appropriate data packet, and invokes the proper application subsystem Facade method in the other direction. ...
    (comp.object)
  • Re: Help on choosing a valid pattern: composite or not?
    ... But that class would only exist in the UI subsystem in my ... In the GUI subsystem where GfxNode might live I am expressing an entirely different set of paradigms for display and I might have a handy MVC infrastructure to make the code simpler, which is where GfxNode comes into the picture. ... I can go directly to the View from the subsystem interface. ... Let's say I have defined a Facade pattern class for the interface called, for lack of anything better, GUIInterface. ...
    (comp.object)
  • Re: Text terminal rendering design
    ... Which is exactly what would happen in your case when the interface ... Every client would have to ... The only alternative you have is to provide a true Facade ... you have to kludge your implementation of the subsystem. ...
    (comp.object)
  • Re: Classes as units of reuse
    ... Component ABC { ... The thing that is not clear in your pseudo code is the nature of the relationship between ABC and DEF. ... IMO, the second approach would be the best where one abstracts some set of objects with the proper functionality and then decouples their details from the rest of the application via a Facade interface to which the clients all talk. ... In the OO paradigm one basically has three levels of logical indivisibility: subsystem, object, and responsibility. ...
    (comp.object)