100% found this document useful (1 vote)
8 views13 pages

Unit 3

The document covers software construction and testing, emphasizing principles such as minimizing complexity, anticipating change, and constructing for verification. It also discusses object-oriented design principles, the importance of software testing, and introduces test-driven development (TDD) as a methodology for ensuring code quality. Various programming languages and testing techniques are outlined, highlighting their applications and significance in software development.

Uploaded by

lg netpoint
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
8 views13 pages

Unit 3

The document covers software construction and testing, emphasizing principles such as minimizing complexity, anticipating change, and constructing for verification. It also discusses object-oriented design principles, the importance of software testing, and introduces test-driven development (TDD) as a methodology for ensuring code quality. Various programming languages and testing techniques are outlined, highlighting their applications and significance in software development.

Uploaded by

lg netpoint
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

UNIT-III

SOFTWARE CONSTRUCTION & TESTING


❖ SOFTWARE CONSTRUCTION:
Software construction focuses on converting software design into a reliable and
maintainable working system. To achieve high-quality software, certain basic
principles must be followed during construction.
1. Minimizing Complexity
Minimizing complexity means keeping the software simple, clear, and easy to
understand. Complex code is difficult to read, test, and maintain. Simple logic
reduces errors and improves reliability. Techniquesused for complexity are
Modularprogramming, and Meaningful variable and function names
Example:
Breaking a large program into smaller functions like login(), validateUser(), and
displayMenu().
2. Anticipating Change
Software should be constructed in such a way that future changes can be easily
handled. Requirements often change after software delivery. Code should be
flexible and [Link] throughLoose coupling, Reusable components
and Proper documentation.
Example:
Designing a fee-payment module so that new payment methods can be added
later.
3. Constructing for Verification:
Constructing for verification means writing code that is easy to test and
[Link] becomes simpler when code is [Link] module
should be independently testable.
Example:
Testing a single function that calculates student grades before integrating it with
the full system.
4. Standards in Construction
Standards in construction refer to following established coding rules and
guidelines. It includes coding standards, naming conventions, and documentation
styles. Ensures uniformity across the project. Helps team members understand
each other’s code easily.
Example:
Following indentation rules, commenting code, and using standard naming
conventions.
Managing Software Construction:
Managing software construction refers to the process of planning, organizing,
monitoring, and controlling coding-related activities to ensure that software is
developed on time, within budget, and with good quality.
[Link]
Dividing the software into modules, assigning tasks, and scheduling coding and
testing activities.
Example:
Planning separate timelines for coding, testing, and integration.
[Link] Management
Managing different versions of source code and controlling changes to avoid
conflicts and code loss.
Example:
Maintaining different versions of a program using version control.
[Link] Assurance
Ensuring coding standards are followed through code reviews, testing, and defect
detection.
Example:
Reviewing code before integration to ensure correctness.
[Link] Measurement
Monitoring construction progress using metrics such as defects found, time taken,
and code completion.
5. Communication and Coordination
Maintaining a proper communication with developers and testers, to ensure
smooth integration.
❖ object oriented design principles:
Object-oriented design (OOD) principles are guidelines used to create software
that is modular, maintainable, and scalable. Objects are self-contained units of
code that have both data and behaviour. They can interact with each other to
perform tasks.
Need for Object-Oriented Design (OOD) Principles:
1. Modularity – Divides software into independent objects, making the
system well organized.
2. Maintainability – Easier to modify and fix errors without affecting the
entire system.
3. Reusability – Classes and objects can be reused, reducing development
time and cost.
4. Scalability – New features can be added easily without major changes to
existing code.
5. Flexibility & Reliability – Abstraction and encapsulation reduce
dependency and errors.
The Four Pillars of OOP and the SOLID principles:
These are the foundational concepts of OOP:
1. Encapsulation

✓ Bundles data (attributes) and behavior (methods) into a single unit (class)
✓ Restricts direct access to internal state using access modifiers. Improves
security and maintainability. Example- Private Variables accessed via
public getters/setters.

Advantages:

• Improves data security.


• Makes code easier to maintain.
• Reduces unintended interference.

Disadvantages:
• Can increase code complexity.
• Improper use may lead to excessive getters/setters

2. Abstraction

✓ Hides complex implementation details and exposes only what is necessary.


Focuses on what an object does, not how it does it.
✓ Often achieved using interfaces or abstract classes.

Advantages:

• Reduces system complexity.


• Improves code readability.
• Makes systems easier to modify.

Disadvantages:

• May hide important details during debugging.


• Requires careful design.

3. Inheritance

✓ Allows a class to inherit properties and behavior from another class.


✓ Promotes code reuse and logical hierarchy. It can lead to tight coupling if
overused.

Advantages:

• Promotes code reuse.


• Reduces duplication.
• Supports hierarchical structure.

Disadvantages:

• Tight coupling between parent and child classes.


• Changes in base class can affect subclasses.

4. Polymorphism

✓ Allows objects to be treated as instances of their parent type.


✓ Enables method overriding and dynamic behavior at runtime.
✓ Supports flexibility and extensibility.

Advantages:

• Improves flexibility.
• Supports dynamic behavior.
• Simplifies code extension.

Disadvantages:

• Can be difficult to understand.


• Debugging becomes more complex.

❖ Object-Oriented Programming Languages

Object-Oriented Programming (OOP) is a programming paradigm based on


the concept of objects, which contain data and methods. OOP languages support
features such as encapsulation, abstraction, inheritance, and polymorphism,
helping to build modular and reusable software systems.

1. Java

Java is a fully object-oriented language widely used for enterprise applications,


web applications, and Android development. It is platform-independent due to
the Java Virtual Machine (JVM).

Example:

Use: Enterprise applications, Android apps, web applications

Real-Time Example: A banking system where classes like Account and


Customer represent real-world entities, and methods like deposit() or
withdraw() perform operations.

2. C++

C++ is an extension of the C language that supports object-oriented


programming. It provides features such as classes, inheritance, and
polymorphism and is used in system software and game development.

Use: System software, game development, performance-critical applications


Real-Time Example: A gaming system where Player and Enemy are objects,
inheriting properties from a common Character class.

3. Python

Python is a high-level, object-oriented language known for its simplicity and


readability. It supports dynamic typing and is widely used in web development,
data science, and artificial intelligence.

Use: Web development, AI, data science

Real-Time Example: E-commerce platforms where Product, Cart, and User


are classes, enabling abstraction and easy data handling.

4. C#

C# is a modern object-oriented language developed by Microsoft. It is mainly


used for developing Windows applications, web services, and games using the
.NET framework.

Use: Windows applications, web services, game development with Unity

Real-Time Example: Library management system where Book, Member,


and Librarian are classes with methods to borrow, return, and track books.

5. Ruby

Ruby is a pure object-oriented language where everything is treated as an object.


It is popular for web development due to its simplicity and productivity.

Use: Web development (Ruby on Rails)

Real-Time Example: Online shopping app where Customer and Order classes
handle interactions like order placement and payment.

6. JavaScript

JavaScript supports object-oriented programming through classes and


prototypes. It is mainly used to create interactive and dynamic web applications.

Use: Interactive web applications


Real-Time Example: Social media platforms where Post, User, and Comment
classes manage content, likes, and shares.

7. PHP

PHP is a server-side scripting language that supports object-oriented features


such as classes and objects. It is commonly used in web application
development.

Use: Server-side web development

Real-Time Example: Blog websites where Post, Category, and User are
objects, supporting dynamic content creation and user interaction.

8. Swift

Swift is an object-oriented language developed by Apple for iOS and macOS


application development. It focuses on performance, safety, and modern
programming concepts.

Use: iOS and macOS applications

Real-Time Example: Mobile health app where Patient and Appointment


classes help manages health records and schedules.

9. Kotlin

Kotlin is a modern object-oriented language that runs on the JVM. It is officially


supported by Google for Android application development.

Use: Android applications

Real-Time Example: Ride-sharing apps like Uber where Driver and


Passenger classes interact for booking, payment, and tracking rides.

❖ Software Testing basics


✓ Software testing is an important process in the Software Development
Lifecycle (SDLC). It involves verifying and validating that a Software
✓ Application is free of bugs, meets the technical requirements set by
its Design and Development, and satisfies user requirements efficiently
and effectively

Software testing can be divided into two steps:

1. Verification: This step involves checking if the software is doing what is


supposed to do. Its like asking, "Are we building the product the right
way?"

2. Validation: This step verifies that the software actually meets the
customer's needs and requirements. Its like asking, "Are we building the
right product?"
1. Manual Testing

Manual Testing is a technique to test the software that is carried out using the
functions and features of an application. Which means manual testing will check
the defect manually with trying one by one function is working as expected.

2. Automation Testing

It is a technique where the Tester writes scripts independently and uses suitable
Software or Automation Tools to test the software. It is an Automation Process
of a Manual Process. It allows for executing repetitive tasks without the use of a
Manual Tester.

Types of Manual Testing

Manual testing will be divided into further types which is following:

1. White Box Testing

White Box Testing is a software testing technique that involves testing the
internal structure and workings of a software application. The tester has access to
the source code and uses this knowledge to design test cases that can verify the
correctness of the software at the code level.

2. Black Box Testing

Black-Box Testing is a type of software testing in which the tester is not


concerned with the internal knowledge or implementation details of the software
but rather focuses on validating the functionality based on the provided
specifications or requirements.

3. Gray Box Testing

Gray Box Testing is a software testing technique that is a combination of


the Black Box Testing technique and the White Box Testing technique. In the
Black Box Testing technique, the tester is unaware of the internal structure of the
item being tested and in White Box Testing the internal structure is known to the
tester.

Types of Black Box Testing


Black Box Testing will be divided into further types which are following:

1. Functional Testing

Functional Testing is a type of Software Testing in which the system is tested


against the functional requirements and specifications.

2. Non-Functional Testing

Non-Functional Testing is a type of Software Testing that is performed to verify


the non-functional requirements of the application. It verifies whether the
behavior of the system is as per the requirement or not.

Types of Functional Testing

Functional Testing will be divided into further types which is following:

1. Unit Testing

Unit Testing is a method of testing individual units or components of a software


application. It is typically done by developers and is used to ensure that the
individual units of the software are working as intended.

2. Integration Testing

Integration Testing is a method of testing how different units or components of


a software application interact with each other. It is used to identify and resolve
any issues that may arise when different units of the software are combined.

3. System Testing

System Testing is a type of software testing that evaluates the overall


functionality and performance of a complete and fully integrated software
solution. It tests if the system meets the specified requirements and if it is suitable
for delivery to the end-users.

Types of Non-functional Testing

Here are the Types of Non-Functional Testing

1. Performance Testing
Performance Testing is a type of software testing that ensures software
applications perform properly under their expected workload. It is a testing
technique carried out to determine system performance in terms of sensitivity,
reactivity, and stability under a particular workload.

2. Usability Testing

Usability Testing in software testing is a type of testing, that is done from an


end user’s perspective to determine if the system is easily usable. Usability testing
is generally the practice of testing how easy a design is to use on a group of
representative users.

3. Compatibility Testing

Compatibility Testing is software testing that comes under the non functional
testing category, and it is performed on an application to check its compatibility
(running capability) on different platforms/environments. This testing is done
only when the application becomes stable.

Importance of Software Testing:

✓ Ensures Quality and Reliability: Testing verifies that the software works
correctly and meets user requirements.
✓ Detects and Fixes Bugs Early: Identifying defects early reduces
development costs and prevents failures.
✓ Improves User Satisfaction: Bug-free software offers a better user
experience and builds trust.
✓ Reduces Maintenance Costs: Fewer post-release issues lower the cost and
effort of software maintenance.

❖ Test-Driven Development (TDD):

Test-driven development (TDD) is a software development method in which tests


are written before the code. It validates that the code meets defined requirements,
keeps the code-base correct and modular, and supports safe, incremental changes
throughout development.

The process follows a repetitive cycle known as Red-Green-Refactor.


1. Red Phase: First, a developer writes a test that defines a desired feature or
behavior (the “Red” phase, as the test will fail initially).
2. Green Phase: Then, they write the minimum code necessary to pass the
test (the “Green” phase).
3. Refactor: Finally, the code is refactoring for optimization while ensuring
the test still passes.

Three Phases of Test Driven Development

Test-driven development includes creating precise tests, correcting the code, and
refactoring the code. Below is a detailed explanation of the three phases of TDD.

1. Create precise tests: Developers need to create exact unit tests to verify
the functionality of specific features. They must ensure that the test
compiles so that it can execute. In most cases, the test is bound to fail. This
is a meaningful failure as developers create compact tests based on their
assumptions of how the feature will behave.
2. Correcting the Code: Once a test fails, developers must make the minimal
changes required to update the code to run successfully when re-executed.
3. Refactor the Code: Once the test runs successfully, check for redundancy
or any possible code optimizations to enhance overall performance. Ensure
that refactoring does not affect the external behavior of the program.

The image below represents a high-level TDD approach toward development:


Examples

Here are some of the examples where TDD is used:

1. Calculator Function: When building a calculator function, a TDD


approach would involve writing a test case for the “add” function and then
writing the code for the process to pass that test. Once the “add” function
is working correctly, additional test cases would be written for other
functions such as “subtract”, “multiply” and “divide”.
2. E-commerce Website: When building an e-commerce website, a TDD
approach would involve writing test cases for various features such as
product listings, shopping cart functionality, and checkout process. Tests
would be written to ensure the system works correctly at each process
stage, from adding items to the cart to completing the purchase.

You might also like