> Date: Mon, 11 May 2009 15:35:24 +0200
> From: [email protected]
> To: [email protected]
> Subject: Re: [qi4j-dev] Pattern for modeling Roles, State, Entities
>
> On Sat, May 9, 2009 at 5:12 PM, Staz . <[email protected]> wrote:
> > By the way, Niclas, you wrote:
> >
> >> 5. The ControlProgrammer can modify the ControlProgram, by requesting
> >> the Controllers as ProgrammableControllers (i.e. WorldObjects). It is
> >> the same underlying entity state, and the ControlProgrammer have now
> >> access to make Wiring changes. It can also query for what
> >> Inputs/Outputs and Parameters(see below) are available.
> >> <snip>
> >> 8. A third role on the Controllers is the QueryableController, which
> >> basically allows you to retrieve the internal state of the Controller
> >> for display purposes.
> >
> > Is it possible to do something along the lines:
> >
> > QueryableController qc = <some way of obtaining a queryable controller>;
> > ProgrammableController pc = (ProgrammableController)((Object)qc);
> >
> > Basically, is controller same instance, passed around by different reference
> > types?
>
> Not sure what you mean. QueryableController only means in my context
> that the client can request the internal state, normally not seen by
> other roles. For instance; A Regulator can be implemented with several
> algorithms. The ControlProgram doesn't care what the algorithm is or
> what the arguments for the algorithm are. Those are viewed and set as
> parameters via a QueryableController role.
>
> Since my controllers are aggregated entities, as part of
> ControlProgram, I can't query for them directly in Qi4j.
>
Ahh, okay. I think I thought "QueryControllers" meaning same as
"ImmutableControllers". But seems you allow to change parameters of Controllers
even through QueryableControllers. Or are those Parameters even
Controller-specific?
Maybe more generally, I think I might be looking for something like "const"
keyword in C++. Ie, create two roles, which shouldn't be castable from one to
another, "MutableRole" and "ImmutableRole". ImmutableRole should have same
state as MutableRole, and if MutableRole's state is changed, it should reflect
to ImmutableRole's state. So then I just pass ImmutableRole around to places,
where I want to be certain that the code of the users of the framework can't
change the state of some role. Am I stepping into a way too deep swamp, sort to
speak? :)
By the way, I think I might understand things a lot better if I saw some code -
the terms and the descriptions you use seem to be more suited for people
experienced with DDD and/or with your specific domain. So to save you the
bother of explaining too much, me looking at the code could help a lot. I hope
I am not asking for too much. Of course if your project is not open-source or
you can't or don't want to give it out, it's no problem. I'll just try to learn
through my own mistakes, that's the most powerful method.
Also, I would be also interested to hear about your elaborate Timer-system you
mentioned in another mail - either code-wise or description-wise. Since I am
quite new to all that, I would be eager to learn the "right way" (I know there
is no silver bullet for everything, but there are probably some right and wrong
things to do with Qi4j and/or Java).
_________________________________________________________________
Show them the way! Add maps and directions to your party invites.
http://www.microsoft.com/windows/windowslive/products/events.aspx
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev