O'Reilly logo

Professional Plone Development: Building robust, content-centric web applications with Plone 3, an open source Content Management System by Martin Aspeli

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

7. Aspect-oriented Programming with Adapters

When modeling design with interfaces, we should always endeavor to adhere to the principle of separation of concerns. A component, as described by an interface, should do one thing and one thing only, providing the minimum necessary operations (methods) and attributes (properties) to support that function.

In complex systems such as Plone, we often need to provide general functionality that can act on different types of objects. Continuing with our earlier examples, consider an instrument that is playable.

>>> class IPlayable(Interface):
... """An instrument that can be played
... """
...
... def __call__(tune):
... """Play that tune!
... """

We may write some general code that expects an IPlayable. An ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required