Stateful Objects use Mix-ins to define behaviour


Version: 1.0
Category:
Scripts
Python
Requirements:
Seller:
Price:
-
System:
Rating:
4.6
License:

Description - Stateful Objects use Mix-ins to define behaviour



You want to implement stateful objects, which have a different set of behaviours according to what state they are in. This requirement can be achieved with the use of mix-ins. A mix-in is a class which is dynamically inherited by an object. The methods of the mix-in class are thus accessible through the object. This is a clean way of providing objects with standard Interfaces. Chuck Esterbrook has written a discussion of mix-ins, and their implementation in Python. The recipe draws from the Famous "Lumberjack Song". If you`re not familiar with it, all you need to know is that the Passage Of Time modifies the Lumberjack`s behaviour.



More in Python-Stateful Objects use Mix-ins to define behaviour

Object Define Stateful Objects Standard Interfaces Chuck