Closed AlexProudfoot closed 3 years ago
As an aside, ArgoUML doesn't seem to have a way of specifying class multiplicity (limits on size of instance population). Am I missing something?
OK. I suppose this would be better phrased as "it might be helpful if there were a facility to define initial relationship populations and if the link creation were automatically invoked after the classes were initialised". What do you think Simon?
In the meantime, I've tried using an init tag on the domain package but I notice that the procedure I provided is invoked before class initialisation.
Hmmm. If the system initialised to all controllers off duty (which I think would be more reasonable) the problem would become one of making sure the Shift Specification instance was initialised before the Off Duty Controllers since the minimum break time would need to be known in order to put a sensible value (timenow - minimum break time) in the Last Shift Ended attribute.
Oh. I expect what I need to do is convert \<\<init>> operations to normal class operations and create a domain initialisation procedure to call them in the correct order and then link the instances. I could put a description in the domain documentation.
I hope you weren’t too bored by my ramblings Simon.
As an aside, ArgoUML doesn't seem to have a way of specifying class multiplicity (limits on size of instance population). Am I missing something?
«cardinality (max=n)»
I'm trying to use <
> operations to model this but it occurs to me that, in this case, the Duty Stations and Control Zones need to exist before the On Duty Controllers can be linked to them. Is there some way to specify the order of execution of the < > operations?
The order is fixed, see the page on Initialization.
I suppose this would be better phrased as "it might be helpful if there were a facility to define initial relationship populations and if the link creation were automatically invoked after the classes were initialised".
Rather out of scope for CF, I think.
In the meantime, I've tried using an init tag on the domain package but I notice that the procedure I provided is invoked before class initialisation.
Class initialization is only needed for class variables & singletons. I’m not sure quite why I thought user-defined class initialization was needed. I regret ever introducing singletons!
I think there’s something missing with domain init procedures - you can’t ask them to be within the domain!
At the moment, in the House_Management example, I just put all the setup in the Lamp class here. It’d be much better in a domain setup procedure
I expect what I need to do is convert <
> operations to normal class operations and create a domain initialisation procedure to call them in the correct order and then link the instances.
If that’s more comfortable, of course.
I hope you weren’t too bored by my ramblings Simon.
No worries!
I think the best approach is probably to do all the instance and link setup in the domain init operation and not to hive off parts to class operations. Easier to see what’s going on, easier to document.
In the Air Traffic Controller example that I've borrowed from Models to Code, the initial instance populations of the classes are part of the Domain Specification. I'm trying to use \<\<init>> operations to model this but it occurs to me that, in this case, the Duty Stations and Control Zones need to exist before the On Duty Controllers can be linked to them. Is there some way to specify the order of execution of the \<\<init>> operations? If not, how do I include the initial instance populations in the model?