Object Oriented Software Engineering - CCS356 - Notes - Unit 3 - Software Design
Object Oriented Software Engineering - CCS356 - Notes - Unit 3 - Software Design
CSE
Home Mech
e
EEE
ECE
Physics
Basic for Engineering
Electrical and Data Structure
Problem Solving and Science Engineering
Electronics
Python Programming Object Oriented
Programming in C
Programming
Elective-Management
Professional Elective II
Professional Elective IV
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
UNIT III
SOFTWARE DESIGN
Software design – Design process – Design concepts – Coupling – Cohesion – Functional
independence – Design patterns – Model-view-controller – Publish- subscribe – Adapter –
Command – Strategy – Observer – Proxy – Facade – Architectural styles – Layered - Client Server
- Tiered - Pipe and filter- User interface design-Case Study.
1. Software design:
The design phase of software development deals with transforming the customer
requirements as described in the SRS documents into a form implementable using a programming
language. The software design process can be divided into the following three levels or phases of
design:
1. Interface Design
2. Architectural Design
3. Detailed Design
Elements of a System
1. Architecture: This is the conceptual model that defines the structure, behavior, and
views of a system. We can use flowcharts to represent and illustrate the architecture.
2. Modules: These are components that handle one specific task in a system. A
combination of the modules makes up the system.
3. Components: This provides a particular function or group of related functions. They are
made up of modules.
4. Interfaces: This is the shared boundary across which the components of a system
exchange information and relate.
5. Data: This is the management of the information and data flow.
The design phase of software development deals with transforming the customer
requirements as described in the SRS documents into a form implementable using a programming
language. The software design process can be divided into the following three levels or phases of
design:
1. Interface Design
2. Architectural Design
3. Detailed Design
Elements of a System
1. Architecture: This is the conceptual model that defines the structure, behavior, and
views of a system. We can use flowcharts to represent and illustrate the architecture.
2. Modules: These are components that handle one specific task in a system. A
combination of the modules makes up the system.
3. Components: This provides a particular function or group of related functions. They are
made up of modules.
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 1
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
4. Interfaces: This is the shared boundary across which the components of a system
exchange information and relate.
5. Data: This is the management of the information and data flow.
Interface Design
Interface design is the specification of the interaction between a system and its environment.
This phase proceeds at a high level of abstraction with respect to the inner workings of the system
i.e, during interface design, the internal of the systems are completely ignored, and the system is
treated as a black box. Attention is focused on the dialogue between the target system and the
users, devices, and other systems with which it interacts. The design problem statement
produced during the problem analysis step should identify the people, other systems, and devices
which are collectively called agents.
Interface design should include the following details:
1. Precise description of events in the environment, or messages from agents to which the
system must respond.
2. Precise description of the events or messages that the system must produce.
3. Specification of the data, and the formats of the data coming into and going out of the
system.
4. Specification of the ordering and timing relationships between incoming events or
messages, and outgoing events or outputs.
Architectural Design
Architectural design is the specification of the major components of a system, their
responsibilities, properties, interfaces, and the relationships and interactions between them. In
architectural design, the overall structure of the system is chosen, but the internal details of major
components are ignored. Issues in architectural design includes:
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 2
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
Software design principles are concerned with providing means to handle the complexity of
the design process effectively. Effectively managing the complexity will not only reduce the effort
needed for design but can also reduce the scope of introducing errors during design.
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 3
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
Problem Partitioning
For small problem, we can handle the entire problem at once but for the significant
problem, divide the problems and conquer the problem it means to divide the problem
into smaller pieces so that each piece can be captured separately.
For software design, the goal is to divide the problem into manageable pieces.
Abstraction
1. Functional Abstraction
2. Data Abstraction
Functional Abstraction
i. A module is specified by the method it performs.
ii. The details of the algorithm to accomplish the functions are not visible to
the user of the function.
Data Abstraction
Details of the data elements are not visible to the users of data. Data Abstraction
forms the basis for Object Oriented design approaches.
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 4
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
Modularity
Modularity specifies to the division of software into separate modules which are
differently named and addressed and are integrated later on in to obtain the completely
functional software. It is the only property that allows a program to be intellectually
manageable. Single large programs are difficult to understand and read due to a large
number of reference variables, control paths, global variables, etc.
Advantages of Modularity
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 5
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
Disadvantages of Modularity
1. Abstraction
• A solution is stated in large terms using the language of the problem
environment at the highest level abstraction.
• The lower level of abstraction provides a more detail description of the
solution.
• A sequence of instruction that contain a specific and limited function refers
in a procedural abstraction.
• A collection of data that describes a data object is a data abstraction.
2. Architecture
• The complete structure of the software is known as software architecture.
• Structure provides conceptual integrity for a system in a number of ways.
• The architecture is the structure of program modules where they interact
with each other in a specialized way.
• The components use the structure of data.
• The aim of the software design is to obtain an architectural framework of a
system.
• The more detailed design activities are conducted from the framework.
3. Patterns
A design pattern describes a design structure and that structure solves a
particular design problem in a specified content.
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 6
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
4. Modularity
• A software is separately divided into name and addressable components.
Sometime they are called as modules which integrate to satisfy the problem
requirements.
• Modularity is the single attribute of a software that permits a program to be
managed easily.
5. Information hiding
Modules must be specified and designed so that the information like algorithm
and data presented in a module is not accessible for other modules not requiring that
information.
• Functional independence
6. Refinement
Refinement is a top-down design approach.
It is a process of elaboration.
A program is established for refining levels of procedural details.
A hierarchy is established by decomposing a statement of function in a stepwise
manner till the programming language statement are reached.
7. Refactoring
It is a reorganization technique which simplifies the design of components
without changing its function behaviour.
Refactoring is the process of changing the software system in a way that it does
not change the external behaviour of the code still improves its internal structure.
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 7
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
8. Design classes
The model of software is defined as a set of design classes.
Every class describes the elements of problem domain and that focus on features
of the problem which are user visible.
• OO design concept in Software Engineering
• Software design model elements
A good design is the one that has low coupling. Coupling is measured by the
number of relations between the modules. That is, the coupling increases as the number
of calls between modules increase or the amount of shared data is large. Thus, it can be
said that a design with high coupling will have more errors.
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 8
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
In this case, modules are subordinates to different modules. Therefore, no direct coupling.
2. Data Coupling: When data of one module is passed to another module, this is called data
coupling.
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 9
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
3. Stamp Coupling: Two modules are stamp coupled if they communicate using composite
data items such as structure, objects, etc. When the module passes non-global data structure or entire
structure to another module, they are said to be stamp coupled. For example, passing structure
variable in C or object in C++ language to a module.
4. Control Coupling: Control Coupling exists among two modules if data from one module
is used to direct the structure of instruction execution in another.
5. External Coupling: External Coupling arises when two modules share an externally
imposed data format, communication protocols, or device interface. This is related to communication
to external tools and devices.
6. Common Coupling: Two modules are common coupled if they share information through
some global data items.
7. Content Coupling: Content Coupling exists among two modules if they share code, e.g.,
a branch from one module into another module.
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 10
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
Module Cohesion
In computer programming, cohesion defines to the degree to which the elements of a module
belong together. Thus, cohesion measures the strength of relationships between pieces of
functionality within a given module. For example, in highly cohesive systems, functionality is
strongly related.
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 11
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 12
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
6. Logical Cohesion: A module is said to be logically cohesive if all the elements of the
module perform a similar operation. For example Error handling, data input and data output,
etc.
7. Coincidental Cohesion: A module is said to have coincidental cohesion if it
performs a set of tasks that are associated with each other very loosely, if at all.
Coupling Cohesion
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 13
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
Suppose you and your friends are asked to work on a calculator project as a team.
Here we need to develop each calculator functionality in form of modules taking two user
inputs.
Before you enter into development phase, you and your team needs to make sure to
design the project in such a way that each of the module that you develop individually
should be able to perform its assigned task without requiring much or no interaction with
your friends module.
What I intend to say is, if you are working on addition Module then your module
should be able to independently perform addition operation on receiving user input. It
should not require to make any interaction with other modules like subtraction Module,
multiplication Module or etc.
Module reusability
A functionally independent module performs some well defined and specific task. So
it becomes easy to reuse such modules in different program requiring same functionality.
Understandability
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 14
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
1.3.
Design Patterns
Design patterns can speed up the development process by providing tested, proven
development paradigms. Effective software design requires considering issues that may not
become visible until later in the implementation. Reusing design patterns helps to prevent subtle
issues that can cause major problems and improves code readability for coders and architects
familiar with the patterns.
Often, people only understand how to apply certain software design techniques to certain
problems. These techniques are difficult to apply to a broader range ofproblems. Design patterns
provide general solutions, documented in a format that doesn't require specifics tied to a particular
problem.
These design patterns are all about class instantiation. This pattern can befurther
divided into class-creation patterns and object-creational patterns. While
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 15
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
• AbstractFactory
Creates an instance of several families of classes
• Builder
Separates object construction from its representation
• FactoryMethod
Creates an instance of several derived classes
• ObjectPool
Avoid expensive acquisition and release of resources by recycling objectsthat are no
longer in use
• Prototype
A fully initialized instance to be copied or cloned
• Singleton
A class of which only a single instance can exist
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 16
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
These design patterns are all about Class and Object composition. St
class-creation patterns use inheritance to compose interfaces. Structura
patterns define ways to compose objects to obtain new functionality
ty.
• Adapter
Match interfaces of different classes
• Bridge
Separates an object’s interface from its implementation
• Composite
A tree structure of simple and composite objects
• Decorator
Add responsibilities to objects dynamically
• Facade
A single class that represents an entire subsystem
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 17
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
• Flyweight
A fine-grained instance used for efficient sharing
PrivateClassData
Restricts accessor/mutator access
• Proxy
An object representing another object
These design patterns are all about Class's objects communication. Behavioral patterns are
those patterns that are most specifically concerned with communication between objects.
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 18
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
• Chainofresponsibility
A way of passing a request between a chain of objects
• Command
Encapsulate a command request as an object
• Interpreter
A way to include language elements in a program
• Iterator
Sequentially access the elements of a collection
• Mediator
Defines simplified communication between classes
• Memento
Capture and restore an object's internal state
• NullObject
Designed to act as a default value of an object
• Observer
A way of notifying change to a number of classes
State
Alter an object's behavior when its state changes
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 19
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
• Strategy
Encapsulates an algorithm inside a class
• Templatemethod
Defer the exact steps of an algorithm to a subclass
• Visitor
Defines a new operation to a class without change
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 20
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
allow forcentralized control over the instantiation process. This can be advantageous in
managing resources, enforcing constraints, or ensuring a single point of access.
• Scalability: With creational patterns, it’s easier to scale and extend a system by
adding newtypes of objects or introducing variations without causing major disruptions to the
existing codebase.
• Promotion of Good Design Practices: Creational patterns often encourage adherence
to good design principles such as abstraction, encapsulation, and the separation of concerns. This
leads to cleaner, more maintainable code.
Disadvantages of Creational Design Patterns
• Increased Complexity: Introducing creational patterns can sometimes lead to
increasedcomplexity in the codebase, especially when dealing with a large number of classes,
interfaces, and relationships.
• Overhead: Using certain creational patterns, such as the Abstract Factory or
Prototypepattern, may introduce overhead due to the creation of a large number of classes and
interfaces.
• Dependency on Patterns: Over-reliance on creational patterns can make the
codebasedependent on a specific pattern, making it challenging to adapt to changes or switch
to alternative solutions.
• Readability and Understanding: The use of certain creational patterns might make
the code less readable and harder to understand, especially for developers who are not familiar
with thespecific pattern being employed.
Structural Design Patterns
Structural patterns are concerned with how classes and objects are composed to form
larger structures. Structural class patterns use inheritance to compose interfaces or
implementations.Importance of Structural Design Patterns
• This pattern is particularly useful for making independently developed class
libraries worktogether.
• Structural object patterns describe ways to compose objects to realize new
functionality.
• It added flexibility of object composition comesfrom the ability to change the
composition atrun-time, which is impossible with static class composition.
When to ue Structural Design Patterns
• Adapting to Interfaces: Use structural patterns like the Adapter pattern when you
need to make existing classes work with others without modifying their source code. This is
particularlyuseful when integrating with third-party libraries or legacy code.
• Organizing Object Relationships: Structural patterns such as the Decorator pattern
are useful when you need to add new functionalities to objects by composing them in a
flexibleand reusable way, avoiding the need for subclassing.
• Simplifying Complex Systems: When dealing with complex systems, structural
patterns likethe Facade pattern can be used to provide a simplified and unified interface to a
set of interfaces in a subsystem.
• Managing Object Lifecycle: The Proxy pattern is helpful when you need to control
access toan object, either for security purposes, to delay object creation, or to manage the
object’s lifecycle.
• Hierarchical Class Structures: The Composite pattern is suitable when dealing
with hierarchical class structures where clients need to treat individual objects and
compositions ofobjects uniformly.
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 21
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 22
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
strategies,or behaviors, allowing them to vary independently from the objects that use them.
This promotes code reusability and maintainability.
• Dynamic Behavior Changes: Use behavioral patterns when you need to allow for
dynamicchanges in an object’s behavior at runtime without altering its code. This is
particularly relevant for systems that require flexibility in behavior.
• State-Dependent Behavior: State pattern is suitable when an object’s behavior
depends on its internal state, and the object needs to change its behavior dynamically as its
state changes.
• Interactions Between Objects: Behavioral patterns are valuable when you want to
model
and manage interactions between objects in a way that is clear, modular, and easy to
understand.
Advantages of Behavioral Design Patterns
Flexibility and Adaptability:
• Behavioral patterns enhance flexibility by allowing objects to interact in a more
dynamic andadaptable way. This makes it easier to modify or extend the behavior of a system
without altering existing code.
• Code Reusability:
• Behavioral patterns promote code reusability by encapsulating algorithms,
strategies, or behaviors in separate objects. This allows the same behavior to be reused across
differentparts of the system.
• Separation of Concerns:
• These patterns contribute to the separation of concerns by dividing the
responsibilities ofdifferent classes, making the codebase more modular and easier to
understand.
• Encapsulation of Algorithms:
• Behavioral patterns encapsulate algorithms, strategies, or behaviors in standalone
objects,making it possible to modify or extend the behavior without affecting the client code.
• Ease of Maintenance:
• With well-defined roles and responsibilities for objects, behavioral patterns contribute
to easier maintenance. Changes to the behavior can be localized, reducing the impact on the rest
of the code.
Disadvantages of Behavioral Design Patterns
• Increased Complexity: Introducing behavioral patterns can sometimes lead to
increased complexity in the codebase, especially when multiple patterns are used or when
there is anexcessive use of design patterns in general.
• Over-Engineering: There is a risk of over-engineering when applying behavioral
patterns where simpler solutions would suffice. Overuse of patterns may result in code that is
more complex than necessary.
• Limited Applicability: Not all behavioral patterns are universally applicable. The
suitability ofa pattern depends on the specific requirements of the system, and using a pattern
in the wrong context may lead to unnecessary complexity.
• Code Readability: In certain cases, applying behavioral patterns may make the code
less readable and harder to understand, especially for developers who are not familiar with the
specific pattern being employed.
• Scalability Concerns: As the complexity of a system increases, the scalability of
certain behavioral patterns may become a concern. For example, the Observer pattern may
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 23
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
Model-view-controller (MVC)
Definition
Model
This component in the architecture will represent all data-related logic. This includes
defining how the data is formed. In other words, this holds the definition for many ofthe types
that we use in the application. In many cases, the model here refers to the type of data that we
are dealing with in the application. This component also notifiesits dependents about data
changes.
View
Contains all User interface (UI) logic in the application. This component of the
application encapsulates mainly the UI related logic which includes things that the enduser will
manipulate like dropdown buttons and web pages etc.
Controller
Controllers exist as a layer between Model and View components to process all the
business logic arising from user input. It is responsible to handle inputs from the View
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 24
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
components, manipulate data using the models from the Model component and thenfinally
interact with the view components again to render the final output to the enduser. Responsible
for manipulating the data.
Why MVC
The MVC pattern today is widely used for many applications and remain a popularchoice.
This is due to a few key reasons
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 25
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
Given the separation of the applications into the three distinct areas, this means that more
developers are able to work on each part separately. e.g if a developer works onthe model, he is
not directly blocking another developer from building up the view component of the application
and thus allows teams to speed up development purelydue to the nature of the architecture itself.
Greater Testability
Each component being separated from each other means that developers are able totest
each one separately and in isolation. This is made easier due to the clear separation of concerns
that is applied in this architecture pattern. e.g a Model can betested easily without the view
component.
Any changes in view component will usually not affect the model component, hence
developers using this pattern can easily extend and add new views to the application todisplay
the data from model in different ways. Thus, modifications are easier to be isolated to a single
component instead of affecting the entire application
Web applications
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 26
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
This framework provides developers with a MVC abstraction built on top of ASP.NEXT
and thus provide a large set of added functionality.
Sample code from ASP.NET documentation
Another example framework for web that uses MVC is Sails. Sails is a nodeJs framework
that provides added functionality. A sails app comes preconfigured with theMVC structure
predefined and developers can just use it right out of the box.
1.4. Adapter
What is an Adapter?
For example, an adapter implements an interface A and gets injected an interface B. When
the adapter is instantiated it gets injected in its constructor an object that implements interface
B. This adapter is then injected wherever interface A is neededand receives method requests that
it transforms and proxies to the inner object thatimplements interface B.
If I managed to confuse you, no worries, I give a more concrete example further below.
🙂
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 27
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
The adapters on the left side, representing the UI, are called the Primary or Driving
Adapters because they are the ones to start some action on the application, while theadapters on
the right side, representing the connections to the backend tools, are called the Secondary or
Driven Adapters because they always react to an action ofa primary adapter.
• On the right side, the adapter is the concrete implementation of the port and is
injected in our business logic although our business logic only knows about the interface. On
this side, the port belongs inside the application, but its concrete implementation belongs
outside and it wraps around some externaltool.
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 28
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
Using this port/adapter design, with our application in the centre of the system, allowsus to
keep the application isolated from the implementation details like ephemeral technologies,
tools and delivery mechanism
COMMAND:
The invoker does not know anything about a concrete command, it knows only about the
command interface. Invoker object(s), command objects and receiver objects are held by a client
object, the client decides which receiver objects it assigns to the command objects, and which
commands it assigns to the invoker.
The client decides which commands to execute at which points. To execute a
command, it passes the command object to the invoker object.
Using command objects makes it easier to construct general components that need to
delegate, sequence or execute method calls at a time of their choosing without the need to know
the class of the method or the method parameters.
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 29
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 30
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
The design starts with the lowest level components and subsystems. By using these
components,the next immediate higher-level components and subsystems are created or
composed. The process is continued till all the components and subsystems are composed into
a single component, which is considered as the complete system. The amount of abstraction
grows high as the design moves to more high levels.
By using the basic information existing system, when a new system needs to be created,
thebottom-up strategy suits the purpose.
Bottom-up approach
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 31
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
For the solutions of the software that need to be developed from the ground level, a top-
downdesign best suits the purpose.
Top-down approach
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 32
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
PUBLISH –SUBSCRIBE
The pub-sub model involves publishers and subscribers, making it a messaging pattern.
Specifically, the publishers are responsible for sending messages to the system, while
subscribers are responsible for receiving those messages.
Mainly, the pub-sub model is based on decoupling components in a system, which
means that components can interact without being tightly coupled.
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 33
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
In this section, we’ll discuss how this model works, including sending messages,
checking for subscribers, receiving messages, registering for topics, decoupling publishers
and subscribers, and additional features the message broker implements toenhance
message delivery.
Sending Messages
A publisher sends a message to the message broker with a specific topic, which is a string
thatidentifies the content of the message.
The message broker receives the message and checks the topic to see if any subscribers
haveexpressed interest in receiving messages on that topic. Furthermore, if subscribers are
interested in the topic, the message broker sends the message to all subscribers who have
registered interest in that topic.
Receiving Messages
Subscribers receive the message from the message broker. Then, it can process the message
as needed. However, the message is discarded if no subscribers are interested in the topic.
To receive messages on specific topics, subscribers can register interest in one or more
topics with the message broker. Additionally, this feature enables subscribers to receive messages
ontopics they are interested in.
Publishers and subscribers do not need to know about each other’s existence since they
interact only through the message broker, which acts as an intermediary.
Additional Features
The message broker can also implement additional features such as filtering messages
basedon content, ensuring message delivery, and providing message ordering guarantees.
These features enhance the reliability and efficiency of message delivery.
By decoupling publishers and subscribers, the pub-sub model allows them to interact
through amessage broker, which helps to reduce tight coupling between components in a
system.
This makes it an ideal messaging pattern for use in distributed systems, where
differentparts of the system must interact without being tightly coupled.
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 34
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
The pub-sub model has several benefits. The following table summarizes its main
advantages:
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 35
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
However, the pub-sub model also has some drawbacks. The following table shows its
main drawbacks:
One of the use cases for the pub-sub model is online gaming, where publishers can send real-
time updates on player positions, score changes, and game events to all subscribers.
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 36
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
Overall, this enhances the gaming experience and ensures all players receive the same
updates simultaneously.
The pub-sub model is also used in smart homes to send messages from sensors to actuators.
For example, we can use this model to turn on the lights when someone enters a room.
1.5.
OBSERVER
Observer design pattern falls under the category of behavioral design patterns
Observer Pattern maintains a one-to-many relationship among objects, ensuring that whe
state of one object is changed, all of its dependent objects are simultaneously inf
and updated. This design pattern is also referred to as Dependents.
A subject and observer (many) exist in a one-to-many relationship. Here the observ
not have any access to data, so they are dependent on the subject to feed them with inform
The observer design patterns when designing a system where several objects are interested in
any possible modification to a specific object. In other words, the observer design pattern is
employed when there is a one-to-many relationship between objects, such as when one object
is updated, its dependent objects must be automatically notified.
Real-World Example: If a bus gets delayed, then all the passengers who were supposed to
travel in it get notified about the delay, to minimize inconvenience. Here, the bus agency is the
subject and all the passengers are the observers. All the passengers are dependent on the agency
to provide them with information about
any changes regarding their travel journey. Hence, there is a one-to-many relationship between
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 37
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
• Social Media Platforms for example, many users can follow a particular person(subject)
on a social media platform. All the followers will be updated if the subject updates his/her profile.
The users can follow and unfollow the subject anytime they want.
• Newsletters or magazine subscription
• Journalists providing news to the media
• E-commerce websites notify customers of the availability of specific products
Consider the following scenario: There is a new laughter club in town, with a grand opening,
it caught the attention of a lot of people interested in being a member of the club. Thrilled with the
overwhelming response, the club owner was a bit worried about the smooth management and
involvement of all the members.
The observer design pattern is the best solution to the owner’s problem. The owner here is the
subject and all the members of the club are observers. The observers have no access to the club’s
information and the upcoming events unless the owner notifies them of it. Also, the members have
the option to opt out of the club whenever they want to. This allows the owner to easily manage and
engage all of the members.
Structure
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 38
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
• The subject delivers events that are intriguing to the observers. These events occur due to
changes in the state of the subject or the execution of certain behaviors. Subjects have a registration
architecture that enables new observers to join and existing observers to withdraw from the list.
• Whenever a new event occurs, the subject iterates through the list of observers, calling the
notify method provided in the 'observer' interface.
• The notification interface is declared by the Observer interface. It usually includes an
updating method. The method may include numerous options that allow the subject to provide event
information together with the update.
• Concrete Observers do certain activities in response to alerts sent by the Subject. All the
concrete observer classes should implement the base observer interface, and the subject interface is
coupled only with the base observer interface.
• S
ometimes, observers want some additional context in order to properly process any update notified
by the Subject. As a result, the Subject frequently supplies some contextual information as
parameters to the notification function. The subject can pass itself as an argument, allowing the
subject to immediately retrieve any needed data.
• I
implementation
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 39
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
Remoteproxy:
They are responsible for representing the object located remotely. Talking to the real object
might involve marshalling and unmarshalling of data and talking to the remote object. All that logic
is encapsulated in these proxies and the client application need not worry about them.
Virtual proxy:
These proxies will provide some default and instant results if the real object is supposed to
take some time to produce results. These proxies initiate the operation on real objects and provide a
default result to the application. Once the real object is done, these proxies push the actual data to
the client where it has provided dummy data earlier.
Protection proxy:
If an application does not have access to some resource then such proxies will talk to the objects
in applications that have access to that resource and then get the result back.
Smart Proxy:
A smart proxy provides additional layer of security by interposing specific actions when the
object is accessed. An example can be to check if the real object is locked before it is accessed to
ensure that no other object can change it.
Some Examples
A very simple real life scenario is our college internet, which restricts few site access. The
proxy first checks the host you are connecting to, if it is not part of restricted site list, then it
connects to the real internet. This example is based on Protection proxies.
Interface of Internet
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 40
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
interface Internet
Benefits:
• One of the advantages of Proxy pattern is security.
• This pattern avoids duplication of objects which might be huge size and memory intensive.
This in turn increases the performance of the application.
• The remote proxy also ensures about security by installing the local code proxy (stub) in
the client machine and then accessing the server with help of the remote code.
Drawbacks/Consequences:
This pattern introduces another layer of abstraction which sometimes may be an issue if the
RealSubject code is accessed by some of the clients directly and some of them might access the
Proxy classes. This might cause disparate behaviour.
FAÇADE:
The facade pattern (also spelled façade) is a software-design pattern commonly used in object-
oriented programming. Analogous to a facade in architecture, a facade is an object that serves as a
front-facing interface masking more complex underlying or structural code.
Facade is a part of the Gang of Four design patterns and it is categorized under Structural
design patterns. Before we dig into the details of it, let us discuss some examples which will be
solved by this particular Pattern. So, As the name suggests, it means the face of the building.
The people walking past the road can only see the glass face of the building. They do not know
anything about it, the wiring, the pipes, and other complexities. It hides all the complexities of the
building and displays a friendly face.
More examples
In Java, the interface JDBC can be called a facade because we as users or clients create
connections using the “java.sql.Connection” interface, the implementation of which we are not
concerned about.
The implementation is left to the vendor of the driver. Another good example can be the startup
of a computer. When a computer starts up, it involves the work of CPU, memory, hard drive, etc.
To make it easy to use for users, we can add a facade that wraps the complexity of the task,
and provide one simple interface instead. The same goes for the Facade Design Pattern. It hides
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 41
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
the complexities of the system and provides an interface to the client from where the client can access
the system.
1. Facade is a structural design pattern with the intent to provide a simplified (but limited)
interface to a complex system of classes, library or framework.
2. A Facade class can often be transformed into a Singleton since a single facade object is
sufficient in most cases.
4. The Facade class will not encapsulate subclasses but will provide a simple
interface to their functions.
5. Classes in the subsystem will still be available to the client. However, Facade will
decouple client and subsystems so that they can change independently.
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 42
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
7. Facade can be recognized in a class that has a simple interface, but delegates most of
the work to other classes.
8. Usually, facades manage the full life cycle of objects they use.
9. Client is shielded from the unwanted complexities of the subsystems and gets only to
a fraction of a subsystem’s capabilities.
10. Abstract Factory can serve as an alternative to Facade when you only want to hide the
way the subsystem objects are created from the client code.
Usage:
1. Use the Facade pattern when you need to have a limited but straightforward
interface to a complex subsystem.
2. Use the Facade when you want to structure a subsystem into layers.
Related Patterns:
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 43
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
1.6.
ARCHITECTURAL STYLES
Introduction:
The software needs the architectural design to represents the design of software. IEEE
defines architectural design as “the process of defining a collection of hardware and software
components and their interfaces to establish the framework for the development of a
computersystem.” The software that is built for computer-based systems can exhibit one of these
many architectural styles.
Each style will describe a system category that consists of :
• A data store will reside at the center of this architecture and is accessed
frequently by theother components that update, add, delete or modify the data present within the
store.
• The figure illustrates a typical data centered style. The client software access a central
repository. Variation of this approach are used to transform the repository into a blackboardwhen
data related to client or data of interest for the client change the notifications to client software.
• This data-centered architecture will promote integrability. This means that the existing
components can be changed and new client components can be added to the architecturewithout
the permission or concern of other clients.
• Data can be passed among clients using blackboard mechanism.
Advantage of Data centered architecture
• Repository of data is independent of clients
• Client work independent of each other
• It may be simple to add additional clients.
• Modification can be very easy
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 44
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
• This kind of architecture is used when input data is transformed into output data
through aseries of computational manipulative components.
• The figure represents pipe-and-filter architecture since it uses both pipe and filter and it
hasa set of components called filters connected by lines.
• Pipes are used to transmitting data from one component to the next.
• Each filter will work independently and is designed to take data input of a certain form
andproduces data output to the next filter of a specified form. The filters don’t require any
knowledge of the working of neighboring filters.
• If the data flow degenerates into a single line of transforms, then it is termed as batch
sequential. This structure accepts the batch of data and then applies a series of sequential
components to transform it.
Advantages of Data Flow architecture
• It encourages upkeep, repurposing, and modification.
• With this design, concurrent execution is supported.
The disadvantage of Data Flow architecture
• It frequently degenerates to batch sequential system
• Data flow architecture does not allow applications that require greater user
engagement.
• It is not easy to coordinate two different but related streams
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 45
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
3] Call and Return architectures: It is used to create a program that is easy to scale and
modify. Many sub-styles exist within this category. Two of them are explained below.
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 46
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
4] Object Oriented architecture: The components of a system encapsulate data and the
operations that must be applied to manipulate the data. The coordination and communication
between the components are established via the message passing.
Characteristics of Object Oriented architecture
• Object protect the system’s integrity.
• An object is unaware of the depiction of other items.
Advantage of Object Oriented architecture
• It enables the designer to separate a challenge into a collection of autonomous objects.
• Other objects are aware of the implementation details of the object, allowing changes
to bemade without having an impact on other objects.
5] Layered architecture:
• A number of different layers are defined with each layer performing a well-defined set
of operations. Each layer will do some operations that becomes closer to machine instructionset
progressively.
• At the outer layer, components will receive the user interface operations and at the
innerlayers, components will perform the operating system interfacing(communication and
coordination with OS)
• Intermediate layers to utility services and application software functions.
• One common example of this architectural style is OSI-ISO (Open Systems
Interconnection-International Organisation for Standardisation) communication system.
Layered architecture:
The most common architecture pattern is the layered architecture pattern, otherwise
known as the n-tier architecture pattern. This pattern is the de facto standard for most Java EE
applications and therefore is widely known by mostarchitects, designers, and developers.
The layered architecture pattern closely matches the traditional IT communication and
organizational structures found in most companies, making it a natural choice for most business
application development efforts.
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 47
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 48
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
Pattern Description
• Within the application, each layer of the layered architecture pattern is responsible for
a particular task.
• For instance, the user interface and browser communication logic would be
handled by the presentation layer, whilst the business layer would be in charge of carrying
out the specific business rules related to the request.
• Each layer of the architecture creates an abstraction around the work required tocomplete
a specific business requirement.
• For instance, the presentation layer just needs to display customer data on a screen
in a specific way; it is not required to understand or worry about how to obtain customer
data.
• The business layer only needs to obtain the data from the persistence layer, apply
business logic to the data (e.g., calculate values or aggregate data), and then pass that information
up to the presentation layer.
• In a similar manner, the business layer need not worry about how to format
customer data for display on a screen or even where the customer data is coming from.
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 49
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
CLIENT-SERVER MODEL
The Client-server model is a distributed application structure that partitions task or workload
between the providers of a resource or service, called servers, and service requesters called
clients. In the client-server architecture, when the client computer sends a request for data tothe
server through the internet, the server accepts the requested process and deliver the data
packets requested back to the client.
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 50
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBJECT ORIENTED SOFTWARE ENGINEERING
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 51
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBVJECT ORIENTED SOFTWARE ENGINEERING
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 52
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBVJECT ORIENTED SOFTWARE ENGINEERING
Pipe and Filter is a simple architectural style that connects a number of components that
process a stream of data, each connected to the next component in the processing pipeline via a
Pipe.
The Pipe and Filter architecture is inspired by the Unix technique of connecting the output of
an application to the input of another via pipes on the shell.
The pipe and filter architecture consists of one or more data sources. The data source is
connected to data filters via pipes. Filters process the data they receive, passing them to other filters
in the pipeline. The final data is received at a Data Sink:
Definition
Pipe and Filter is another architectural pattern, which has independent entities called filters
(components) which perform transformations on data and process the input they receive, and pipes,
which serve as connectors for the stream of data being transformed, each connected to the next
component in the pipeline.
Many systems are required to transform streams of discrete data items, from input to output.
Many types of transformations occur repeatedly in practice, and so it isdesirable to create these as
independent, reusable parts, Filters. (Len Bass, 2012)
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 53
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBVJECT ORIENTED SOFTWARE ENGINEERING
transformations of streams of data. As you can see in the diagram, the data flows in one
direction. It starts at a data source, arrives at a filter’s input port(s) whereprocessing is done at the
component, and then, is passed via its output port(s) through a pipe to the next filter, and then
eventually ends at the data target.
A single filter can consume data from, or produce data to, one or more ports. They can also
run concurrently and are not dependent. The output of one filter is the input of another, hence, the
order is very important.
A pipe has a single source for its input and a single target for its output. Itpreserves
the sequence of data items, and it does not alter the data passing through.
· Filters can be treated as black boxes. Users of the system don’t need to know the
logic behind the working of each filter.
· Re-usability. Each filter can be called and used over and over again.
However, there are a few drawbacks to this architecture and are discussed below:
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 54
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBVJECT ORIENTED SOFTWARE ENGINEERING
The architectural pattern is very popular and used in many systems, such as the text- based
utilities in the UNIX operating system. Whenever different data sets need to be manipulated in
different ways, you should consider using the pipe and filter architecture. More specific
implementations are discussed below:
1. Compilers:
The front-end is responsible for parsing the input language and performing syntax and semantic
and then transforms it into an intermediate language. The middle- end takes the intermediate
representation and usually performs several optimization steps on it, the resulting transformed
program in is passed to the back-end which transforms it into language B.
Each level consists of several steps as well, and everything together forms thepipeline of
the compiler.
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 55
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBVJECT ORIENTED SOFTWARE ENGINEERING
The user interface is the front-end application view to which the user interacts touse the
software. The software becomes more popular if its user interface is:
1. Attractive
2. Simple to use
3. Responsive in a short time
4. Clear to understand
5. Consistent on all interface screensTypes of User Interface
1. Command Line Interface: The Command Line Interface provides a command prompt,
where the user types the command and feeds it to the system. The user needs to remember the syntax
of the command and its use.
2. Graphical User Interface: Graphical User Interface provides a simple interactive
interface to interact with the system. GUI can be a combination of both hardware and software.
Using GUI, the user interprets the software.
User Interface Design Process
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 56
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBVJECT ORIENTED SOFTWARE ENGINEERING
The analysis and design process of a user interface is iterative and can be represented by a
spiral model. The analysis and design process of user interface consists of four framework activities.
1. User, Task, Environmental Analysis, and Modeling
Initially, the focus is based on the profile of users who will interact with the system, i.e.,
understanding, skill and knowledge, type of user, etc., based on the user’s profile users are made
into categories. From each category requirements are gathered. Based on the requirement’s
developer understand how to develop the interface. Once all the requirements are gathered a detailed
analysis is conducted. In the analysis part, the tasks that the user performs to establish the goals of
the system are identified, described and elaborated. The analysis of the user environment focuses
on the physical work environment. Among the questions to be asked are:
1. Where will the interface be located physically?
2. Will the user be sitting, standing, or performing other tasks unrelated to theinterface?
3. Does the interface hardware accommodate space, light, or noise constraints?
4. Are there special human factors considerations driven by environmental factors?
2. Interface Design
The goal of this phase is to define the set of interface objects and actions i.e., control
mechanisms that enable the user to perform desired tasks. Indicate how these control mechanisms
affect the system. Specify the action sequence of tasks and subtasks, also called a user scenario.
Indicate the state of the system when the user performs a particular task. Always follow the three
golden rules stated by Theo Mandel. Design issues such as response time, command and action
structure, error handling, and help facilities are considered as the design model is refined. This phase
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 57
lOMoARcPSD|45374298
www.Poriyaan.in
CCS356-OBVJECT ORIENTED SOFTWARE ENGINEERING
https://play.google.com/store/apps/details?id=com.poriyaan.poriyaan 58
Civil
CSE
Home Mech
e
EEE
ECE
Physics
Basic for Engineering
Electrical and Data Structure
Problem Solving and Science Engineering
Electronics
Python Programming Object Oriented
Programming in C
Programming
Elective-Management
Professional Elective II
Professional Elective IV