Co-existence
From APIDesign
(Redirecting to AlternativeBehavior) |
|||
Line 1: | Line 1: | ||
- | + | Often one needs to provide similar, yet slightly different [[AlternativeBehavior]]s of the system. This page describes various levels on which such [[co-existence]] can take place. | |
+ | |||
+ | TBD. | ||
+ | |||
+ | == Object level == | ||
+ | |||
+ | One can configure two objects to have the same type (external interface), but slightly [[AlternativeBehavior|different behavior]. | ||
+ | |||
+ | == Class level == | ||
+ | |||
+ | The behavior is associated with class - e.g. in [[Java]] one needs to load the class by two different classloaders to get different behavior. This way one can get multiple [[singleton]]s. | ||
+ | |||
+ | == Call level == | ||
+ | |||
+ | Is it? Would be behavior that inspects stacktraces. Probably [[Java]]'s security policy falls into the category. | ||
+ | |||
+ | == Process level == | ||
+ | |||
+ | The behavior is the same throughout the process. System.getProperty("...") or various [[singleton]]s in core [[Java]] libraries ('''SecurityManager''') are example of such [[API]]s. One needs to start new [[Hotspot|virtual machine]] to get different behavior. | ||
+ | |||
+ | == Computer level == | ||
+ | |||
+ | Running two different HTTP servers on port 80 is possible only with two computers (ignore case of virtual hosts). | ||
+ | |||
+ | == Cloud level == | ||
+ | |||
+ | To achieve [[AlternativeBehavior|parallel behavior]] of a complex system (kenai.com, netbeains.org) is often possible only with duplicating all its network. |
Revision as of 04:19, 25 January 2010
Often one needs to provide similar, yet slightly different AlternativeBehaviors of the system. This page describes various levels on which such co-existence can take place.
TBD.
Contents |
Object level
One can configure two objects to have the same type (external interface), but slightly [[AlternativeBehavior|different behavior].
Class level
The behavior is associated with class - e.g. in Java one needs to load the class by two different classloaders to get different behavior. This way one can get multiple singletons.
Call level
Is it? Would be behavior that inspects stacktraces. Probably Java's security policy falls into the category.
Process level
The behavior is the same throughout the process. System.getProperty("...") or various singletons in core Java libraries (SecurityManager) are example of such APIs. One needs to start new virtual machine to get different behavior.
Computer level
Running two different HTTP servers on port 80 is possible only with two computers (ignore case of virtual hosts).
Cloud level
To achieve parallel behavior of a complex system (kenai.com, netbeains.org) is often possible only with duplicating all its network.