How to implement state-dependent behavior


Version: 1.2
Category:
Scripts
Python
Requirements:
Seller:
Price:
-
System:
Rating:
4.5
License:

Description - How to implement state-dependent behavior



An object in a program frequently has an internal "state", and the behavior of the object needs to change when its state changes. As someone who tends to think of objects as "data structures on SteroidS", it came as quite a shock when Netscape`s Steve Abell pointed out that an object need not contain any values at all -- it can exist merely to provide behaviors, in the form of methods. This recipe demonstrates a networkcard that depends on its internal state connected/disconnected - to send/receive data.



More in Python-How to implement state-dependent behavior

State Dependent Internal State Implement State Dependent