OODBTG Reference Model
Some operations alter the behavior of future requests. For example,if the ContainsPart operation returns TRUE or FALSE depending on whethera certain bin contains a certain part, then the result of ContainsPart(bin1,part2)may be changed by the request StoreInBin(bin1,part2).
The general concept of "state" concerns the information thatmust be remembered when a request alters the future behavior of other requests.Some models equate state with structural "attributes", i.e.,state consists of the current values of attributes. In other models statemay be defined as the results returned by certain operations, or statemay not be precisely defined.
OMG Core Object Model
4.2.1 Basic Concepts
State is required in an object system because it captures the informationneeded to affect operations. For example, the operation marry takestwo person objects as input arguments and produces side effectson these two objects. State captures these side effects, and, presumably,a subsequent application of the spouse function to either objectwill now yield a different result from what it did before. In the CoreObject Model, operations are used to model the external interface to state.Attributes and relationships, which can be used to model the externallyvisible declarations of state more succinctly, are currently defined inthe OMG OM Components Guide.
Editor's note: the OMG OM Components Guide exists in draft form only.
184.108.40.206 Example type interface
The Core Object model does not formally define state but acknowledgesthat the execution of some operations may affect the way the same operationor other operations behave in the future.
OMG CORBA IDL
The state of CORBA objects is accessed through IDL defined interfacesto the object. Invoking operations on objects may cause state changes.
State is modeled by the properties of an object. A property can be anattribute or a relationship. The attributes and relationships of an objectare defined as part of the type interface. Attributes take literals astheir values; relationships can only be defined between two nonliteralobject types.
In a sense, EXPRESS models only state; in another, it has no need ofstate since it has no concept of state change.
Open Distributed Processing
An object is characterized in RM-ODP Part 2 by its behavior and, dually,by its state.
State is defined in RM-ODP Part 2 as the condition of an object thatdetermines the set of all sequences of actions in which the object cantake part. Since, in general, behavior includes many possible series ofactions in which the object might take part, knowledge of state does notnecessarily allow the prediction of the sequence of actions which willactually occur. [In other words, a given state may imply the truth valueof preconditions for several different actions. In accordance with RM-ODPPart 4, legal state transitions are defined by the preconditions and postconditionsof the operations.] State changes are effected by actions; hence a stateis partially determined by the previous actions in which the object tookpart. An object is encapsulated, i.e. any change in its state can onlyoccur as a result of an internal action or as a result of an interactionwith its environment.
To be more specific, Part 4 of RM-ODP defines state as the values ofthe variables declared in the state schema associated with the class schemaof which the object is an instance. (Part 4).
Management Information Model
Some state attributes have been defined for managed objects in [ISO/IEC10164-2]. The three primary state attributes are the operational state(valid values are enabled and disabled), administrative state (valid valuesare locked, unlocked and shutting down) and usage state (valid values areidle, active and busy). These state attributes may be used in managed objectclass definitions.
SQL3 supports state in the form of the values of the various SQL3 datatypes. For example, the state of an ADT instance is the ordered sequenceof stored components of an ADT instance; the state of a row is the orderedset of values of its columns; and so on. Values can only be stored persistentlyby storing them in the columns of database tables.
The state of the Matisse metamodel is represented by values stored inthe objects which represent the metamodel. The state of the class schemais represented by the values stored in the objects which represent thedatabase schema. The state of an instance is represented by values storedin the instance. Values may be literals or OIDs that serve as pointersto related objects.
All objects (metamodel objects, class schema, and instances) are storedon disk in buckets, which are discrete units of transfer of informationfrom client to server. Bucket size can be optimized by the user for applicationperformance.
The state of the database is determined by logical time, which incrementsat commit time of each transaction. The database may be viewed from anylogical time specified by the user. The user sees all objects which existedat the specified logical time in the state as it existed at that logicaltime. This includes metamodel objects and class schema objects, as wellas instances.
The state of a C++ object is defined by its data members. Eachobject of the class that is created gets a copy of all the data members,except for those declared as static.static data members aredata members shared by all instances of the class; these would be equivalentto the instance variables of a Smalltalk class object.
Object state in OO COBOL consists of data items (which may be structured)defined in class object or object data divisions, and data defined withinmethods of class objects or objects. See entry under 7. Types and Classes,for the structure of class definitions, and entry under 2.5 methodsfor the structure of method definitions.
The state of a Smalltalk instance is represented by the values of itsinstance variables.
The state of an Eiffel object is represented by the data stored in its`attributes'. The attributes of an object may be attached to either simpleobjects, (integers, reals, etc.) or complex objects (user defined types).
The state of an object may be accessed through the names of its attributes(depending on the publicity of those attributes). The attributes may beattached or not attached to another object. If the attribute is not attached,(i.e., is not pointing to anything) it is said to be a `Void' reference.(See also entry under 9. Noteworthy Objects).
An attribute may be either a reference type, whereby it is a reference(pointer) to an object, or it may be an expanded type, whereby it is anotherobject itself.
For example, a class with the following attributes:
a: A - attribute a of type A
b: expanded B -- attribute b of type expanded B
May appear in memory as follows:
a -----> instance of A -- a reference to an object of type A
b (an instance of B) -- b an actual object of type B
The state of an attribute can also be accessed by the values of functions(as opposed to procedures) that return some value that represents partof the state.
Via a public interface of a class, attributes and functions with noarguments appear identical. The user of the class does not need to knowwhether the object returned is an actual attribute of the class or calculatedby a function of the class.
In Cecil a method declaration whose body is the keyword fielddefines a pair of accessor methods which share hidden mutable state. Theget accessor method (whose name is the same as the declared field)takes a single argument, specialized on the object "containing"the field, and returns the contents of the field. The set accessormethod (whose name is set_ followedby the declared field name) takes two arguments: one specialized on theobject containing the field and the second unspecialized. When invoked,the set accessor mutates the contents of the field to refer to its secondargument; set accessors do not return results. Specializing the accessormethods on the object containing the field establishes the link betweenthe accessor methods and the object, allowing the accessor methods to beconsidered part of the object's implementation. See entry under 5. Encapsulation.
In SELF, objects consist of named slots used to represent both statevariables and operations. Objects access variables in the same way theyinvoke operations: by sending messages. For example, to access its Xvariable, a point object sends itself the "X"message. The message finds the slot named "X",and evaluates the object found there. If the X value is a number, the resultof the evaluation would be the number itself. To change the value of itsX variable, a point object sends itself the"X:" message with the new value asits argument. The message finds the slot named "X:"(which is the assignment slot corresponding to X),and evaluates the object found there (which would be the assignment primitive,as described in the SELF entry under 2. Objects).
System Object Model (SOM)
The state of SOM objects is accessed through published interfaces toan object. Invoking operations on objects may cause state changes.
OLE Component Object Model
State in the Component Object Model consists of a set of stored valuesessentially equivalent to C++ data members.
Analysis and Design Methods
SA: "A state [of a class] representsa stage in the life cycle for instances of the object [class] concerned."States are modeled with a Moore diagram.
CA: "An Object State is the identificationof Attribute value(s) which reflects a change in Object behavior."
RA: "An abstraction of the attributevalues and links of an object wherein sets of values are grouped togetherin states according to the properties that affect the gross behavior ofthe object."
JA: States are modeled with a Mealy diagramaugmented by conditions on the transition edges.
"The internal state is what characterizesall the values of those variables that are important for description, aswell as variables relating to the application and variables that are includeddue to the implementation environment."
"The computational state describeshow far we have come in the execution [of a use case], as well as the potentialfuture execution."
WD: Not used
MD: "The notion of state used hereis simple: every instance of a class has a certain number of fields, correspondingto the attributes of the class. The values of these fields at any pointduring system execution determine the state of the object." ...[T]hestate is a pure abstraction, never accessed directly, but only manipulatedthrough commands [procedures] and queries [functions]."
EA: "A basic part of behavior modelingis the set of states an object exhibits in a system. ...[A] state representsan object's status, phase, situation, or activity."
FA: "In the analysis phase, thestate of a system is modeled as a set of objects [and their attributes]that participate in relationships." "Note that all of the operationsin an operation model act on the same global state... The operation modelspecification says nothing about the intermediate states through whichthe system passes while the operation is active."
FD: "Each class has an abstractstate space that defines the semantic state of the class. The actual concreterepresentation of that state is encapsulated. The complete abstract statespace of a class should be reachable from the class interface."
FC: "A state machine is some collectionof states and labeled transitions between them." The states are translatedfrom analysis, and remain global states.
OA: "State is a collection of associationsan object has with other objects and object types."
BD: "The state of an object encompassesall of the (usually static) properties of the object plus the current (usuallydynamic) values of each of these properties." "The state of anobject represents the cumulative results of its behavior."
HA: State is the combination of valuesof the attributes and associations.
NA: "System state[:] The sum ofall information stored in a system." "Object state[:] That partof the system state that has an effect on the future behavior of an object.Object state often corresponds to one or more attributes of an object,but this does not necessarily mean that data is stored in the object itself."
features matrixintro page