Unit 3
Unit 3
Module Coupling
Types of Coupling
1. Data Coupling: Modules communicate by passing data. This is the most desirable
type of coupling. It minimizes dependencies between modules.
Example: A module that calculates the area of a circle receives the radius as input and
returns the area as output. It only depends on the data (radius) passed to it.
2. Stamp Coupling: A complete data structure is passed between modules, possibly
including unnecessary data. It's less desirable than data coupling.
Example: A module that manages student records receives a complete student object,
including name, address, and courses. If it only needs the student ID to perform its
task, it's considered stamp coupling.
3. Control Coupling: Modules communicate by passing control information, such as
flags. This type of coupling is less desirable as it introduces dependencies based on
control flow.
Example: A module that processes user input and another module that validates the
input both rely on a shared flag to determine if the input is valid. This introduces
control coupling.
4. External Coupling: Modules depend on external entities, such as other software or
hardware. This type of coupling is less desirable as it makes the system less self-
contained.
Example: A module that reads data from a file relies on the file system, an external
entity. Any changes to the file system may impact the module, indicating external
coupling.
5. Common Coupling: Modules share global data. This is less desirable as it can lead to
issues with managing the shared data.
Example: Two modules share a global variable to communicate status information. If
one module modifies the variable, it affects the behavior of the other module,
demonstrating common coupling.
6. Content Coupling: One module directly modifies or accesses the contents of another
module. This is the most undesirable type of coupling as it creates strong
dependencies between modules.
Example: A module responsible for formatting text directly accesses the internal data
structures of another module that stores text. This tightly couples the formatting
module to the internal structure of the text storage module.
Module cohesion
Module cohesion is a measure of the degree to which the elements of a module are
functionally related. A strongly cohesive module implements functionality that is related to
one feature of the solution and requires little or no interaction with other modules.
Types of Cohesion
1. Functional Cohesion: The elements of the module are functionally related and
contribute to a single well-defined task or objective. This is the most desirable type of
cohesion. Example: A module that calculates the area of a circle, given its radius, is
functionally cohesive.
2. Sequential Cohesion: The output of one element becomes the input of another
element within the same module. This type of cohesion is based on the order of
execution. Example: A module that calculates the GPA of a student first calculates the
grade points for each subject, and then calculates the overall GPA.
3. Communicational Cohesion: The elements of the module operate on the same input
data or contribute to the same output data. This type of cohesion is based on data
communication. Example: A module that calculates both the current and cumulative
GPA of a student based on their grade records.
4. Procedural Cohesion: The elements of the module are related by a specific sequence
of execution. This type of cohesion is based on the order in which tasks are
performed. Example: A module that first calculates the student's GPA, then prints the
student's record, followed by calculating the cumulative GPA.
5. Temporal Cohesion: The elements of the module must be executed at the same time.
This type of cohesion is based on timing requirements. Example: A module that
performs initialization tasks, such as setting program counters or control flags
associated with programs.
6. Logical Cohesion: The elements of the module perform logically similar operations,
but there is no significant relationship between them. This type of cohesion is based
on logical classification. Example: A module that contains separate code for checking
the validity of each date in an input transaction.
7. Coincidental Cohesion: The elements of the module have no meaningful relationship
and are grouped together arbitrarily. This is the least desirable type of cohesion.
Example: A module that checks the validity of a date and prints a message, where
these tasks have no logical connection.
In FOD, the design starts with a high-level description of the program's functionality. Each
step then refines one part of this description, specifying in greater detail what that part does.
While this method works well for small programs, its value for large programs is debatable.
The main challenge with FOD for large programs is understanding what the program does
overall. For example, determining the function of UNIX, an airline reservation system, or a
scheme interpreter is complex and context-dependent. This can lead to highly artificial
descriptions of reality in the design.
mathematica
Copy code
While (not finished)
Read an expression from the terminal;
Evaluate the expression;
Print the value;
This leads to a division of the interpreter into "read," "evaluate," and "print" modules.
However, each module needs to know about the different types of objects (integer, real, list,
etc.) that it manipulates. This tight coupling can lead to difficulties in maintenance and
extension.
While FOD does not require a top-down creation, it often results in a function-oriented
program structure. However, to delay decisions about the system's functionality, it may be
better to structure the program around the data it manipulates rather than the actions it takes.
Object-oriented design (OOD): is indeed a fundamental concept in software
development, aiming to model real-world entities as objects with attributes and behaviors.
Here's a breakdown of the key points you mentioned:
1. Object-Oriented Focus: OOD focuses on the data (objects) and their interactions,
rather than just the functions performed by the program.
2. Objects and Classes:
o Objects: Represent individual entities with a state (attributes) and behaviors.
o Classes: Group objects with similar characteristics, defining their structure
and behavior.
3. Messages: Objects communicate by passing messages, which contain the identity of
the target object and the requested operation.
4. Abstraction: Managing complexity by highlighting essential details and hiding
irrelevant ones. It allows for different levels of understanding (e.g., driving a car vs.
designing a car engine).
5. Inheritance: Allows new classes (subclasses) to inherit attributes and behaviors from
existing classes (superclasses), promoting code reuse and hierarchical organization.
6. Polymorphism: Objects can be treated as instances of their superclass, allowing for
more generic and flexible code.
7. Encapsulation: Also known as information hiding, it separates the external aspects of
an object from its internal implementation, protecting the object's state and
implementation details.
8. Hierarchy: Organizing classes into hierarchies based on similarities and differences,
enabling better organization and understanding of complex systems.
So ware risk management is a cri cal process in so ware development that aims to iden fy,
assess, and mi gate poten al risks that could impact the success of a project.
Software projects can be derailed by a variety of risks, which can be identified through
brainstorming or past project data. Managing these risks requires a combination of experience
and knowledge of current software engineering and management practices. Here are some
common risk factors identified by Capers Jones:
Risk Assessment
Risk Control
Risk Management Planning: Develop a plan outlining how risks will be managed,
including strategies for avoiding, mitigating, transferring, or accepting risks.
Risk Monitoring: Continuously monitor risks to ensure the effectiveness of the risk
management plan and identify any new risks.
Risk Resolution: Execute the risk management plan if a risk occurs, implementing
contingency plans or corrective actions to minimize its impact.
Coefficients
The coefficients for the basic COCOMO model are:
Additional Calculations
The basic COCOMO model provides a useful tool for estimating project cost and
development time quickly, once the size of the project is estimated. The estimator needs to
determine which mode (organic, semi-detached, or embedded) is most appropriate for the
project.