avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paulo Gaspar" <paulo.gas...@krankikom.de>
Subject RE: Divergence from Avalon (was Re: [RT] Is Poolable Harmful?)
Date Sat, 12 Jan 2002 01:14:16 GMT
Hi again,

> -----Original Message-----
> From: Peter Donald [mailto:peter@apache.org]
> Sent: Friday, January 11, 2002 11:20 PM
>
> 
> On Sat, 12 Jan 2002 07:48, Paulo Gaspar wrote:
> > Why does putting a String and a Context instead of an Object transmit
> > more knowledge.
> 
> Because the string is meant to indicate a Role which in turn specifies an 
> interface.

Yes, that bit is all over Avalon.

But the String does not make it SAFER. You have to put the right thing
there. It is not safer than using an Object. It is not like using an
enumerated type.

It is funny how Delphi has something that would make the role and the 
lookup for a rule type safe. Lets see if I still remember... I think
a lot of syntax is going to be wrong but is something like this:

type  // type declaration section

  TRole = interface(...)
   ...
  end;

  RoleType = type of TRole;  // The interesting construct

  TMyRole = interface(TRole) // extends TRole
   ...
  end;

And now you could declare lookup() like this:

  function Object lookup(role: RoleType);

And it will only accept as parameter types that extend Role, like in

  c := cm.lookup(MyRole);


I miss this one. Sorry if there are syntax errors everywhere but I 
think you will understand the meaning.

Actually, I am not 100% sure this works with interfaces but I sure
used it with classes.


 
> > It is all in what you do with it.
> >
> > I could call lookup like this:
> >   c = cm.lookup("$#@))(sdjhfkjh");
> 
> This would violate Avalons design as "$#@))(sdjhfkjh" is not a valid role 
> name. All CMs would through a ComponentException (or should).
> 
> The string passed in tends to look like
> 
> com.biz.MyInterface
> 
> or optionally
> 
> com.biz.MyInterface/SOmeOtherMagicValueAtEndAfterSlash

Sure, I was talking about type safety.

You can pass just the same value if lookup has a Object parameter instead
of a String parameter. And type safety goes not very far in this case
because you always have to defend yourself with constants and so to be sure
you pass a valid value.


> > I like very much this structure.
> 
> Its almost there already - except we use different names for it. 
> Context == 
> what you call CM and CM is what you called ServiceManager.
> 
> The only missing thing is Context passed into ServiceManager where now we 
> require it to be serialized to a string and tacked ont to end of 
> Role string

Why?

A Context does not allow me to get a SingleThreaded component and then
release it. Even from an interface POV something is missing.

Why do you insist my CM is a Context?


> -- 
> Cheers,
> 
> Pete
> 
> ----------------------------------------
> "Liberty means responsibility. That is 
>       why most men dread it." - Locke
> ----------------------------------------

Oh! A classical one.


Have fun,
Paulo Gaspar


--
To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>


Mime
View raw message