Hi,

After playing with the meta-info and going through a few use-cases one of 
the questions that is still not answered. The main one is whether it is 
valid for their to be "optional" entries in the ServiceManager and/or 
Context. For instance would the following be valid use case in case of 
ServiceManager

void service( ServiceManager sm ) throws ServiceException
{
   if( sm.hasService( MyOptionalService.ROLE )
   {
      myOptionalService = (MyOptionalService)sm.lookup( 
MyOptionalService.ROLE );
   }
}

Ages ago we decided that it was bad form to do the above, however I believe 
Berin has changed his mind (?) and I never really minded it. For those of 
you who weren't around the main reason we decided we did not like it was 
because it allowed the possibility of the following kind of code

if( sm.hasService( MyService.ROLE + "/key3" ) ) { ...use that service... }
else if( sm.hasService( MyService.ROLE + "/key2" ) ) { ...use that service... }
else if( sm.hasService( MyService.ROLE + "/key1" ) ) { ...use that service... }
else { ...use the base service... }

The above code is bad as it mixes concerns. It should be responsibility of 
assembler to map correct service implementation onto single key rather than 
the developer who dictates assembly structure.

In most cases "optional" entrys will never be used but in some (rare) cases 
it could be useful. For example in Phoenix we have one case where optional 
would be useful. What we end up having to do is create a NoopSystemManager. 
There is a few cases in myrmidon that I would also benefit from allowing 
"optional" entrys in context/serviceManager.

Any problems with relaxing and allowing optional thingies?


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to