9.5 A Formal Description of Program Operation

9.5 A Formal Description of Program Operation

To assist in the subsequent discussion of program specification, it will be useful to make this description somewhat more precise by introducing some notation conveniences. Assume that a software system S was designed to implement a specific set of mutually exclusive functionalities F. Thus, if the system is executing a function f F, it cannot be expressing elements of any other functionality in F. Each of these functions in F was designed to implement a set of software specifications based on a user's requirements. From a user's perspective, this software system will implement a specific set of operations, O. This mapping from the set of user-perceived operations O to a set of specific program functionalities F is one of the major tasks in the software specification process.

A pilot astronaut on the Space Shuttle is not aware of the functionality of the Primary Avionics Software System (PASS) that governs the complete operation of the shuttle. A metaphor has been carefully constructed by system designers that permits the pilot to control the shuttle as if it were a standard airplane. The pilot, for example, has a control stick that controls two user-perceived operations: roll and pitch. These operations are implemented in software functions that monitor, for example, the change in resistance in x- and y-coordinate rheostats in the base of the control stick. The pilot operates the spacecraft. The software functions monitor the change in resistance in the rheostats.

Each operation that a system may perform for a user can be thought of as having been implemented in a set of business requirements. There may be a one-to-one mapping between the user's notion of an operation and a program function. In most cases, however, there will be several discrete functions that must be executed to express the user's concept of an operation. For each operation o that the system may perform, the range of functionalities f must be well known. It is possible, then, to define a relation IMPLEMENTS over O × F such that IMPLEMENTS(o, f) is true if functionality f is used in the specification of an operation, o. Within each operation, one or more of the system's functionalities will be expressed. For a given operation o, these expressed functionalities are those with the property:

F(o) = {f:F|IMPLEMENTS(o,f)}

For each operation o O, there is a relation p' over O × F such that p'(o, f) is the proportion of activity assigned to functionality f by operation o. An example of the IMPLEMENTS relation for two operations implemented in four specified functions is shown in Exhibit 5. In this exhibit, we can see that functions f1 and f2 are used to implement the operation o1. We can also see that functionality f2 is a functional part of both operations.

Exhibit 5: Example of the IMPLEMENTS Relation

start example

O × F

f1

f2

f3

f4

O1

T

T

  

O2

 

T

T

T

end example

Exhibit 6 provides an example of the p' relation. These numbers represent the proportion of time each of the functions will execute under each of the operations. In operation o1 functionality f1 may or may not execute. The functionality f2, on the other is hand, is quite likely to execute on operation o1.

Exhibit 6: Example of the p'Relation

start example

P'(o, f)

f1

f2

f3

f4

o1

0.2

0.8

0

0

o2

0

0.4

0.4

0.2

end example

The software design process is basically a matter of assigning functionalities in F to specific program modules m M, the set of program modules. The design process can be thought of as the process of defining a set of relations, ASSIGNS over F × M such that ASSIGNS(f, m) is true if functionality f is expressed in module m. For a given software system S, let M denote the set of all program modules for that system. For each functionality f F, there is a relation p over F × M such that p(f, m) is the proportion of execution events of module m when the system is executing function f. Exhibit 7 shows an example of the ASSIGNS relation for the four functions presented in Exhibit 5. In this example we can see that the function f1 has been implemented in the program modules m1 and m2 . One of these modules, m1, will be invoked regardless of the functionality. It is common to all functions. Other program modules, such as m2, are distinctly associated with a single function.

Exhibit 7: Example of the ASSIGNS Relation

start example

F × M

ml

m2

m3

m4

m5

m6

m7

m8

f1

T

T

      

f2

T

 

T

 

T

  

T

f3

T

 

T

T

T

T

  

f4

T

 

T

 

T

T

T

 

end example

Exhibit 8 provides an example of the p relation. These numbers represent the likelihood that each of the program modules will execute when a particular functionality is invoked. Exhibit 8 represents the proportion of time distributed across each of the six hypothetical program modules. We can see, for example, that p(f1, m1) = 1. This means that whenever functionality f1 is invoked, module m1 will always be executed. On the other hand, we can also observe that p(f3, m5) = 0.2. In this case, there is a relatively low chance that module m5 will execute, given that functionality f2 has been invoked.

Exhibit 8: Example of the p Relation

start example

p(f,m)

m1

m2

m3

m4

m5

m6

m7

m8

f1

1

1

0

0

0

0

0

0

f2

1

0

1

0

1

0

0

1

f3

1

0

1

1

0.2

0.3

0

0

f4

1

0

1

0

1

1

1

0

end example

There is a relationship between program functionalities and the software modules they will cause to be executed. These program modules will be assigned to one of three distinct sets of modules that, in turn, are subsets of M. Some modules may execute under all of the functionalities of S. This will be the set of common modules. The main program is an example of such a module that is common to all operations of the software system. Essentially, program modules will be members of one of two mutually exclusive sets. There is the set of program modules Mc of common modules and the set of modules MF that are invoked only in response to the execution of one or more functionalities. It is clear, then, that MF = M-Mc.

The set of common modules, Mc M is defined as those modules that have the property:

Mc = {m: M | f F • ASSIGNS(f,m)}

All of these modules will execute regardless of the specific functionality being executed by the software system.

Yet another set of software modules may or may not execute when the system is running a particular function. These modules are said to be potentially involved modules. The set of potentially involved modules is:

In other program modules, there is extremely tight binding between a particular functionality and a set of program modules. That is, every time a particular function f is executed, a distinct set of software modules will always be invoked. These modules are said to be indispensably involved with the functionality f. This set of indispensably involved modules for a particular functionality f is the set of those modules that have the property:

As a direct result of the design of the program, there will be a well-defined set of program modules Mf that might be used to express all aspects of a given functionality f. These are the modules that have the property:

From the standpoint of software design, the real problems in understanding the dynamic behavior of a system are not necessarily attributable to the set of modules Mi that are tightly bound to a functionality or to the set of common modules Mc that will be invoked for all executing processes. The real problem is the set of potentially invoked modules Mp. The greater the cardinality of this set of modules, the less certain we can be about the behavior of a system performing that function. For any one instance of execution of this functionality, a varying number of the modules in Mp may execute.

For each functionality f F, there exists a relation c over F × M such that c(f,m) defines the cardinality of the set of functionalities that can call a given module. The c relation can be used to partition the set of program modules into two distinct sets. One set contains the modules associated exclusively with one and only one functionality.[1] This is the set of uniquely related modules Mu, where:

Mu={m:M| f F,c(f,m) = 1}

The second set contains the modules that might be executed by more than one functionality, that is, the set of shared modules Ms, to wit:

Ms={m:M|f Fc(f,m)>1}

There are two distinct ways, then, that we can view program modules associated with functionalities. First, given a functionality, we can characterize each module as indispensably associated with that functionality or potentially associated with it. Second, each program module may or may not be uniquely associated with a given functionality. These two different module classifications are shown in Exhibit 9.

Exhibit 9: Module Classification

start example

Among Functionalities

Within a Functionality

Unique Shared

Indispensable Potential

end example

A functionality will, by definition, be required to have at least two modules and that at least one of them is an element of the set of uniquely related modules and not of the set of potentially involved modules. That is:

If each program module were distinctly associated with a single functionality, then the dynamic behavior of a system could be readily understood and modeled. The two sets Mi and Ms are tightly bound to a distinct functionality. The real problem resides in the set of shared modules Ms and it increases in severity if those modules also belong to Mp. The greater the cardinality of the set of potentially executable modules, the more difficult the task of determining the behavior of a system performing that functionality. In the extreme case, a functionality could express essentially disjoint sets of modules every time it is executed. (Many programs demonstrate this characteristic and they are extremely difficult to test.)

It is clear that each functionality will exercise a certain subset of modules. To return to our example, we can see from Exhibit 10 that functionality f1 does invoke two modules: m1, and m2. Both modules are indispensable to the execution of functionality f1. Module ml is shared with all other functionalities. Module m2 is uniquely associated with functionality f1. In Exhibit 10 we can also see that functionality f3 has some interesting properties. The set is nonempty in this case. Whenever we exercise f3 we can execute from three to five modules. It will be difficult to test this functionality in relation to all other functionalities. Sometimes it will execute module m5 and sometimes it will not. Sometimes it will execute module m6 and sometimes it will not. Sometimes it will execute both modules and sometimes it will not.

Exhibit 10: Modules Associated with Functionalities

start example

 

f1

{m1,m2}

{}

{m1}

{m2}

f2

{m1, m3, m5, m8}

{}

{m1, m3, m5}

{m8}

f3

{m1, m3, m4}

{m5, m6}

{m1, m3, m5, m6}

{m4}

f4

{m1, m3, m5, m6, m7}

{}

{m1, m3, m5, m6}

{m7}

end example

Sometimes it will be desirable to know what functionality is executing at any given moment. We have built a system that will make such a deduction very difficult. For example, if we have just observed the execution of module m1, we cannot deduce which functionality we are executing. Similarly, there is an equivalent problem with module m3. There is somewhat more information in the observation of the execution of module m6. If we have just observed this module execute, then we will know that we are executing either f3 or f4. The case for module m2 is very different. Whenever we see this module executing, we know for a fact that we are now executing functionality f1.

Now let us return to the problem of operations. Users see and perform operations. Functionalities are used by systems designers to implement the set of user operations. From the relationships defined above, we can now clearly establish the relationship between user operations and specific modules that will be exercised in response to a user invoking a particular operation. That is, each operation will be implemented by a specific set of functionalities. These functionalities will, in turn, invoke a specific set of modules when they are executed. Thus, for each operation o, we can clearly establish a set of program modules associated with the expression of that operation at runtime.

Each operation is distinctly expressed by a set of functionalities. If a particular operation o is defined by functionalities a and b, then the set of program modules that are bound to operation o is:

If one operation is to be distinguished from another, then there must be certain aspects of its implementation in functionalities that will be unique. For an operation to be considered distinct, it will be required to have at least one distinct functionality. That is, oi O if the set of distinct functionalities defined as:

has cardinality greater than one.

If we insist that each operation has at least one distinct functionality, then it is possible to identify a set of modules for each operation that is uniquely associated with that operation. This set of modules for operation oi is:

When a program is executing a module m, where , it is quite clear that the user is expressing operation oi. If we wish to determine exactly what the user is doing at any point, we have only to instrument the set of modules . As we receive telemetry from each of the modules so instrumented, the sequence of user operations will be eminently clear.

We can now map the operations in our example to specific program modules. This mapping is shown in Exhibit 11. The specific value of this mapping is twofold. First, if the specification for operation O1 must be changed, we can identify which modules are associated with this operation. Second, there are certain modules that tag each operation that is, they uniquely identify the operation. If, for example, we saw either module in the set {m2, m8}, we would then know that operation o1 was currently being executed by the user.

Exhibit 11: Modules Associated with Operations

start example

 

O1

{m1,m3,m5,m8}

{m2}

{m1,m3,m5}

{m2,m8}

O2

{m1,m3,m5,m6,m7}

{}

{m1,m3,m5}

{m3,m4,m6,m7}

end example

[1], Elbaum, S.G. and Munson, J.C., Investigating Software Failures with a Software Blackbox, Proceedings of the 2000 IEEE Aerospace Applications Conference, IEEE Computer Society Press, November 2000.



Software Engineering Measurement
Software Engineering Measurement
ISBN: 0849315034
EAN: 2147483647
Year: 2003
Pages: 139

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net