Software Engineering Notes
Software Engineering Notes
EnginEEring
Design Objectives
In software engineering, design objectives refer to the
essential goals and standards a design should meet to ensure
high-quality, efficient, and maintainable software. Some
primary design objectives include:
1. Correctness: The design should meet all specified
requirements, addressing both functional and non-
functional needs.
2. Efficiency: Software should utilize resources effectively,
including CPU, memory, and storage.
3. Maintainability: The design should allow for easy
updates, bug fixes, and adaptability to future
requirements.
4. Usability: The end user should find the software
intuitive and easy to use.
5. Reusability: Components of the software should be
reusable in other systems, reducing duplication of effort.
6. Scalability: The design should allow the software to
grow or adapt as the user base or load increases.
7. Reliability: The software should consistently perform as
expected without frequent crashes or errors.
8. Security: The design should protect the software from
unauthorized access and vulnerabilities.
Design Principles
Design principles are guidelines for achieving design
objectives and ensuring a well-structured software
architecture. Some of the main design principles include:
1. Abstraction: Simplifying complex systems by breaking
them down into simpler, high-level concepts without
delving into implementation details. Abstraction allows
designers to focus on essential functions without getting
distracted by low-level code specifics.
2. Modularity: Dividing a system into smaller parts, or
modules, that are easier to develop, understand, and
maintain. Each module should perform a specific task or
set of related tasks.
3. Encapsulation: Hiding the internal workings of a module
from other parts of the system. This principle improves
security and ensures that modules interact only through
defined interfaces.
4. Hierarchy: Organizing modules in a layered structure
where higher-level modules depend on lower-level
modules but are kept independent as much as possible.
5. Separation of Concerns: Dividing the system into distinct
sections, each addressing a specific concern or feature,
to prevent overlap and ensure clarity.
6. Single Responsibility Principle: Each module or
component should only have one reason to change, i.e.,
it should be responsible for a single part of the
functionality.
7. Open/Closed Principle: Software entities (classes,
modules, functions) should be open for extension but
closed for modification, meaning that you can add new
functionality without changing existing code.
8. DRY (Don't Repeat Yourself): Avoid duplicating code, as
redundancy increases the risk of errors and makes the
software harder to maintain.
9. KISS (Keep It Simple, Stupid): Designs should remain as
simple as possible, avoiding unnecessary complexity to
improve readability and maintainability.
1. Programming Practices
Programming practices are guidelines and methodologies
that developers follow to write efficient, readable,
maintainable, and bug-free code. Good practices help
improve code quality, make code easier to understand, and
allow teams to work more effectively.
Key Programming Practices
1. Code Readability:
o Ensuring that code is easy to read and understand
is crucial for maintenance and collaboration.
o Use meaningful variable names, consistent
indentation, and clear formatting.
o Avoid overly complex or nested code structures.
2. Consistent Code Style:
o Establishing a consistent coding style within a team
helps maintain a uniform look across the project,
making it easier for multiple developers to work on
the same codebase.
o This includes using a style guide, agreeing on
naming conventions, and consistent use of
indentation and spacing.
3. Documentation and Comments:
o Adding comments to explain complex code or logic
helps other developers understand the purpose
and functionality of each part of the code.
o Documenting each function, class, and module
allows future developers or maintainers to
understand the project better.
4. Modular Code Structure:
o Code should be broken down into small,
independent, and reusable modules, functions, or
classes.
o Modular code is easier to test, debug, and update.
This aligns with the principles of functional
independence and high cohesion in software
design.
5. Error Handling:
o Writing code that can handle errors and exceptions
gracefully prevents unexpected crashes.
o Using try-catch blocks, validation checks, and
fallback mechanisms improves the robustness of
the application.
6. Version Control:
o Version control systems like Git allow developers to
track code changes, collaborate, and maintain
different versions of the project.
o Version control also allows developers to roll back
to previous versions if issues arise in new code.
2. Verification
Verification is the process of ensuring that the software
meets its requirements and that it functions as intended.
Verification involves reviewing code, testing functionality, and
evaluating software quality.
Key Verification Techniques
1. Code Review:
o A code review involves other developers checking
the written code for mistakes, inconsistencies, and
improvements.
o Code reviews ensure adherence to coding
standards, help catch errors, and provide valuable
feedback to the original developer.
2. Unit Testing:
o Unit testing involves testing individual components
or functions in isolation to ensure they perform as
expected.
o Automated unit tests are commonly used, making it
easier to check code after each change.
3. Integration Testing:
o Integration testing verifies that different modules
or components work together correctly.
o This process ensures that all parts of the software
communicate and interact as intended.
4. System Testing:
o System testing examines the entire system as a
whole to check for compliance with requirements.
o This stage ensures that the software behaves as
expected across all features and functions.
5. Acceptance Testing:
o Acceptance testing is conducted to determine if the
system meets business requirements and is ready
for deployment.
o Often conducted by end-users or clients, this test
checks if the software performs in a real-world
environment.
6. Static Analysis:
o Static analysis involves checking the code for errors,
bugs, and security vulnerabilities without actually
executing it.
o This can be done using tools that analyze code
patterns, ensuring it adheres to best practices and
standards.
1. Testing Fundamentals
Testing is the process of evaluating a software product to
identify any discrepancies between the actual and expected
output. The primary goals of testing include validating
functionality, detecting and fixing bugs, ensuring usability,
and enhancing performance.
Key Types of Testing
1. Manual Testing:
o Conducted by a human without automation,
manual testing involves exploring the software,
interacting with features, and finding issues that
may be hard for automation to detect.
2. Automated Testing:
o Automated testing uses scripts and tools to run
tests, particularly useful for repetitive tasks,
regression tests, and large-scale testing processes.
3. Black-Box Testing:
o Focuses on testing the software's functionality
without knowledge of its internal workings. Testers
only know the input and expected output.
4. White-Box Testing:
o Involves testing the internal structures or workings
of an application. Testers examine paths, branches,
and statements within the code to check for logical
correctness.
3. Functional Testing
Functional testing focuses on verifying that each function of
the software operates in conformance with the requirements
specification. It ensures that software behaves as expected
under normal and edge conditions.
Types of Functional Testing
1. Smoke Testing:
o Performed to verify that the critical functionalities
of the application are working correctly. It acts as a
“build verification test.”
2. Sanity Testing:
o Conducted to check specific functionality after
changes or bug fixes. Sanity testing ensures the
changes work as intended.
3. Regression Testing:
o Ensures that new changes do not adversely affect
existing functionalities. Automated regression
testing is common in large projects.
4. User Acceptance Testing (UAT):
o The final phase of testing where actual users test
the software in real-world scenarios to validate it
meets their needs.
4. Structural Testing
Structural testing (or white-box testing) focuses on the code’s
internal structure, aiming to cover as much code as possible
and identify logic errors within the code itself.
Structural Testing Techniques
1. Statement Coverage:
o Ensures each statement in the code is executed at
least once.
2. Branch Coverage:
o Tests every possible branch (if-else conditions) to
verify both true and false outcomes.
3. Path Coverage:
o Covers all possible paths from start to finish in the
code.
4. Data Flow Testing:
o Analyzes the flow of data within the code,
identifying issues with variable usage.
5. Test Plan
A test plan is a document detailing the scope, approach,
resources, and schedule of intended testing activities. It
outlines objectives, test criteria, deliverables, and
responsibilities.
Key Components of a Test Plan
1. Test Objectives:
o Defines the purpose of testing and what it aims to
accomplish.
2. Scope:
o Specifies what will and will not be tested.
3. Test Schedule:
o A timeline of testing activities, including start and
end dates, milestones, and deadlines.
4. Resources and Responsibilities:
o Identifies who will be responsible for each testing
activity and what resources (tools, environments)
are required.
5. Test Criteria:
o Entry Criteria: Conditions that must be met before
testing can begin.
o Exit Criteria: Conditions that must be met before
testing is considered complete.
6. Deliverables:
o List of documents, test cases, and reports to be
produced during and after testing.
6. Activities During Testing
Testing activities ensure a structured and systematic
approach to software testing, covering the entire process
from preparation to completion.
Major Testing Activities
1. Requirement Analysis:
o Understanding the requirements and preparing test
cases aligned with those requirements.
2. Test Case Development:
o Designing test cases and preparing test data based
on requirements.
3. Environment Setup:
o Preparing the hardware and software environments
where tests will be executed.
4. Test Execution:
o Running test cases, logging results, and reporting
any failures or issues.
5. Defect Tracking and Reporting:
o Logging defects in an issue-tracking system,
categorizing them by severity, and assigning them
for fixing.
6. Test Closure:
o Summarizing the testing activities, preparing
reports, and analyzing lessons learned for future
improvements.
7. Unit Testing
Unit testing is the process of testing individual components
of a software application in isolation to ensure each part
works correctly. Typically, unit tests are written by developers
and focus on specific functions or methods.
Unit Testing Importance
• Catches bugs early in development.
• Ensures each part functions independently.
• Simplifies debugging by isolating errors to specific units.
9. Software Maintenance
Software maintenance is the process of updating, modifying,
and fixing software post-deployment. This ensures the
software continues to function as required over time.
Types of Software Maintenance
1. Corrective Maintenance:
o Fixes identified bugs and issues after deployment.
2. Adaptive Maintenance:
o Modifies software to accommodate changes in the
environment, like operating system updates.
3. Perfective Maintenance:
o Enhances performance, usability, or functionality in
response to user feedback or new requirements.
4. Preventive Maintenance:
o Addresses potential issues before they manifest,
improving software stability.
Software reliability