Re: [Zope] Newbee interfaces and implementations

2006-01-19 Thread Roman Klesel
bruno modulix schrieb:
 So you recommend that I should just skip them as long as I'm on Zope2?
 
 
 Short answer :  yes. Unless you plan to switch to Zope3 really soon, but
 then, I'd recommand that you skip Zope 2.x !-)

No, I'll be with Zope2 for a while. I'm running an Plone site too and dont't
have the memory to run a second Zope3 instance.

I think my question is answered and I'm a little less confused now. :-)

When I heard the word interface I thought of something like a network 
interface,
which is the communication gateway to the entire machine if you address it from 
network:

- you physically connect it to the network by plugging a cable into the NIC
- you address it by calling an address which is assigned to the NIC.

actually all other devices on the network only see the target machine as a 
network interface
and don't know what kind of system it is plugged into until the methods the 
interface provides
trigger routines that reveal more information.

So, now I understand that interfaces in a the Zope2 context have some different 
meaning.

Maybe I should understand them as pseudo interfaces.

Roman

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Newbee interfaces and implementations

2006-01-19 Thread J Cameron Cooper

Roman Klesel wrote:

bruno modulix schrieb:


So you recommend that I should just skip them as long as I'm on Zope2?



Short answer :  yes. Unless you plan to switch to Zope3 really soon, but
then, I'd recommand that you skip Zope 2.x !-)



No, I'll be with Zope2 for a while. I'm running an Plone site too and dont't
have the memory to run a second Zope3 instance.

I think my question is answered and I'm a little less confused now. :-)

When I heard the word interface I thought of something like a network 
interface,
which is the communication gateway to the entire machine if you address it from 
network:

- you physically connect it to the network by plugging a cable into the NIC
- you address it by calling an address which is assigned to the NIC.

actually all other devices on the network only see the target machine as a 
network interface
and don't know what kind of system it is plugged into until the methods the 
interface provides
trigger routines that reveal more information.

So, now I understand that interfaces in a the Zope2 context have some different 
meaning.


It a programming context, really. You should think of programmatic 
interfaces like the interface between a power supply and a power 
consumer: as long as both agree that the plug should have an end like 
such, and the socket should look so and so, and the voltage is this, it 
doesn't really matter what's generating the power, what's consuming the 
power, or how the plug or socket is made.


--jcc
--
Building Websites with Plone
http://plonebook.packtpub.com/

Enfold Systems, LLC
http://www.enfoldsystems.com
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Newbee interfaces and implementations

2006-01-18 Thread Roman Klesel
Hello,

I'm in the process of learning to develop fs-zope-products.

The developers guide recommends to write interfaces and implement them in 
classes. Now my question:

When I have an interface:

DoThings

with several methods:

doThis()
doThat()
doThattoo()
...

and I have an implementation:

DoThingsClass

How will I then access the methods e.g. in a Template?

Through the interface:

tal:define=context/DoThings/doThis

or through the implemantation:

tal:define=context/DoThingsClass/doThis

I would think the first one should be the case. But then how does the interface 
know where the implementation of the
method is defined since it doesn't import the implementation?

I'm currently on Zope 2.84.

Please shed some light on me!

Greetings Roman



___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Newbee interfaces and implementations

2006-01-18 Thread bruno desthuilliers
Roman Klesel wrote:
 Hello,
 
 I'm in the process of learning to develop fs-zope-products.
 
 The developers guide recommends to write interfaces and implement them in 
 classes. Now my question:
 
 When I have an interface:
 
 DoThings
 
 with several methods:
 
 doThis()
 doThat()
 doThattoo()
 ...
 
 and I have an implementation:
 
 DoThingsClass
 
 How will I then access the methods e.g. in a Template?

myObject = DoThingsClass(any_args_here)
myObject.doThis()

 
 Through the interface:
 
 tal:define=context/DoThings/doThis

should be:
tal:define=some_name context/some_thing/some_attribute_or_method

 or through the implemantation:
 
 tal:define=context/DoThingsClass/doThis

Looks like you're newbie to OO too !-)

A class defines a type. You then need to have an instance of that type
(like, say, 42 is an instance of type integer and 'foo' is an instance
of type string).

(Interfaces (I mean, 'explicit' interfaces) defines an 'abstract' type,
that can be implemented by many classes. With Python's dynamic typing,
you don't *need* explicit interfaces - at least with Zope 2.x. AFAICT,
the recommandation to use explicit interfaces is mostly about Zope3
relying on them to implement some nice features).

So it would be:

tal:define=some_name context/myObject/doThis

As you see, you don't have to worry about interface at this level...

 I would think the first one should be the case. 

And you would be wrong.

 Please shed some light on me!
 

Hope that does...

-- 
bruno desthuilliers
développeur
[EMAIL PROTECTED]
http://www.modulix.com
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Newbee interfaces and implementations

2006-01-18 Thread Roman Klesel
bruno desthuilliers schrieb:
 Looks like you're newbie to OO too !-)
 
 A class defines a type. You then need to have an instance of that type
 (like, say, 42 is an instance of type integer and 'foo' is an instance
 of type string).
 

Yes, true! :-)

  (Interfaces (I mean, 'explicit' interfaces) defines an 'abstract' type,
 that can be implemented by many classes. With Python's dynamic typing,
 you don't *need* explicit interfaces - at least with Zope 2.x. AFAICT,
 the recommandation to use explicit interfaces is mostly about Zope3
 relying on them to implement some nice features).
 
 So it would be:
 
 tal:define=some_name context/myObject/doThis
 
 As you see, you don't have to worry about interface at this level...

So you recommend that I should just skip them as long as I'm on Zope2?

I would be happy with that. I find them confusing when they don't
really interface with but just document my methods.

Thanks

Roman


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Newbee interfaces and implementations

2006-01-18 Thread bruno modulix

Roman Klesel a écrit :

bruno desthuilliers schrieb:


Looks like you're newbie to OO too !-)

A class defines a type. You then need to have an instance of that type
(like, say, 42 is an instance of type integer and 'foo' is an instance
of type string).




Yes, true! :-)


!-)


  (Interfaces (I mean, 'explicit' interfaces) defines an 'abstract' type,


that can be implemented by many classes. With Python's dynamic typing,
you don't *need* explicit interfaces - at least with Zope 2.x. AFAICT,
the recommandation to use explicit interfaces is mostly about Zope3
relying on them to implement some nice features).

So it would be:

tal:define=some_name context/myObject/doThis

As you see, you don't have to worry about interface at this level...



So you recommend that I should just skip them as long as I'm on Zope2?


Short answer :  yes. Unless you plan to switch to Zope3 really soon, but 
then, I'd recommand that you skip Zope 2.x !-)



I would be happy with that. I find them confusing when they don't
really interface with but just document my methods.


The Interface package offers much more than simple documentation. But I 
don't think you will find much Zope 2.x code using it.


My 2 cents
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )