A blog looking at business communication, knowledge management, scripting tools, OS technology news and other things of interest to mobile tech workers. As I find interesting news this will also contain pointers to thoughts related to configuration managment, change management and general software development.
This introduces a Python module which implements one essential concept in Aspect Oriented Programming (AOP)... The aspects module provides a function called wrap_around.
aspects is a python module that enables Aspect Oriented Programming in Python. For now, it provides a set of ready-to-use aspects and an easy way to create your own aspects. The current possibilities are still a bit limited, but it will soon provide a more exhaustive way to define and use more complex aspects.
Most readers are already familiar with the concepts of object-oriented programming: inheritance, encapsulation, polymorphism. But the creation of objects of a given class, with certain parents, is usually thought of as a "just so" operation. It turns out that a number of new programming constructs become either easier, or possible at all, when you can customize the process of object creation. Metaclasses enable certain types of "aspect-oriented programming," for example, you can enhance classes with features like tracing capabilities, object persistence, exception logging, and more.
As far as I can see only Lightweight Python AOP seems to work with Jython. I was able to successfully run the tracer example with Jython although the timing example failed but not in the aspect library code. The other libraries require Python 2.2 or greater which currently eliminates Jython.
UPDATE
If you are new to Aspect Oriented Programming, here is a quick definition:
Aspect Oriented Programming (AOP) is a technique for separating and isolating crosscutting concerns into modular components called aspects. A crosscutting concern is a behaviour that "cuts" across the boundaries of assigned responsibility for a given modular element. Examples of crosscutting concerns are process synchronization, location control, execution timing constraints, persistence, and failure recovery. There is also a wide range of algorithms and design patterns which are more naturally expressible using AOP.
-Christopher Diggins, Aspect Oriented Programming in C++, August 2004, Dr Dobbs Journal