1. Modeling Operations (Transformations) in the Functional Model

Up to this point we have modeled the static structure of a system and classes in the system object model and object model. We have identified system operations and object operations. We have modeled the dynamic stimulus response behavior of the system and objects in the system in the system dynamic model and the dynamic model in which operations are invoked. Now we must look at each operation and define the transformation of inputs to outputs in the system functional model and the functional model. We desire to define the transformation in terms of computation, algorithms, and formulas.

Figure Functional Model Defines Operations
  1. Describing Transformations of Inputs to Outputs

The functional model describes transformations of object values in operations from an input to an output. Several simple operations which transform object values are shown below.

Figure Transformations of Inputs to Outputs

A transformation could be described as follows:

- a table showing the mapping from one object value to another,

- a formula or equations showing the relationship between an input object value and an output object value,

- a text description of the transformation.

For example, one of the simplest transformations is the increment transformation shown above. A table describing the increment transformation would have the entries: 1, 2; 2, 3; 3, 4; etc. The table shows the input and output values. An equation describing the increment transformation would be "aNumber = aNumber + 1". A text description of the increment transformation would be "add 1 to the input value".

A transformation may change the value of an atomic object (1, 4.2, 'c'), a structured object (student1), or a collection object (aListOfStudents). A transformation may change the value of atomic object, the value of an attribute of a structured object, or the value of a member of a collection object. The term value may refer to a literal value, e.g. 1, 4.2, or 'c' or to a reference value, e.g. an object ID such as student1.

A transformation may occur in the following forms of operations:

- A system operation is an operation for the system as a whole. A system operation receives an input object and changes an output object. A system operation may access or modify a system attribute. A sample system operation for a bank ATM system is "withdrawCash".

- A class operation is an operation defined in a class that accesses or modifies a class attribute value. A class operation affects all objects of the class. When a class operation is invoked to change a class attribute value, all objects of the class share this attribute value.

- An object operation is an operation defined in a class that accesses or modifies an attribute value. An operation may receive an input parameter and may send an output parameter. A sample operation in a bank ATM Account class is "updateAccountBalance". This operation modifies the attribute "accountBalance".

In this section we will progress from the system functional model to the functional model as shown below.

System Functional Model Functional Model

Figure Documentation Products in System Functional Model and Functional Model
  1. Modeling System Operations in the System Functional Model

In the System Functional Model we specify all the system operations including the operation input objects (parameters), transformation, and output objects as shown below.

Figure System Operation

The steps to specify system operations is as follows:

Step 1. Start with the System Object Model and System Dynamic Model to identity all system operations.

Step 2. Specify each system operation in the CASE tool that has a transformation of object values in the operation input specification form presented earlier. In the form, state the system operation name, input objects (parameters), transformation, output objects (return values). Optionally, state the system operation preconditions, postconditions, and exceptions.

Step 3. Create the system operation table and system operation report in the CASE tool by running a report script or selecting the appropriate report.

Step 4. Check and update consistency with other models, e.g. the system object model and system dynamic model. Check all diagrams and text specifications for the consistent spelling, capitalization, and meaning of all names.

For the Car Simulation System, we can see the system operations on the system diagram (OMT format) shown below. The system interaction diagram for the Car Simulation System was previously shown.

Figure System Diagram Showing System Operations in Car Simulation System

The following is a the system operation table for the Car Simulation System. C++ data types are used to document the input parameters and return types. The sample CASE tool table script is TABOPER.SCT.

System Operation Table for the Car Simulation System

System Operation Name Input ParametersTransformation Return Type
startgasQuantity = gasQuantity - .1; void
operateint aSpeedgasQuantity = gasQuantity - .1; speed = aSpeed; void
stopspeed = 0; void
makePhoneCalllong aNumber void
receivePhoneCalllong aNumber void
addPassengerPassenger aPassenger void
removePassengerPassenger aPassenger void

The operation table generation script (TABOPER.SCT) is shown below.

Script to Generate the Operation Table

SCRIPT_NOREPEAT_HEADER_BEGIN

Class Name, Operation Name, Input Parameters, Transformation, Return Type SCRIPT_NOREPEAT_HEADER_END

[CLASS_NAME, OPERATION_NAME, CPP_OPERATION_PARAMETERS, OPERATION_TRANSFORMATION, OPERATION_RETURN_TYPE]

  1. Modeling Operations in the Functional Model

Once we have completed the system models, the object model and the dynamic model, we can specify all operations in the functional model. The functional model is the set of transformations and correctness assertions, e.g. preconditions, postconditions, and invariants. A transformation is a description of how an object value may be correctly changed in a formula, expression, table, etc. An assertion is a rule or expression for correctness, e.g. a value must always be greater than zero. An operation precondition is a rule or expression that must be satisfied before the execution of an operation for correct results. An operation postcondition is a rule or expression that is satisfied upon the correct execution of an operation. An invariant is a general rule or expression that must be satisfied at all times by all applicable operations. An exception is an abnormal execution error condition, e.g. listFullError or noGasError that may be raised to signal that an operation cannot be executed correctly. In the car example, the start operation has a precondition and postcondition. The precondition for the start operation is that the gasQuantity must be greater than zero. The postcondition of the start operation is the verification that the correct value of gasQuantity has been computed.. The invariant is that gasQuantity must be equal to or greater than zero and equal to or less than the maximumGasQuantity. In the functional model, we update class specifications with transformations and correctness assertions.

Key aspects of an operation are shown below. Only input and output parameters are shown in the diagram below. An operation may access or update attribute values or global objects.

Figure Parts of a Class or Object Operation

In the Car class, there is transformation in the start operation. The transformation is represented by the formula "gasQuantity = gasQuantity - .1". In this example, when the start operation is invoked, then there is a transformation of the attribute gasQuantity. Specifically, the value of the gasQuantity is changed. When the start operation is invoked the value of the gasQuantity is reduced. There are no input or output parameters for this operation. In the functional model we identify, examine, and describe operations in which there is a transformation of objects.

Figure Drawing Showing the Start Operation

The key aspects of the start operation are graphically shown below. It shows that there are no object inputs or outputs (parameters), the precondition of "gasQuantity > 0", the postcondition of "gasQuantity < oldGasQuantity + 1", the transformation formula, and the exceptions noGasError and calculationError.

start operation

Figure start operation

The functional model is important for many reasons. First, transformations (operations) are important because they accomplish work required by the system requirements. Second, identifying transformations (operations) leads to identifying the system input objects, system output objects, and system operations. Third, identifying operation preconditions, postconditions, and exceptions help create highly reliable operations. Fourth, operations are implemented by coding the transformation equations, preconditions, postconditions, and exceptions.

In the functional model we specify transformations of objects in operations. In the functional model, we specify how objects are transformed in a system. Follow these steps.

Step 1. Start with the system models, object model, and the dynamic model to identify all operations.

Step 2. Specify each modifier operation that transforms object values in the CASE tool operation specification form. Update operation specifications with transformations, e.g. formulas, expressions, equations and correctness assertions, e.g. preconditions, postconditions, and invariants for each operation.

Step 3. Create the operation table and operation report by running a CASE tool report script or selecting the appropriate report.

Step 4. Check and update consistency with other models, e.g. the object model and dynamic model. Check all diagrams and text specifications for the consistent spelling, capitalization, and meaning of all names.

Step 5. Update the C++ source code to reflect the transformations and correctness assertions. Compile and execute the program.

  1. Creating Operation Tables and Reports

After we have identified the class and object operations, we can specify the operations by filling in the CASE tool operation specification form shown earlier. To describe class and object operations, specify transformations and correctness assertions. The steps to update the class specification for transformations and correctness assertions are listed below.

>> Run the CASE tool from Windows

>> Double click on a class

>> Select "Operation Specification"

>> Enter transformations and correctness assertions in the operation specification form

>> Select "Generate - Generate Report" to create the operation table and operation report as shown below

A sample detailed operation table shows the operations in the system with their inputs, preconditions, transformations, postconditions, and outputs. A sample operation table showing three operations for the Car class are shown below. The sample CASE tool script is TABOPPRE.SCT.

Detailed Operation Table Showing Preconditions and Postconditions

Class NameOperation Name Input Para-metersPrecondition

/Exception

TransformationPostcondition

/Exception

Return Type
Carstart gasQuantity > 0/noGasErrorgasQuantity = gasQuantity - .1 gasQuantity < oldGasQuantity

/calculationError

void
Caroperateint aSpeed aSpeed <= maxSpeed

/speedHighError

gasQuantity = gasQuantity - .1;

s rpm = 50 * aSpeed peed = aSpeed

gasQuantity < oldGasQuantity

/calculationError;

speed == aSpeed

/calculationError

void
Carstop speed = 0speed == 0/stopError void

The sample detailed operation table (TABOPPRE.SCT) is shown below.

Script to Generate the Detailed Operation Table Showing Preconditions and Postcondions

SCRIPT_NOREPEAT_HEADER_BEGIN

Class Name, Operation Name, Input Parameters, Precondition/Exception, Transformation, Postcondition/Exception, Return Type SCRIPT_NOREPEAT_HEADER_END

[CLASS_NAME, OPERATION_NAME, CPP_OPERATION_PARAMETERS, OPERATION_PRECONDITION, OPERATION_TRANSFORMATION, OPERATION_POSTCONDITION, OPERATION_RETURN_TYPE]

A sample operation report for the Car class start operation is shown below.








Operation Report for the Car Start Operation

- Class name: Car

- Operation name: start

- Return type or class: none - void

- Input parameter type/class and name: none

- Access: public

- Type of operation: concrete

- Category of operation: modifier

- Implementation language feature: C++ function

- Transformation: gasQuantity = gasQuantity - .1

- Precondition: gasQuantity > 0 else noGasError

- Postcondition: gasQuantity < oldGasQuantity else calculationError

- Exceptions: noGasError and calculationError

- Applicable Invariant: gasQuantity must be equal to or greater than 0 and equal to or less than maxGasQuantity

- Concurrency: Sequential

- Time: Low

- Space: Low

- Description: start operation simulates the start of a car.

Figure Operation Report for the Car Start Operation
  1. Coding Preconditions, Transformations, and Postconditions in C++ Functions

The following is the structure of a function definition with the exception declarations, precondition check, transformation, and postcondition check. Compare this structure with the start function shown in the C++

returnType className::functionName (argument list) throw (exceptionTypes)

{ exceptionType exceptionNameForPrecondition; //exception declaration

exceptionType exceptionNameForPostcondition; //exception declaration

if (precondition check) //precondition check

function statements for transformation; //transformation

else throw exceptionName; //throw exception

if (postcondition check) return; //postcondition check

else throw calculationError; //throw exception

}

The C++ source code is shown below that implements the start operation with correctness assertions.

//////////////////////////////////car.h file//////////////////////

#ifndef __CAR_H

#define __CAR_H

#include <CString.h>

class Car

{ float gasQuantity;

public:

Car () { gasQuantity = 0; }

void start () throw (string, char);

};

#endif

///////////////////////////////car.cpp file/////////////////////////

#include "Car.h"

void Car::start() throw (string, char)

{ string noGasError; //exception declaration

char calculationError; //exception declaration

float oldGasQuantity; //required for postcondition check

if (gasQuantity > 0) //precondition check

{ oldGasQuantity = gasQuantity; //saves oldGasQuantity

gasQuantity = (gasQuantity - .1); //transformation

}

else throw noGasError;

if (gasQuantity < oldGasQuantity) return; //postcondition check

else throw calculationError;

}

///////////////////////////////main.cpp file///////////////////////////

#include "Car.h"

#include <CString.h>

#include <iostream.h>

int main ()

{

Car car1;

try {

car1.start(); }

catch (string noGasQuantity) { cout << "No Gas Error"; }

catch (char calculationError) { cout << "Calculation Error"; }

catch (...) { cout << "Unknown Error"; }

return 0;

}

////////////////////////Sample Output///////////////////////////

//No Gas Error

  1. Summary

The functional model describes transformations of object values in operations from input to output. For the system as a whole, we describe input objects, output objects, and system operations (transformations). Typically, a system operation transforms (changes) an input object into an output object. For classes, we describe class and object operations. For each operation we describe the operation transformation, preconditions, postconditions, and exceptions.

buy cialis cialisfunsurforg cialisfunsurforg onlinehtml site cialis and back pain cialis levitra vs combine viagra and cialis allowed black buy casino cialis diet gambling health jack phentermine poker tag viagra xhtml canada over the counter cialis viagra cialis generic viagra cialis viagra levitra prices women take cialis drug buy cialis tadalafil cialis drinking alcohol cialis online usa levitra vs cialis vs viagra brand name cialis cheapest soft cialis cialis get viagra cialis viagra taking cialis with viagra buy cialis where cialis drugs cialis over dose lowest price generic cialis buy cialis generic ciales web site marketing cialis interaction precautions cialis western open add cialis link new buying generic cialis cialis free cialis suggest url valium detox buy cialis pharmacy cialis experience cialis pills online cialis buy cialis dream pharmaceutical cialis and oral sex cialis lawyer columbus compare viagra cialis levitra viagra cialis levitra buy cialis shop tadalafil cialis fast heart rate cialis online pharmacy online pharmacy cialis seychelles buy cialis ebay find tadalafil cheap cialis cialis injury attorney cincinnati cialis uk similar drugs for cialis buy cialis online submit=buy cialis online cialis dose it work cialis no prescription needed generic cialis muncie indiana buy cialis genericf hostingcom link cialis cheap no prescription cialis injury attorney cleveland cialis versus viagra 20mg cialis canada cialis deals cialis forum cialis free consultation cialis sample price viagra cialis levitra buy cialis link onlineinttc cialis class action lawsuit cialis levitra combine cialis and levitra viagra allowed black buy casino cialis diet gambling jack low online order phentermine poker tag viagra xhtml can cialis and viagra be taken together cialis free sample coupon cialis soft tab online consultation purchase cialis buy cialis online us cialis commercial cialis line differences viagra cialis levitra allowed black casino cialis diet gambling health jack phentermine poker tag viagra xhtml can i get cialis in canada cialis free samples cialis samples sale without prescription cialis in detroit area buy cialis cialis drug prescription cialis on second attempt generic viagra cialis levitra best cialis price canadian perscription of cialis cialis free trial cialis site suggest samples of viagra cialis levitra buy cialis now cialis cheap cialis injury lawyer ohio cialis viagra vs valium buying online buy discount cialis cialis effects side cialis online discount cialis soft allowed black buy casino cialis diet gambling jack online order phentermine poker tag viagra xhtml by cialis comment post posted cialis for sale on line cialis prescription las posas de ciales buy canada cialis cheap generic cialis cialis generic price cialis soft tab prescription cialis on line buy cialis online viagra cialis compare levitra cialis link online suggest discount generic cialis . buy tadalafil cialis cialis for sale cialis open western lowest cialis levitra prices buy cialis dosage effects online side warning cheap cialis generic cialis free sample cialis soft tab online consultation usa side effects of cialis buy cialis link suggest cialis attorney columbus cialis information pamphlet cialis stories viagra cialis generica buy cialis viagra cialis compared to viagra cialis new viagra dangers of taking cialis allowed cialis tag viagra xhtml canada cialis cialis for woman cialis overnight hypertension treatment using cialis buy cheap cialis canadian cialis cialis for women cialis price order cialis submit=order cialis buy cialis in the uk cheapest cialis generic cialis generic cialis sale review cialis levitra viagra buy cialis link onlinenew pharminfo cialis and liver disease cialis how to avoid backache cialis soft tabs penis pump plus cialis buy cialis online cialis comparison levitra viagra cialis icos lily online cialis tadalafil swflash 1.cab buy cialis online dreampharmaceuticals cialis co drug eli impotence lilly cialis julilatiwaveprohostingcom link onlinehtml cialis samples submit=cialis samples mixing cialis and viagra buy cialis without prescription cheap cialis submit=cheap cialis cialis female view cialis review lawsuits involving blindness caused by cialis buy cialis generic online canada cialis line cialis female opinion cialis online submit=cialis online generic cialis submit=generic cialis buy cialis link onlinenettc can you mix cialis and viagra cialis fda approval cialis online buy generic cialis 20 mg best price cialis buy viagra cialis levitra cialis erectile dysfunction cialis official website erection does not go down after taking cialis black casino cialis diet followup gambling health jack phentermine poker post viagra cialis 20mg cialis generic link suggest cialis woman sitemap2 add cialis link buy generic cialis cialis dosage cialis melt packs buy generic cialis online