Module4 - Software Engineering
Module4 - Software Engineering
Software Engineering
Software Engineering: The Software Engineering Discipline, The Software Life Cycle, Software
Engineering Methodologies, Modularity, Tools of the Trade.
2. Software Design
Planning the structure and architecture of the software.
Includes
Database design
Interface design
System architecture
3. Coding (Implementation)
Writing program code using programming languages.
Examples
C
Java
Python
4. Testing
Checking software for errors and bugs.
Types
Unit testing
Integration testing
System testing
5. Deployment
Installing software for users.
6. Maintenance
Updating and improving software after deployment.
Includes
Bug fixing
Performance improvement
Security updates
Describe the Software Development Life Cycle (SDLC)
Software engineering follows a structured process called SDLC.
Phases of SDLC
1. Requirement Analysis
2. System Design
3. Coding
4. Testing
5. Deployment
6. Maintenance
Q) Why would the number of lines in a program not be a good measure of the
complexity of the program?
The number of lines in a program is not a reliable measure of program complexity because
complexity depends on the logic, structure, and difficulty of the operations performed. A short
program can be highly complex, while a long program may be simple and easy to understand.
Therefore, software complexity should be evaluated using logical and structural factors rather
than line count alone.
The number of lines in a program is not always a good indicator of its complexity because
complexity depends on the logic, structure, and functionality of the program, not just its length.
Q) Suggest a metric for measuring software quality. What weaknesses do your metric
have?
Q) What technique can be used to determine how many errors are in a unit of software?
A common technique used to determine how many errors are in a unit of software is Software
Testing, especially Unit Testing.
In unit testing, individual modules or units of a program are tested separately to identify errors or
bugs.
Another technique is Error Seeding, where known artificial errors are intentionally inserted into
the software. By checking how many seeded errors are found during testing, developers can
estimate the total number of remaining errors in the software
Identify two contexts in which the field of software engineering has been
or currently is progressing toward improvements.
Two contexts in which software engineering has progressed toward improvements are:
1. Software Development Methods
Modern methodologies such as Agile and DevOps have improved software development
by increasing speed, flexibility, collaboration, and software quality.
2. Software Quality and Testing
Advanced testing techniques, automation tools, and quality assurance practices have
improved software reliability, security, and error detection.
Q) How does the development stage of the software life cycle affect the
maintenance stage?
The development stage of the Software Life Cycle greatly affects the maintenance stage because
well-designed and properly documented software is easier to maintain.
Good coding practices and proper testing reduce future errors.
Clear documentation helps developers understand and modify the software easily.
Poor development leads to more bugs, higher maintenance cost, and difficulty in updating
the software.
Thus, better development results in easier and more efficient maintenance.
Q) explain the Four Stages of the Development Phase in Software Life Cycle
1. Requirements Analysis
In this stage, the needs and expectations of users are identified and analyzed. The system
requirements are clearly defined.
2. Design
The overall structure and architecture of the software are planned. This includes database design,
user interface design, and system flow.
3. Implementation
The actual coding of the software is done using programming languages. The designed system is
converted into a working program.
4. Testing
The software is tested to identify and remove errors or bugs. This ensures the software works
correctly and meets user requirements.
What is the role of a software requirements specification?
A Software Requirements Specification (SRS) is a document that clearly describes the
functional and non-functional requirements of a software system.
Role of SRS
Defines user needs and system requirements
Acts as a guide for developers, designers, and testers
Helps in planning and designing the software
Reduces misunderstandings between users and developers
Serves as a reference during testing and maintenance
Ensures the software meets customer expectations
Thus, the SRS acts as the foundation for successful software development.
1. Waterfall Model
Traditional linear model
Each phase must finish before the next starts
Simple but rigid
Advantage
Easy to understand and manage
Disadvantage
Difficult to make changes later
2. Incremental Model
Software is developed in smaller functional parts
Each increment adds new features
Advantage
Early delivery of working software
Disadvantage
Integration may become complex
3. Iterative Model
Software is developed through repeated cycles
Each version improves the previous one
Advantage
Continuous improvement
What is the distinction between traditional evolutionary prototyping and
open-source development?
Traditional evolutionary prototyping and open-source development differ mainly in their
development approach and participation.
Evolutionary Prototyping:
A prototype is developed, tested, and continuously refined based on user feedback until
the final software is produced. Development is usually controlled by a specific
organization or development team.
Open-Source Development:
Software source code is publicly available, and developers from different locations
collaboratively improve and modify the software. Contributions
What potential problems do you suspect could arise in terms of ownership rights of software
developed via the open-source methodology?
Potential problems related to ownership rights in open-source software development include:
Unclear ownership: Many developers contribute, making it difficult to determine who
owns the final software.
Licensing conflicts: Different open-source licenses may create legal issues regarding
modification and distribution.
Unauthorized use of code: Contributors may include copyrighted code without
permission.
Patent issues: Some software features may violate patents owned by others.
Commercial usage disputes: Companies may use open-source software commercially
without clearly sharing profits or contributions.
These issues can create legal and management challenges in open-source development.
Identify three development paradigms that represent the move away from strict adherence to the
waterfall model.
Three development paradigms that moved away from strict adherence to the Waterfall
Model are:
1. Incremental Development Model
Software is developed and delivered in smaller functional parts called increments.
2. Iterative Development Model
Software is improved repeatedly through multiple development cycles or iterations.
3. Evolutionary Prototyping Model
A prototype is continuously refined based on user feedback until the final system is
developed.
Modularity is the process of dividing a large software system into smaller, independent parts
called modules.
Each module performs a specific function and can be developed, tested, and maintained
separately.
Divides complex systems into manageable parts
Each module has a specific task
Modules interact through well-defined interfaces
Improves readability and organization
Advantages of Modularity
Easier program development
Simplifies debugging and testing
Improves maintenance
Encourages code reuse
Reduces complexity
Supports teamwork
Modular Implementation
Modular implementation is the process of developing software by implementing each module
separately and then integrating them into a complete system.
the structure chart shown in Figure 7.3, in which functions are represented by rectangles and
function dependencies (implemented by function calls) are represented by arrows. In particular,
the chart indicates that the entire game is overseen by a function named ControlGame, and to
perform its task, ControlGame calls on the services of the functions Serve, Return, ComputePath,
and UpdateScore.
the chart indicates that the entire game is overseen by a function named ControlGame, and to
perform its task,
ControlGame calls on the services of the functions Serve, Return, ComputePath,
and UpdateScore.
Let us now reconsider the program’s design—this time in the context of the
object-oriented paradigm. Our first thought might be that there are two players
that we should represent by two objects: PlayerA and PlayerB. These objects
will have the same functionality but different characteristics. (Both should be
able to serve and return volleys but may do so with different skill and strength.)
Thus, these objects will be instances of the same class. (Recall that in Chapter 6
we introduced the concept of a class: a template that defines the functions (called
methods) and attributes (called instance variables) that are to be associated with
each object.) This class, which we will call PlayerClass, will contain the methods
serve and return that simulate the corresponding actions of the player. It
will also contain attributes (such as skill and endurance) whose values reflect
the player’s characteristics. Our design so far is represented by the diagram in
Figure 7.4. There we see that PlayerA and PlayerB are instances of the class
PlayerClass and that this class contains the attributes skill and endurance as
well as the methods serve and returnVolley. (Note that in Figure 7.4 we have
underlined the names of objects to distinguish them from names of classes.)
Next we need an object to play the role of the official who determines whether
the actions performed by the players are legal. For example, did the serve clear
the net and land in the appropriate area of the court? For this purpose we might
establish an object called Judge that contains the methods evaluateServe and
evaluateReturn. If the Judge object determines a serve or return to be acceptable,
play continues. Otherwise, the Judge sends a message to another object
named Score to record the results accordingly.
Advantages
Easy maintenance
Better module independence
Reduced side effects
Control Coupling
Control Coupling occurs when one module controls the behavior of another module by passing
control information or flags.
Example
A module sends a flag value to decide what operation another module should perform.
ProcessData(data, flag)
If:
flag = 1 → Print data
flag = 2 → Save data
Here, one module controls another module’s actions.
Disadvantages
Increases dependency between modules
Makes maintenance difficult
Reduces modularity
A module should:
Hide its internal working
Expose only required operations or interfaces
Other modules should not directly access internal data.
Information Hiding in Programming
It is commonly implemented using:
Private variables
Access modifiers
Functions and methods
Information hiding supports modularity because each module works independently without
exposing internal details.
Q) Explain Cohesion, Types of Cohesions, Difference between Logical and Functional
Cohesion and discuss their advantages and disadvantages.
Cohesion measures how strongly related the functions inside a module are. High cohesion
improves software quality, maintainability, and reliability, making it an important concept in
software engineering.
Cohesion refers to the degree to which the elements within a module work together to perform a
single task.
It measures the strength of relationship among components inside a module.
High Cohesion → Good software design
Low Cohesion → Poor software design
A module that performs only student record management has high cohesion because all functions
are related to one task.
Types of Cohesion
1. Coincidental Cohesion
Unrelated tasks are grouped together.
2. Logical Cohesion
Related tasks are grouped logically.
Input/output functions in one module.
3. Temporal Cohesion
Tasks executed at the same time are grouped together.
4. Procedural Cohesion
Elements are grouped because they follow a sequence of steps.
5. Communicational Cohesion
Elements operate on the same data.
6. Sequential Cohesion
Output of one part becomes input to another part.
7. Functional Cohesion
All elements work together to perform one specific function.
Cohesion vs Coupling
Cohesion Coupling
Relationship within a module Relationship between modules
High cohesion is desirable Low coupling is desirable
Disadvantage
Functions may not be strongly related
Maintenance becomes difficult
The goal of maximizing cohesion compatible with minimizing coupling. That is, as cohesion
increases, does coupling naturally tend to decrease?
Yes, the goal of maximizing cohesion is generally compatible with minimizing coupling.
High cohesion means a module focuses on a single well-defined task.
Low coupling means modules have fewer dependencies on each other.
As cohesion increases, modules become more independent and self-contained, which naturally
tends to reduce coupling between modules.
Therefore:
Good software design aims for high cohesion and low coupling.
These two concepts usually support each other and improve maintainability, reliability,
and modularity of software systems.
Define coupling, cohesion, and information hiding
Coupling
Coupling is the degree of dependency between two modules in a software system. Low
coupling is preferred because modules become more independent.
Cohesion
Cohesion is the degree to which the elements within a module work together to perform a
single task. High cohesion is considered good software design.
Information Hiding
Information hiding is the practice of hiding the internal details of a module and exposing
only the necessary information through interfaces. It improves security and modularity.
A traditional programmer develops software by writing most of the program code from
scratch using programming languages.
Difference
Traditional Programmer Component Assembler
Writes code manually Reuses existing components
Develops entire programs Integrates ready-made modules
More coding effort Less coding effort
Time-consuming Faster development
Component assembly improves software reuse and reduces development time.
Q) Explain Unified Modeling Language (UML) for a simple use case diagram.
Dataflow diagrams and data dictionaries were tools in the software engineering
arsenal well before the emergence of the object-oriented paradigm and have
continued to find useful roles even though the imperative paradigm, for which
they were originally developed, has faded in popularity. We turn now to the more
modern collection of tools known as Unified Modeling Language (UML) that
has been developed with the object-oriented paradigm in mind. The first tool that
we consider within this collection, however, is useful regardless of the underlying
paradigm because it attempts merely to capture the image of the proposed system
from the user’s point of view. This tool is the use case diagram—an example of
which appears in Figure 7.9.
A simple use case diagram
Q) Explain one –to –one, one to many and many to many relation between the entitie of
types X & Y with diagram
Figure 7.10 indicates that each patient can occupy one room and each room can host zero or one
patient. (We are assuming that each room is a private room.) An asterisk is used to indicate an
arbitrary nonnegative number. Thus, the asterisk in Figure
7.10 indicates that each physician may care for many patients, whereas the
1 at the physician end of the association means that each patient is cared for by
only one physician.
A one-to-one
relationship is exemplified by the association between patients and occupied
private rooms in that each patient is associated with only one room and each
room is associated with only one patient. A one-to-many relationship is exemplified
by the association between physicians and patients in that one physician is
associated with many patients and each patient is associated with one (primary)
physician. A many-to-many relationship would occur if we included consulting
physicians in the physician–patient relationship. Then each physician could be
associated with many patients and each patient could be associated with many
physicians.
One-to-one, one-to-many, and many-to-many relationships between entities of
types X and Y
1. Draw a dataflow diagram representing the flow of data that occurs when
a patron checks a book out of a library.
2. Draw a use case diagram of a library records system.
3. Draw a class diagram representing the relationship between travelers and
the hotels in which they stay.
4. Draw a class diagram representing the fact that a person is a generalization
of an employee. Include some attributes that might belong to each.
5. Convert Figure 7.5 into a complete sequence diagram.
6. What role in the software engineering process do design patterns play?