0% found this document useful (0 votes)
23 views40 pages

OOSD Unit-3

Uploaded by

junaid7835
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
0% found this document useful (0 votes)
23 views40 pages

OOSD Unit-3

Uploaded by

junaid7835
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
You are on page 1/ 40

object oriented design:

Object-Oriented Design (OOD) in Object-Oriented Software Development (OOSD) is the


process of planning a system of interacting objects to solve a software problem. It focuses on
defining the structure and behavior of the system based on real-world concepts and entities.
Here’s an overview of OOD in OOSD:

Key Concepts in Object-Oriented Design:

1. Objects:
○ Objects represent real-world entities or concepts. They have two main
components:
■ Attributes (data): The properties or state of an object.
■ Methods (behavior): The functions or operations that the object can
perform.
2. Classes:
○ A class is a blueprint for creating objects. It defines attributes and methods shared
by all instances (objects) of the class.
3. Encapsulation:
○ The design principle of encapsulation ensures that an object’s internal state is
hidden from the outside world. The data is protected using access modifiers (e.g.,
private, protected), exposing only necessary functionality through public methods.
4. Inheritance:
○ Inheritance allows for the creation of new classes based on existing ones. The new
class (subclass) inherits attributes and methods from the parent class (superclass),
which promotes code reuse and easier maintenance.
5. Polymorphism:
○ Polymorphism allows different classes to respond to the same method call in their
own way. This is achieved through method overriding and interfaces, enabling
more flexible and dynamic behavior.
6. Abstraction:
○ Abstraction focuses on defining essential features without getting into the details.
It simplifies complex systems by exposing only relevant details and hiding
unnecessary ones. In OOD, this is often done using abstract classes and interfaces.

Object-Oriented Design Process:

1. Problem Analysis:
○ Understand the problem domain and identify key concepts. Break down the
problem into objects that interact with each other.
2. Design Classes and Objects:
○ Define the classes and their relationships (e.g., which objects interact, how they
are related). This includes determining attributes, methods, and access control
(encapsulation).
3. Define Relationships:
○ Identify the relationships between objects, such as:
■ Association: Objects interact with each other.
■ Aggregation: One object is part of another (whole-part relationship).
■ Composition: A stronger form of aggregation where one object cannot
exist without the other.
■ Inheritance: One object (subclass) inherits properties and behaviors from
another (superclass).
4. Use of UML (Unified Modeling Language):
○ OOD often uses UML diagrams to represent the system’s structure and behavior.
Key UML diagrams include:
■ Class Diagram: Shows the classes, their attributes, methods, and
relationships.
■ Sequence Diagram: Illustrates how objects interact in a specific sequence.
■ Use Case Diagram: Defines the system’s functionality from the user's
perspective.
5. Design Patterns:
○ Design patterns are reusable solutions to common problems in OOD. Examples
include:
■ Singleton Pattern: Ensures only one instance of a class.
■ Factory Pattern: Provides an interface for creating objects without
specifying their concrete class.

Benefits of Object-Oriented Design:

● Modularity: System is broken into smaller, independent objects, making it easier to


develop and maintain.
● Reusability: Classes and objects can be reused across different parts of the system or in
other systems.
● Scalability: The system can be easily expanded with new objects or classes.
● Maintainability: Easier to modify or update specific parts of the system without affecting
the entire system.

combining three models :

Intention of object oriented modeling and design is to learn how to apply object -oriented
concepts to all the stages of the software development life cycle.Object-oriented modeling and
design is a way of thinking about problems using models organized around real world concepts.
The fundamental construct is the object, which combines both data structure and behavior.

Purpose of Models:

1. Testing a physical entity before building it


2. Communication with customers
3. Visualization
4. Reduction of complexity

Types of Models:
There are 3 types of models in the object oriented modeling and design are: Class Model, State
Model, and Interaction Model. These are explained as following below.

1. Class Model:
The class model shows all the classes present in the system. The class model shows
the attributes and the behavior associated with the objects.
The class diagram is used to show the class model.The class diagram shows the class
name followed by the attributes followed by the functions or the methods that are
associated with the object of the class.Goal in constructing class model is to capture
those concepts from the real world that are important to an application.
2. State Model:
State model describes those aspects of objects concerned with time and the
sequencing of operations – events that mark changes, states that define the context for
events, and the organization of events and states.Actions and events in a state diagram
become operations on objects in the class model. State diagram describes the state
model.
3. Interaction Model:
Interaction model is used to show the various interactions between objects, how the
objects collaborate to achieve the behavior of the system as a whole.
The following diagrams are used to show the interaction model:
● Use Case Diagram
● Sequence Diagram
● Activity Diagram

Designing Algorithm:

In Object-Oriented Software Development (OOSD), designing an algorithm follows a structured


approach to solve a problem by focusing on objects, their interactions, and behaviors. The design
of an algorithm involves representing the solution as a sequence of actions or steps, often using
objects and their methods. Here’s how algorithms are typically designed in OOSD:

Key Steps for Designing Algorithms in OOSD:

1. Understand the Problem:


○ Before designing an algorithm, you must fully understand the problem and its
requirements. This involves:
■ Analyzing the problem domain and identifying objects, classes, and
relationships.
■ Clarifying the input and output of the algorithm.
2. Identify the Objects and Their Interactions:
○ Identify the key objects (or classes) in the system that will interact to solve the
problem.
○ Define the attributes (data) and methods (functions) of these objects.
○ Design how objects will interact with one another to achieve the desired outcome.
3. Break the Problem into Smaller Subtasks (Decomposition):
○ Divide the problem into smaller, manageable subtasks or functions that can be
assigned to different objects.
○ Each object or method will perform a specific subtask, and the overall problem
will be solved by combining these subtasks.
4. Choose the Algorithmic Approach:
○ Decide on the appropriate algorithmic strategy (e.g., brute force, divide and
conquer, greedy, dynamic programming) based on the nature of the problem.
○ Identify the best data structures (e.g., arrays, linked lists, stacks, queues, trees) to
use for efficient data handling.
5. Define Object Responsibilities:
○ For each object involved, define its responsibilities clearly. This involves
identifying the methods that the object will provide and how they interact with
other objects.
○ Example: In a shopping cart system, a Cart object might have methods like
addItem(), removeItem(), calculateTotal().
6. Design the Sequence of Operations:
○ Plan how the objects will interact and collaborate. This includes:
■ How one object’s method will invoke another’s.
■ How data will flow between objects.
7. Use UML Diagrams:
○ Class Diagram: Shows the structure and relationships of classes.
○ Sequence Diagram: Illustrates how objects interact over time to carry out a
specific task.
○ Activity Diagram: Models the workflow and the steps in the algorithm.
8. Write Pseudocode or Flowchart:
○ Draft pseudocode or a flowchart to outline the steps of the algorithm, detailing
how the objects collaborate and how data is processed.

Example: Designing an Algorithm for a Simple Shopping Cart System

Let’s design an algorithm to calculate the total price of items in a shopping cart.

1. Understand the Problem:


○ Input: A list of items, each with a price and quantity.
○ Output: The total price of the cart, including any discounts or taxes.
2. Identify Objects:
○ Objects involved: Item, Cart, Discount, Tax.
3. Break the Problem into Smaller Tasks:
○ Task 1: Calculate the price of each item (price * quantity).
○ Task 2: Apply any discounts to the total.
○ Task 3: Add taxes to the total.
○ Task 4: Return the final total.
4. Choose the Algorithmic Approach:
○ We will use a linear pass to calculate the total, iterating over the list of items in
the cart.
5. Define Object Responsibilities:
○ Item: Stores item data (price, quantity) and provides a method getTotalPrice().
○ Cart: Contains a list of items and methods to calculate the total, apply discounts,
and calculate taxes.
○ Discount: Determines if a discount applies and what the amount is.
○ Tax: Calculates the applicable tax rate.
6. Design the Sequence of Operations:
○ Cart calls Item's getTotalPrice() for each item.
○ After summing the prices, Cart applies a Discount (if applicable).
○ Then Cart applies a Tax to the final price.
7. UML Diagrams:
○ Class Diagram: Represents Cart, Item, Discount, and Tax classes with methods
like calculateTotal(), getTotalPrice(), etc.
○ Sequence Diagram: Shows how the Cart object interacts with the Item, Discount,
and Tax objects.
8. Flowchart:
○ The flowchart would show the steps:
i. Start → Iterate over items → Calculate total for each item → Apply
discount → Apply tax → Return total.

Benefits of Object-Oriented Algorithm Design:

● Modularity: The algorithm is broken into smaller, reusable components (objects), making
it easier to modify, extend, or test.
● Maintainability: Changes to one part of the system (e.g., changing tax rate) are isolated in
the relevant class (Tax), reducing the impact on other parts of the system.
● Reusability: Methods like getTotalPrice() can be reused across different systems or
objects that need to calculate prices.

design optimization:

Design Optimization in OOSD refers to the process of improving the structure and performance
of a software system by making design decisions that enhance flexibility, maintainability,
scalability, and efficiency. In Object-Oriented Software Development (OOSD), optimization
focuses on making the design cleaner, more modular, and adaptable to change, while also
ensuring that the system performs efficiently.

Key Aspects of Design Optimization in OOSD:

1. Minimize Coupling and Maximize Cohesion:


○ Minimize coupling: Reduce dependencies between classes to make the system
more modular.
○ Maximize cohesion: Ensure that the methods and attributes within a class are
closely related to achieve better organization and readability.
2. Favor Composition Over Inheritance:
○ Use composition (objects containing other objects) rather than inheritance to
promote flexibility and avoid rigid class hierarchies.
3. Use Design Patterns:
○ Apply reusable solutions such as Factory, Singleton, Strategy, and Observer
patterns to solve common design challenges and improve maintainability.
4. Reduce Redundancy:
○ Eliminate duplicated code by refactoring common logic into reusable methods or
utility classes, following the DRY principle (Don’t Repeat Yourself).
5. Optimize for Performance:
○ Focus on performance optimization when necessary, identifying bottlenecks and
applying techniques like caching, memoization, or lazy loading.
6. Separation of Concerns (SoC):
○ Organize the system into distinct sections, each responsible for a specific
functionality, using design principles like MVC or layers to separate user
interface, business logic, and data access.
7. Design for Extensibility and Reusability:
○ Create an extensible system that allows for easy addition of new features by using
interfaces, abstract classes, and modular components.
8. Refactor for Maintainability:
○ Continuously refactor the codebase to improve readability, simplify logic, and
reduce complexity, making the system easier to maintain and modify.

By applying these principles, OOSD aims to produce efficient, maintainable, and scalable
software systems that can adapt to changing requirements and environments.

implementation of control
Implementation of Control in OOSD refers to the management of the flow of execution within a
software system using object-oriented principles. Control is crucial in determining how objects
interact, how methods are called, and how tasks are organized and executed in the system.

Key Aspects of Control Implementation in OOSD:

1. Method Invocation: Control flows through the invocation of methods on objects. Each
method represents an action that an object can perform, and control is transferred to these
methods when called.
○ Example: A Car object calls startEngine(), transferring control to the engine
startup process.
2. Object Interaction: Objects communicate by sending messages (method calls) to each
other, defining the flow of control across different parts of the system.
○ Example: A ShoppingCart interacts with Item objects to calculate the total price.
3. State Changes: The flow of control can depend on the state of an object. The behavior of
methods may vary based on the object's current state.
○ Example: A TrafficLight object changes its light color based on its state (RED,
GREEN, YELLOW).
4. Design Patterns: Patterns like the Command and Observer patterns control the flow of
execution by decoupling objects and allowing for more flexible handling of requests and
state changes.
○ Example: The Command Pattern allows requests to be encapsulated as objects
and executed at a later time, separating the request from the actual execution.
5. Event-Driven Programming: In systems like GUIs, control flows based on user actions
(like button clicks or key presses), which trigger event handlers to process these events.
○ Example: A button click triggers a onClick() method, controlling the subsequent
behavior.
6. Multi-threading: In concurrent systems, control is managed across multiple threads,
ensuring proper synchronization and coordination between tasks.
○ Example: A DownloadManager may use multiple threads to download files
concurrently.
adjustment of inheritance

Adjustment of Inheritance in Object-Oriented System Design (OOSD) refers to refining the use
of inheritance to ensure flexibility, maintainability, and scalability in a system. While inheritance
is a core principle of OOSD, improper or excessive use can lead to rigid and complex designs
that are difficult to modify or extend.

Key Points of Adjusting Inheritance:

1. Favor Composition Over Inheritance:


○ Composition (has-a relationship) provides greater flexibility compared to
inheritance (is-a relationship), reducing tight coupling between classes.
○ Instead of extending classes, consider combining objects with different behaviors
to create more modular systems.
2. Avoid Deep Inheritance Hierarchies:
○ Deep inheritance hierarchies can become hard to manage and understand. It's
advisable to use shallow hierarchies or interfaces to avoid unnecessary
complexity.
3. Use Interfaces or Abstract Classes:
○ Interfaces and abstract classes allow common behavior to be defined while
leaving the implementation to the subclasses. This provides flexibility without
imposing unnecessary implementation details on all subclasses.
4. Minimize Method Overriding:
○ Excessive overriding can make the system harder to maintain. Inheritance should
be used to share common behavior, and overriding should only occur when
absolutely necessary.
5. Follow the Liskov Substitution Principle:
○ Ensure that subclasses can be substituted for their base class without affecting the
system's correctness. Subclasses should not break the expected behavior of the
parent class.
6. Refactor When Necessary:
○ As the system evolves, inheritance structures may need to be refactored. This may
involve moving from inheritance to composition, or using design patterns like
Strategy or Adapter to decouple behaviors.

object representation

Object Representation in Object-Oriented System Design (OOSD) refers to how objects, which
are instances of classes, are modeled and organized within a software system. Each object
represents a real-world entity or concept, encapsulating both data (attributes) and behavior
(methods).

Key Aspects of Object Representation:

1. Encapsulation:
○ Encapsulation is the principle of bundling data and methods that operate on the
data into a single unit, the object. This hides the internal state of the object and
only exposes what is necessary through a defined interface (methods).
○ Example: A BankAccount object has private attributes like balance, and public
methods like deposit() and withdraw() to interact with the balance.
2. Attributes (Data Representation):
○ Objects represent entities with attributes (or properties) that hold data specific to
the object. These attributes can be simple (e.g., integers, strings) or complex (e.g.,
collections of other objects).
○ Example: A Person object might have attributes like name, age, and address.
3. Methods (Behavior Representation):
○ Objects also have methods that define their behavior, i.e., what actions the object
can perform or respond to. These methods manipulate the internal state and
interact with other objects.
○ Example: A Car object might have methods like startEngine(), stopEngine(), and
accelerate() to define its behavior.
4. Identity:
○ Every object has a unique identity, which distinguishes it from other objects. Even
if two objects have the same attribute values, they are still distinct entities in
memory.
○ Example: Two Car objects with the same make and model are still different
objects if they occupy different memory locations.
5. Inheritance:
○ Objects can inherit behavior and attributes from other classes, creating hierarchies
and allowing for shared functionality between similar objects. Subclasses extend
or modify the behavior of the parent class.
○ Example: A Dog class may inherit from a Mammal class, inheriting attributes like
legs and methods like breathe().
6. Polymorphism:
○ Objects of different classes can be treated as objects of a common superclass,
allowing methods to operate on objects of different types. This enables dynamic
method resolution at runtime.
○ Example: A Shape class can have subclasses like Circle and Rectangle. A method
that takes a Shape object can work with any subclass, allowing for flexible
handling of different shapes.
7. Abstraction:
○ Abstraction hides unnecessary complexity by exposing only relevant details to the
user. This allows objects to represent complex systems without overwhelming the
user with details.
○ Example: A Car object abstracts away the internal complexity of the engine,
transmission, and fuel system, presenting a simple interface like start() and stop().

physical packaging :

Physical Packaging in Object-Oriented System Design (OOSD) refers to the organization and
management of the physical deployment of objects, classes, and modules in the actual system
architecture. It involves structuring how the software components are stored, accessed, and
distributed in memory or across different devices, as well as ensuring efficient execution and
scalability.
Key Aspects of Physical Packaging in OOSD:

1. Class and Object Organization:


○ Objects and classes need to be organized within the system to ensure efficient
memory usage and execution. This can involve grouping related classes and
objects into packages, modules, or libraries.
○ Example: A Graphics package may contain all classes related to drawing shapes,
such as Circle, Rectangle, and Line.
2. Modularization:
○ Modularization is the process of dividing the software into discrete, manageable
units or modules. Each module represents a collection of related classes and
objects that encapsulate specific functionality, promoting reusability and
maintainability.
○ Example: A banking system might have separate modules for account
management, transaction processing, and user authentication.
3. Componentization:
○ In large systems, physical packaging often involves componentization, where the
system is broken down into independent, self-contained components or services.
These components can then be deployed, updated, or scaled independently.
○ Example: A microservices-based architecture where each service (e.g., user
service, payment service) is a separate component running independently.
4. Data and Object Persistence:
○ Objects must be stored persistently (e.g., in databases or files) when the system
needs to save state between executions. Packaging in this context also involves
deciding how to serialize and deserialize objects for persistence.
○ Example: Objects representing customer information may be stored in a database
as rows in a table, with each row representing an object instance.
5. Memory Management:
○ The physical packaging of objects also involves managing their allocation and
deallocation in memory. Object-oriented systems must handle dynamic memory
allocation, garbage collection, and object destruction to avoid memory leaks.
○ Example: Automatic garbage collection in languages like Java ensures that
objects that are no longer in use are properly cleaned up from memory.
6. Deployment and Distribution:
○ Once packaged into modules or components, objects and classes need to be
deployed across different environments (e.g., local machines, servers, cloud). This
involves organizing how components communicate and how dependencies are
managed.
○ Example: In distributed systems, objects might be packaged into services that are
deployed across multiple servers and accessed through APIs or message queues.
7. Version Control:
○ Effective version control is essential for managing changes to object classes and
modules. Packaging systems should include versioning mechanisms to track and
manage changes to ensure compatibility between components.
○ Example: A library or package manager can handle versioning, allowing
developers to specify which versions of components are required.

Physical packaging in OOSD focuses on how classes, objects, and modules are
organized, stored, and managed in memory or across systems. Proper packaging
ensures efficient resource use, scalability, maintainability, and the ability to
distribute and update the system effectively. Through modularization,
componentization, and careful memory and persistence management, physical

documenting design considerations:

Documenting Design Considerations in Object-Oriented System Design (OOSD) is a crucial step


in ensuring that the system’s architecture, decisions, and rationale are well understood,
maintainable, and adaptable over time. Proper documentation provides clarity on the design
choices, trade-offs, and guidelines followed throughout the development process. This is
essential for both current developers and future teams working on the system.

Key Aspects of Documenting Design Considerations:

1. Design Goals and Requirements:


○ The documentation should clearly outline the design objectives and
functional/non-functional requirements that the system aims to fulfill. This
includes performance, scalability, security, and usability goals.
○ Example: "The system must support 10,000 concurrent users with response times
under 2 seconds."
2. Class and Object Design:
○ Documenting the class structure, including class names, attributes, methods, and
their relationships (e.g., inheritance, association, aggregation). This includes the
rationale for choosing particular designs, such as which classes were created, their
responsibilities, and how they interact.
○ Example: "The Account class encapsulates the user's financial information and
provides methods for deposit and withdrawal."
3. Design Patterns Used:
○ When using common design patterns (e.g., Singleton, Factory, Observer), it is
important to document which patterns were applied and why, as well as how they
contribute to solving specific design challenges.
○ Example: "The Observer pattern was used to notify the user interface about state
changes in the data model."
4. Interfaces and Abstract Classes:
○ Document the role of interfaces or abstract classes in promoting flexibility,
abstraction, and polymorphism. This section should explain how the system
allows different implementations or extensions.
○ Example: "The Drawable interface ensures that any object representing a shape
can be drawn, regardless of whether it is a Circle or Rectangle."
5. Relationship Between Objects:
○ Clearly describe the relationships and interactions between objects. This includes
communication mechanisms (e.g., method calls, messages), associations,
dependencies, and the use of aggregation/composition.
○ Example: "A Customer object has a one-to-many relationship with Order objects,
where a customer can place multiple orders."
6. Data and State Management:
○ Document how objects manage their state and how state transitions occur. Include
details on data persistence, serialization, and data storage techniques, as well as
how objects maintain consistency across different states.
○ Example: "The Order class manages its state transitions (e.g., from Pending to
Shipped) using state-specific methods."
7. Error Handling and Exception Management:
○ Explain the approach to error handling within the system, including how
exceptions are used and handled across different layers of the system (e.g.,
business logic, UI).
○ Example: "The PaymentProcessor class throws a PaymentFailedException if the
transaction cannot be completed."
8. Performance and Efficiency Considerations:
○ Document any performance-related design choices, such as how objects are
managed in memory, caching strategies, or algorithms optimized for speed.
○ Example: "The CacheManager class uses an in-memory cache to speed up
frequently accessed data, reducing database load."
9. Security and Privacy Considerations:
○ Any security-related design decisions should be documented, including access
control, encryption, and other mechanisms to ensure data protection.
○ Example: "Sensitive user data is encrypted using AES encryption before being
stored in the database."
10. Testing and Validation:
○ Outline how the design supports testing, including unit testing, integration testing,
and any automated testing strategies.
○ Example: "Each class has a corresponding unit test to validate methods such as
calculateTotal() and applyDiscount()."
11. Future Maintenance and Extension:
○ Provide insights into how the design allows for future changes or extensions. This
includes ensuring the system is flexible to accommodate new features with
minimal changes to existing code.
○ Example: "The NotificationService is designed to be easily extended with new
delivery methods (email, SMS, push notifications) without changing existing
functionality."

Structured Analysis and Structured Design (SA/SD) is a diagrammatic notation that is


designed to help people understand the system. The basic goal of SA/SD is to improve quality
and reduce the risk of system failure. It establishes concrete management specifications and
documentation. It focuses on the solidity, pliability, and maintainability of the system.

Structured Analysis and Structured Design (SA/SD) is a software development method that was
popular in the 1970s and 1980s. The method is based on the principle of structured
programming, which emphasizes the importance of breaking down a software system into
smaller, more manageable components.

In SA/SD, the software development process is divided into two phases: Structured Analysis and
Structured Design. During the Structured Analysis phase, the problem to be solved is analyzed
and the requirements are gathered. The Structured Design phase involves designing the system to
meet the requirements that were gathered in the Structured Analysis phase.

Structured Analysis and Structured Design (SA/SD) is a traditional software development


methodology that was popular in the 1980s and 1990s. It involves a series of techniques for
designing and developing software systems in a structured and systematic way. Here are some
key concepts of SA/SD:

1. Functional Decomposition: SA/SD uses functional decomposition to break down a


complex system into smaller, more manageable subsystems. This technique involves
identifying the main functions of the system and breaking them down into smaller
functions that can be implemented independently.
2. Data Flow Diagrams (DFDs): SA/SD uses DFDs to model the flow of data through
the system. DFDs are graphical representations of the system that show how data
moves between the system’s various components.
3. Data Dictionary: A data dictionary is a central repository that contains descriptions of
all the data elements used in the system. It provides a clear and consistent definition
of data elements, making it easier to understand how the system works.
4. Structured Design: SA/SD uses structured design techniques to develop the system’s
architecture and components. It involves identifying the major components of the
system, designing the interfaces between them, and specifying the data structures and
algorithms that will be used to implement the system.
5. Modular Programming: SA/SD uses modular programming techniques to break down
the system’s code into smaller, more manageable modules. This makes it easier to
develop, test, and maintain the system.

Some advantages of SA/SD include its emphasis on structured design and documentation, which
can help improve the clarity and maintainability of the system. However, SA/SD has some
disadvantages, including its rigidity and inflexibility, which can make it difficult to adapt to
changing business requirements or technological trends. Additionally, SA/SD may not be
well-suited for complex, dynamic systems, which may require more agile development
methodologies.

The following are the steps involved in the SA/SD process:

1. Requirements gathering: The first step in the SA/SD process is to gather requirements
from stakeholders, including users, customers, and business partners.
2. Structured Analysis: During the Structured Analysis phase, the requirements are
analyzed to identify the major components of the system, the relationships between
those components, and the data flows within the system.
3. Data Modeling: During this phase, a data model is created to represent the data used
in the system and the relationships between data elements.
4. Process Modeling: During this phase, the processes within the system are modeled
using flowcharts and data flow diagrams.
5. Input/Output Design: During this phase, the inputs and outputs of the system are
designed, including the user interface and reports.
6. Structured Design: During the Structured Design phase, the system is designed to
meet the requirements gathered in the Structured Analysis phase. This may include
selecting appropriate hardware and software platforms, designing databases, and
defining data structures.
7. Implementation and Testing: Once the design is complete, the system is implemented
and tested.

SA/SD has been largely replaced by more modern software development methodologies, but its
principles of structured analysis and design continue to influence current software development
practices. The method is known for its focus on breaking down complex systems into smaller
components, which makes it easier to understand and manage the system as a whole.

Basically, the approach of SA/SD is based on the Data Flow Diagram. It is easy to understand
SA/SD but it focuses on well-defined system boundary whereas the JSD approach is too complex
and does not have any graphical representation.

SA/SD is combined known as SAD and it mainly focuses on the following 3 points:

1. System
2. Process
3. Technology

SA/SD involves 2 phases:

1. Analysis Phase: It uses Data Flow Diagram, Data Dictionary, State Transition
diagram and ER diagram.
2. Design Phase: It uses Structure Chart and Pseudo Code.

1. Analysis Phase:

Analysis Phase involves data flow diagram, data dictionary, state transition diagram, and
entity-relationship diagram.

1. Data Flow Diagram:


In the data flow diagram, the model describes how the data flows through the system.
We can incorporate the Boolean operators and & or link data flow when more than
one data flow may be input or output from a process.
For example, if we have to choose between two paths of a process we can add an
operator or and if two data flows are necessary for a process we can add an operator.
The input of the process “check-order” needs the credit information and order
information whereas the output of the process would be a cash-order or a
good-credit-order.

2. Data Dictionary:
The content that is not described in the DFD is described in the data dictionary. It
defines the data store and relevant meaning. A physical data dictionary for data
elements that flow between processes, between entities, and between processes and
entities may be included. This would also include descriptions of data elements that
flow external to the data stores.
A logical data dictionary may also be included for each such data element. All system
names, whether they are names of entities, types, relations, attributes, or services,
should be entered in the dictionary.

3. State Transition Diagram:


State transition diagram is similar to the dynamic model. It specifies how much time
the function will take to execute and data access triggered by events. It also describes
all of the states that an object can have, the events under which an object changes
state, the conditions that must be fulfilled before the transition will occur and the
activities were undertaken during the life of an object.

4. ER Diagram:
ER diagram specifies the relationship between data store. It is basically used in
database design. It basically describes the relationship between different entities.

2. Design Phase:

Design Phase involves structure chart and pseudocode.

1. Structure Chart:
It is created by the data flow diagram. Structure Chart specifies how DFS’s processes
are grouped into tasks and allocated to the CPU. The structured chart does not show
the working and internal structure of the processes or modules and does not show the
relationship between data or data flows. Similar to other SASD tools, it is time and
cost-independent and there is no error-checking technique associated with this tool.
The modules of a structured chart are arranged arbitrarily and any process from a
DFD can be chosen as the central transform depending on the analysts’ own
perception. The structured chart is difficult to amend, verify, maintain, and check for
completeness and consistency.
2. Pseudo Code: It is the actual implementation of the system. It is an informal way of
programming that doesn’t require any specific programming language or technology.

Advantages of Structured Analysis and Structured Design (SA/SD):

1. Clarity and Simplicity: The SA/SD method emphasizes breaking down complex
systems into smaller, more manageable components, which makes the system easier
to understand and manage.
2. Better Communication: The SA/SD method provides a common language and
framework for communicating the design of a system, which can improve
communication between stakeholders and help ensure that the system meets their
needs and expectations.
3. Improved maintainability: The SA/SD method provides a clear, organized structure
for a system, which can make it easier to maintain and update the system over time.
4. Better Testability: The SA/SD method provides a clear definition of the inputs and
outputs of a system, which makes it easier to test the system and ensure that it meets
its requirements.

Disadvantages of Structured Analysis and Structured Design (SA/SD):

1. Time-Consuming: The SA/SD method can be time-consuming, especially for large


and complex systems, as it requires a significant amount of documentation and
analysis.
2. Inflexibility: Once a system has been designed using the SA/SD method, it can be
difficult to make changes to the design, as the process is highly structured and
documentation-intensive.
3. Limited Iteration: The SA/SD method is not well-suited for iterative development, as
it is designed to be completed in a single pass.

Jackson System Development (JSD) –

Jackson System Development (JSD) is a method of system development that covers the
software life cycle either directly or by providing a framework into which more specialized
techniques can fit. This article focuses on discussing JSD in detail.

Jackson System Development (JSD):

Jackson system development is a linear system development approach that lets one describe and
model the real world. JSD can start from the stage in a project when there is only a general
statement of requirements.

1. However many projects that have used JSD started slightly later in the life cycle,
doing the first steps largely from existing documents rather than directly with the
users.
2. The later steps of JSD produce the code of the final system.
3. The output of the earlier steps is a set of program design problems.

Phases of Jackson System Development (JSD)

1. Modelling Phase

In the modelling phase of JSD, the designer creates a collection of entity structure diagrams and
identifies the entities in the system, the actions they perform, the attributes of the actions and the
time order of the actions in the life of the entities.

2. Specification Phase
This phase focuses on actually what is to be done? Previous phase provides the basic for this
phase. An sufficient model of a time-ordered world must itself be time-ordered. Major goal is to
map progress in the real world on progress in the system that models it.

3. Implementation Phase

In the implementation phase JSD determines how to obtain the required functionality.
Implementation way of the system is based on the transformation of the specification into an
efficient set of processes. The processes involved in it should be designed in such a manner that
it would be possible to run them on available software and hardware.

Jackson System Development (JSD) Steps

Initially there were six steps when it was originally presented by Jackson, they were as below:

1. Entity/action step
2. Initial model step
3. Interactive function step
4. Information function step
5. System timing step
6. System implementation step

Later some steps were combined to create method with only three steps:

1. Modelling Step

In this step, the designer creates a collection of entity structure diagrams. The designer identifies
the entities in the system, actions they perform, the time-ordering of the actions in the life of the
entities, and the attributes of the actions and entities. Purpose is to create a good full description
of the aspects of the system and the organization and the developer has to decide which things
are important and which are not. Thus, aiding in good communication between developers and
the users of the new system.
2. Network Step

The network step involves modelling the system as a whole and representing as a System
Specification Diagram (SSD) also known as Network Diagram. It shows processes and how they
communicate with each other. Here, each entity becomes a process. The purpose of these
processes is to process the input, calculate output, and to keep the entity process up-to date.

3. Implementation Step

In the implementation stage, the abstract network model of the system is converted to the
physical system, represented as a system implementation diagram (SID). The SID shows the
scheduler process that calls modules that implement the processes. The goal here is the
optimization of the system. It is necessary here to reduce the number of processes as it is
impossible to provide each process contained in the specification its own virtual processor. The
processes are combined to limit the number of processors.

Benefits of JSD

1. It is designed to solve the real-time problems.


2. JSD modelling focuses on time.
3. It considers simultaneous processing and timing.
4. Provides functionality in the real world.
5. It is a better approach for microcode applications.

Limitations of JSD

1. It is a poor methodology for high level analysis and database design.


2. JSD is a complex methodology due to pseudo code representation.
3. It is less graphically oriented as compared to SA/SD or OMT.
4. It is a bit complex and difficult to understand.

mapping object oriented concepts using non object oriented language :


Mapping object-oriented concepts in a non-object-oriented language within Object-Oriented
Structured Development (OOSD) involves simulating the principles of object orientation in
languages that lack native support for features like classes, inheritance, and encapsulation. While
non-OOP languages (e.g., C, Pascal) don’t inherently support these features, it is possible to
replicate aspects of object-oriented design using careful structuring techniques.

Here’s how core object-oriented concepts can be mapped in a non-object-oriented language


within OOSD:

1. Objects and Classes

● Concept in OOP: Classes define blueprints for objects with attributes (data) and methods
(functions) encapsulated together.
● Mapping in Non-OOP Language: Use structures (e.g., struct in C) or records to simulate
classes. Attributes become fields within the structure, and methods can be implemented
as functions that accept the structure as a parameter.

2. Encapsulation

● Concept in OOP: Encapsulation involves bundling data and methods and restricting
direct access to some of the data (often through access modifiers like private or public).
● Mapping in Non-OOP Language: Encapsulation can be enforced through careful
structuring of functions. By convention, "private" fields can be managed by controlling
access functions and keeping data manipulation within a defined set of functions that act
as methods. This is often done by not exposing certain details in headers or by using
function pointers to limit access.

3. Inheritance

● Concept in OOP: Inheritance allows a new class to adopt properties and behavior from
an existing class.
● Mapping in Non-OOP Language: While inheritance isn’t directly supported, similar
behavior can be achieved through composition, where a structure includes another as a
field, simulating a "has-a" relationship instead of "is-a."
4. Polymorphism

● Concept in OOP: Polymorphism allows methods to be called on objects of different


classes through a common interface, typically using inheritance.
● Mapping in Non-OOP Language: Polymorphism can be simulated using function pointers
and structures. By defining a function pointer as part of a structure, different "types" can
assign different functions to these pointers, achieving polymorphic behavior.

5. Abstraction

● Concept in OOP: Abstraction hides complex implementation details and exposes only the
necessary parts of an object.
● Mapping in Non-OOP Language: Abstraction can be simulated by defining only essential
details in a structure and hiding implementation details in separate functions or modules.
Users of a data structure interact only with the exposed functions, unaware of underlying
complexities.

6. Objects as Instances of Structures

● Concept in OOP: In OOP, objects are instances of classes.


● Mapping in Non-OOP Language: Objects can be represented by dynamically allocating
instances of structures. For example, using malloc in C to create new instances (objects)
of a structure.

Advantages and Challenges of OOSD in Non-OOP Languages

● Advantages: Mapping object-oriented principles in non-OOP languages allows legacy


systems and older programming languages to benefit from modularity, abstraction, and
reusability. This is helpful in systems with strict performance requirements or constrained
environments.
● Challenges: Without native support for OOP concepts, enforcing encapsulation and
simulating inheritance can make code more complex and error-prone. The approach may
also reduce readability and increase maintenance effort.

translating concept into data structures

In object-oriented software development (OOSD), the process of translating a concept into data
structures involves: Understanding the problem, Choosing data structures, Building an object
model, and Refining the model.

Here are some additional tips for choosing data structures and algorithms for OOSD: Follow
design principles, Test and refactor, and Learn from examples.

OOSD is a method for developing software systems that focuses on the objects of a problem.
The goal of object-oriented design (OOD) is to create a description and specification that allows
developers to build, test, and reuse system components.

Here are some key concepts in OOD:

● Object model: A model based on objects and their relationships


● Classes: Designed and refined during the OOD phase
● Attributes: Designed and refined during the OOD phase
● Methods: Designed and refined during the OOD phase
● Structures: Designed and refined during the OOD phase
● Associations: Designed and refined during the OOD phase

Parameter Passing Techniques


Basic Terminologies

● Function Parameters: These variables, which indicate the data that the function
anticipates receiving when called, are specified in the parameter list of a function.
● Actual Parameters: The expressions or values passed in during a function call.
When the function is called, it receives these values as input.
● The parameters that the function signature declares. They serve as stand-ins for the
values that are provided in when the function is called.

Parameter Passing Techniques in C++


There are 3 different methods using which we can pass parameters to a function in C++. These
are:

1. Pass by Value
2. Pass by Reference
3. Pass by Pointers

1. Pass by Value
In Pass by Value method, a variable’s actual value is copied and then passed to the function
instead of the original variable. As the result, any changes to the parameter inside the function
will not affect the variable’s original value outside the function. Althogh it is easy to understand
and implement, this method is not so useful for large size of data structures at it involves copying
the value.

2. Pass by Reference
In pass-by-reference method, instead of passing the argument itself, we passes the reference of
an argument to the function. This allows the function to change the value of the original
argument.

Any changes we make to your argument inside your function are reflected in your original
argument so we have to be careful while handling data in this method.

3. Pass by Pointer
The pass-by-pointer is very similar to the pass-by-reference method. The only difference is that
we pass the raw pointers instead of reference to the function. It means that we pass the address of
the argument to the function.

Summary of Argument Passing in C++

Method Copy Modifies Typical Use Cases


of Original?
Data
?

Pass by Value Yes No Small, primitive data


types

Pass by No Yes Modify original data


Reference

Pass by Pointer No Yes (if not Arrays, dynamic


null) memory, nullables

Pass by Constant No No Large objects,


Reference read-only

implementing inheritance

The capability of a class to derive properties and characteristics from another class is called
Inheritance. Inheritance is one of the most important features of Object Oriented Programming in
C++. In this article, we will learn about inheritance in C++, its modes and types along with the
information about how it affects different properties of the class.
Syntax of Inheritance in C++
class derived_class_name : access-specifier base_class_name

// body ....

};

where,

● class: keyword to create a new class


● derived_class_name: name of the new class, which will inherit the base class
● access-specifier: Specifies the access mode which can be either of private, public or
protected. If neither is specified, private is taken as default.
● base-class-name: name of the base class.

association encapsulation:

data encapsulation in C++ is an important feature of OOP that provides data hiding,
access control, and a way to bundle data and methods together to create self-contained,
reusable, and maintainable code. It is a crucial concept that helps build robust and
modular software systems.

Encapsulation in C++ is defined as the wrapping up of data and information in a single unit. In
Object Oriented Programming, Encapsulation is defined as binding together the data and the
functions that manipulate them.

Consider a real-life example of encapsulation, in a company, there are different sections like the
accounts section, finance section, sales section, etc. Now,

● The finance section handles all the financial transactions and keeps records of all the
data related to finance.
● Similarly, the sales section handles all the sales-related activities and keeps records of
all the sales.
Two Important property of Encapsulation

1. Data Protection: Encapsulation protects the internal state of an object by keeping its
data members private. Access to and modification of these data members is restricted
to the class’s public methods, ensuring controlled and secure data manipulation.
2. Information Hiding: Encapsulation hides the internal implementation details of a
class from external code. Only the public interface of the class is accessible,
providing abstraction and simplifying the usage of the class while allowing the
internal implementation to be modified without impacting external code.

Features of Encapsulation
Below are the features of encapsulation:

1. We can not access any function from the class directly. We need an object to access
that function that is using the member variables of that class.
2. The function which we are making inside the class must use only member variables,
only then it is called encapsulation.
3. If we don’t make a function inside the class which is using the member variable of the
class then we don’t call it encapsulation.
4. Encapsulation improves readability, maintainability, and security by grouping data
and methods together.
5. It helps to control the modification of our data members.
Advantages & Disadvantages Of Encapsulation In C++

Encapsulation in C++ is a key idea in object-oriented programming (OOP concept) with several
advantages. Here are some of the primary advantages of data encapsulation in C++:

● Data protection: Encapsulation aids in preventing unwanted user access to and


modification of the data in a class. This is crucial for guaranteeing the safety of your
code.
● Reusability: Data encapsulation in C++ allows code reuse as data and the functions are
encapsulated into a single entity. This makes the code simpler to comprehend and utilize.
● Increased Security: Encapsulation in C++ can aid in making your code more secure and
prevent security risks. This is because the data is shielded from view, making it more
difficult for hackers to access and alter it.
● Better Readability and Code Maintainability: Another benefit of using data encapsulation
in C++ is that it makes your code easier to read and maintain as the data and the functions
are all in one location.
● Controlled Access: With data encapsulation in C++, access to data and functionality is
provided through well-defined getter and setter methods (as seen in the examples above).
This controlled access ensures that data is accessed and modified in a controlled manner.

While there are multiple benefits of encapsulation, there can be scenarios where it might lead to
complications, especially when used excessively. Some such disadvantages of data encapsulation
in C++ are:

● Code Length: The code becomes longer and more verbose because you need to define
getter and setter methods for each data member. Thus, data encapsulation in C++ can also
make the code harder to read and maintain
● Potential for Errors: Overusing the concept of encapsulation in C++ programs can lead to
errors. Using setter methods introduces the potential for errors, as they may not always
validate or handle data correctly. For example, the setAge and setGPA methods in the
example do not handle invalid data gracefully.
● Limited Benefits: In some cases, the use of getter and setter methods (that are an integral
part of data encapsulation in C++) may provide limited benefits if the data members don't
require additional validation or logic during access or modification.

Difference Between Abstraction and Encapsulation In C++

Encapsulation is a way of hiding an object's implementation details from its users. Data
encapsulation in C++ is implemented using private and public access specifiers, which control
the visibility of data and methods.

Abstraction, on the other hand, is a way of hiding the complexity of an object from its users. This
makes the object easier to understand and use, as the users do not need to know how the object
works internally. Abstraction in C++ is implemented using abstract classes and interfaces.

The table below provides a clear comparison between abstraction and data encapsulation in C++.

Feature Encapsulation Abstraction

Definition Encapsulation is Abstraction is the process of


the bundling of simplifying complex reality
data and methods by modelling classes based on
that operate on that essential properties and
data into a single behaviours.
unit (class).

Purpose To hide the internal To provide a clear separation


details and state of between what an object does
an object and (interface) and how it does it
provide access (implementation).
control to its
members.

Visibility It controls access to It defines a high-level


the internal interface for interacting with
members of a class an object, often using abstract
using access classes and interfaces.
specifiers (e.g.,
private, protected,
public).

Members Encapsulation Abstraction focuses on


involves bundling defining the essential methods
data members and properties of a class
(attributes) and without specifying their
methods implementation.
(functions) into a
single unit (class).

Usage It is primarily It is primarily concerned with


concerned with providing a simplified view of
data protection, an object's functionality to the
access control, and outside world.
modularization of
code.

Implementati It involves It involves defining a class


on specifying how interface (method signatures)
data and methods without specifying the
are grouped within implementation details.
a class, including
their access
modifiers.

Example Encapsulation in In C++, abstraction is


C++ is achieved by achieved by defining an
using access abstract class with pure
specifiers like virtual functions or interfaces.
private, protected,
and public within a
class.
Benefit Enhances data Simplifies the usage of
security, maintains complex systems, promotes
data integrity, and modularity, and allows for
controls access to code reusability.
class members.

OOP
In C++, reusability in object-oriented programming (OOP) is the practice of reusing code in
multiple projects or parts of a program. This is achieved through OOP principles like
inheritance and composition, which support modularity and extensibility.

Here are some benefits of code reusability:

● Saves time and resources: Developers can use existing code instead of writing it from
scratch.
● Reduces redundancy: Developers don't have to write the same code multiple times.
● Improves maintainability: It's easier to modify code if it's reusable. For example, if
you need to fix a bug, you only have to modify it in one place.
● Ensures consistent software: Developers can create reliable software solutions more
efficiently.

Reusabilty means using the same code again and again without writing it twice. It is a concept
of OOP that is achieved via Inheritance. It helps to save memory and reduces the complexity of a
program. With the use of reusabilty we can add additional features to an existing class without
modifying it.

Extensibility means permitting language users to define new language features. Starting with a
base language and using various definition facilities an extensible language user can create new
notations, new data structures, new operations, and, sometimes, new regimes of control.
In object-oriented programming (OOP) in C++, robustness is the ability to write code that is
easy to use and hard to misuse. Robust code can handle unexpected actions and terminations
gracefully, displaying clear error messages to help users debug the program.

Here are some features of C++ that make it easier to write robust code: strict ownership of
resources, const correctness, value semantics, type safety, and deterministic destruction of
objects.

C++ is a good language choice for OOP because it provides strong support for OOP concepts.
These concepts include: encapsulation, inheritance, polymorphism, abstraction, and
composition.

By combining these concepts with good design practices and patterns, developers can create
robust, scalable, and maintainable applications.

Software robustness is an important characteristic of any high-quality software system. Robust


software can handle errors, exceptions, and unexpected inputs without crashing or causing the
system to fail

Benefits of Programming in the Large in C++

1. Modularity: By structuring the program into smaller classes (Product, Customer,


ShoppingCart, etc.), each with a specific role, we achieve modularity. It’s easy to add,
remove, or modify features in isolation.
2. Reusability: Classes like Product and Customer can be reused across different parts of
the system or even in other projects.
3. Maintainability: The system is easier to understand and maintain because the
responsibilities are clear and code is organized.
4. Extensibility: Adding features, like different payment options, is straightforward through
inheritance and polymorphism.
5. Testability: Individual classes and components are easier to test in isolation, which is
crucial in large systems.
Difference between Procedural vs OOP

Aspect Procedural Programming Object-Oriented Programming


(OOP)

Basic Paradigm Focuses on functions and Focuses on objects and their


sequential execution interactions

Structure Organized around functions and Organized around classes that


data manipulation encapsulate data and behavior

Data Handling Data and functions are separate, Data and functions are bundled
with global or shared data within classes (encapsulation)

Modularity Functions serve as basic modules Classes and objects serve as modular
units

Encapsulation Limited, as data is often globally Strong encapsulation; data is hidden


accessible within classes

Code Reusability Achieved by calling functions in Achieved through inheritance and


different contexts polymorphism

Data Hiding Data is exposed and accessible Data is protected within classes,
globally or passed between controlled access via public methods
functions

Extensibility Extending functionality often New classes can extend existing


requires modifying existing code functionality without modifying base
classes
Polymorphism Not inherent; uses conditionals Achieved through virtual functions,
(if-else, switch) for type-based allowing flexible and interchangeable
behavior behavior

Maintainability Becomes difficult as codebase Easier to maintain due to modular


grows design and encapsulation

Abstraction Limited abstraction, focusing on High abstraction, focusing on


procedures defining entities and behaviors

Debugging and Can be challenging, especially Easier to test in isolation due to


Testing with global state and encapsulation of data and behavior
dependencies

Example Usage Suitable for smaller, Ideal for large, complex systems
straightforward applications requiring modularity and reusability

object oriented features :

Here’s a short note on the key features of Object-Oriented Programming (OOP):

1. Encapsulation: Encapsulation is the concept of bundling data (variables) and methods


(functions) that operate on the data into a single unit, known as a class. It restricts direct
access to some of an object’s components and can prevent the accidental modification of
data.
Example: Data is hidden from outside using access specifiers (private, public).
2. Inheritance: Inheritance allows a class to inherit attributes and behaviors (methods) from
another class, promoting code reuse and the creation of hierarchical relationships.
Example: A Car class can inherit from a Vehicle class, gaining all its features.
3. Polymorphism: Polymorphism enables objects of different classes to be treated as objects
of a common superclass. The most common use is method overriding, where a method in
a subclass has the same name and signature as one in the superclass but behaves
differently.
Example: A Dog class and a Cat class might both have a sound() method but produce
different outputs.
4. Abstraction: Abstraction involves hiding complex implementation details and showing
only the essential features of an object. It simplifies interaction with complex systems.
Example: A Shape class might have an abstract method area() that is implemented
differently by its subclasses like Circle or Rectangle.

You might also like