CHARACTERISTICS OF A GOOD, FUNCTION ORIENTED DESIGN

, , No Comments

 High Level Characteristics

The following are the high level characteristics of a good function oriented design:

Functional Independence
The modeled functions should be independent in terms of the tasks they perform.
This would help in.

• Reusability: The function can be more reusable if it performs a single task.

Maintainability: Maintainability is increased due to single task execution and loose coupling.

• Troubleshooting:
Helps in quicker and easier debugging in case of exception scenarios.

• Understandability: The function is more easily understood.

Adherence to Key Design criteria

The functions should' adhere to other important design criteria:

• Completeness: The functions should implement all the requirements
specified in the requirements document completely.

• Correctness: The functions should implement all the requirements as
per their specifications correctly.

Efficiency: The functions should efficiently use resources such as,
database connection, file connection, etc.

• Functional cohesion: This is the strongest type of cohesion wherein,
all functions within a module are designed to achieve a single
functionality.

• Cost: The functions should aim to reduce the overall cost in terms of
maintainability and extensibility.

Module Level Characteristics

In this section, we shall look at the main characteristics that are to be possessed by for a
good design.

Cohesion
Cohesion is the measure of how well the internal elements of module or a
function are connected to each other. In other words, the function should perform
only a single tasks. The logic and variables present in the function should be to
perform a single activity only, in the most optimal fashion. This enables a strong
internal relationship between the internal elements of a function.

Types of Cohesion
The following are the different types of Cohesion:

Coincidental cohesion: In this type of cohesion, the internal
functions in a given module are loosely correlated.

• Communication cohesion: In this type of cohesion, the functions
within the module update the same data type.

• Sequential cohesion: The functions of a module are said to have sequential cohesion if individual functions of a module form a sequenced for executing a given functionality. For instance, the output of the first function is fed as input for the second function

• Functional cohesion: This is the strongest type of cohesion wherein,
all functions within a module are designed to achieve a single
functionality.

Examples of Cohesion
The following is a function with weak cohesion.
Function update Employee (int empld, String newname) {
Logger log = new Logge ();
Connection con = new Connection 0;
Statement stmt = new Statement ():
Stmt.executeQuery ("Update employee set name = "[lnewnarnel]" where
empho = "[lernpld):
Log.log("Statement executed successfully"); }

The following is a function with strong cohesion:

Function Connection createConnection 0 {
If (con ;:= null)
con = new Connection 0;
return con;}

The above function performs a single task of"creating a connection. The internal
variables and logic is completely concerned with opening a connection. Strong
internal cohesion is always considered a best practice as it helps in re-usability and
maintainability.

Coupling'
Coupling indicates the dependencies across different modules. If, a module is
dependent on multiple functions in another module, then it is known as strong
coupling; lesser number of dependencies indicate loose coupling. A module with
loose coupling on another module also has strong cohesion among its internal
functions. wherein, internal functions co-ordinate to implement the module
behavior.

The design thumb rule is, to have loose coupling so that, each of the individual
modules and its internal structure can be changed with greater impact on other
modules .

Types of Coupling

• Content coupling: In this type of coupling, one module is dependent
and updates the internal state of another module. This is a very tight
form of coupling.

• Common coupling: If modules share the same global data, it is
known as common coupling. For instance, all modules acting on a
common shared persistent store for their functionality, it is an
example of common coupling.

• Control coupling: If a function argument passed from the first
module controls the logic and order of instructions in another module,
for instance, it is an illustration of a control coupling if we pass
control flags and switches from one module to function in another
module through which the sequence of steps and branching can be
varied, it forms control coupling.

• Data coupling: If two modules are coupled by a function parameter it
is said to be data coupling. This is an example of loose coupling. For
.instance, a function call through the-specified argument forms a
standard data coupling.

Conscience .
Two modules are said to be in conscience if a change in the first module requires
a mandatory change in the second module for ensuring overall functionality. This
is also a form of a very tightly coupled modules.

0 टिप्पणियाँ:

Post a Comment