[PEAK] IntroToPeak

Phillip J. Eby pje at telecommunity.com
Tue Dec 23 17:07:54 EST 2003


At 03:40 PM 12/23/03 -0600, darryl wrote:

>Just reviewing the IntroToPeak/ToDo, and  i noticed where pje(?) mentions 
>an IGreetingService so it can be usable by web, XMLRPC etc.
>
>Since i have a little command-line app that right now is very much 
>modeling IntroToPeak would you be willing to desribe a little what
>you mean by this?

I meant something like:

class IGreetingService(protocols.Interface):
     def greetingFor(name):
         """Return greeting for the customer named 'name'"""

And then creating a class that did this, assuming that a transaction was in 
effect.  One would then use something like:

[Component Factories]
helloworld.interfaces.IGreetingService = "helloworld.service.GreetingService"

And then various apps such as command line apps, CGI, web, XML-RPC, etc. 
would just have components that do:

     greetingSvc = binding.Obtain(IGreetingService)

or:

     greetingSvc = binding.Make(IGreetingService)

depending on whether they want to share (Obtain) or have their own (Make) 
greeting service instance.




More information about the PEAK mailing list