[Zope3-dev] A component could be implemented as a function or a class?

Jim Fulton jim@zope.com
Fri, 20 Sep 2002 08:29:28 -0400


Suresh Babu Eddala wrote:
> hello everybody,
> 
> I was going thru the documentation of Zope3
> 
> http://dev.zope.org/Resources/ZopeDirections.html
> 
> In this document of the above link i found a line "A component could be 
> implemented as a function or a class"
> 
> which sounds quite confusing to me.
> 
> Would anyone like to explain, I really need to understand this line.

Our definition of a component is:

   "A component" is an object with introspectable interfaces."

More specifically, a component is an object that asserts (usually
through an __implements__ attribute) what interfaces it implements.

An interface could be implemented by an instance of a class, a module,
or by a class itself or even a function. For example, factory interfaces
usually include a single __call__ operation with some signature. Such interfaces
can be implemented by any kind of callable object, including functions and classes.

Jim

-- 
Jim Fulton           mailto:jim@zope.com       Python Powered!
CTO                  (888) 344-4332            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org