0% found this document useful (0 votes)
6 views

chap_1_introduction_to_software_components_and_design_patterns

this is helpful for software component and design pattern
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

chap_1_introduction_to_software_components_and_design_patterns

this is helpful for software component and design pattern
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 57

Software component

design
Chapter one

Introduction to software
components and design
patterns

27/01/2025 Introduction to software componen 1


ts and design patterns
Introduction to software
components and design patterns
 Objectives
o Describe software components, examples of
software components
o Describe CBSD and its pros and cons
o Describe design patterns, its pros and cons,
classification of design patterns.
o Determine when to use design patterns and
what are not design patterns
o Design principles
o Elements of design patterns
o How to select design patterns

27/01/2025 Introduction to software componen 2


ts and design patterns
Introduction to software
components
 Software
o is a set of instructions, data or programs used
to operate computers and execute specific
tasks.
 Software Component - is part of system or
application.
o an executable unit of code that provides a set
of services through specified interfaces
o Each Component hide the complexity of its
implementation behind an interface.
o It reduces the complexity of software
development, maintenance, operation and
support and Introduction
27/01/2025 allow the same
to software
ts and design patterns
code to be reuse in3
componen
Introduction to software
components…
 Examples of software components
o View
o Model
o Controller
o Service
o API
o Plugin

27/01/2025 Introduction to software componen 4


ts and design patterns
Introduction to software component
design…
 Characteristics of software components
o Standardized
• Conform to some standard component model
o Independent
• Possible to compose and deploy without other
specific components
o Composable
• All external interactions must takes place through
interfaces
o Deployable
• Does not be compiled before it is deployed
o Documented - Fully documented about their features
27/01/2025 Introduction to software componen 5
ts and design patterns
Introduction to software component
design…
 Component model
o defines specific interaction and composition
standards.
o Examples
• EJB model, COM+(.NET model), CORBA,
o Elements of component model
• Interfaces, usage information, deployment and use
 Component model operates on two levels
o It defines how to construct an individual component.
o can enforce global behavior on how a set of
components in a component-based system will
communicate and interact with each other.

27/01/2025 Introduction to software componen 6


ts and design patterns
Introduction to software component
design…
 OMG/CORBA (object modeling group) - provides services
that enables reusable components/objects to
communicate with each other, regardless of their location
within a system.
 JavaBeans – a portable, platform independent CBSE
infrastructure developed using java.
 MS COM (component object modeling)– provides a
specification for using components produced by various
vendors within a single application running under the
windows OS.
 Encompasses two elements
o COM interfaces(implemented as COM objects)
o A set of mechanisms for registering and passing messages
between COM interfaces

27/01/2025 Introduction to software componen 7


ts and design patterns
Introduction to software component
design…
 A component model implementation
o It is the dedicated set of executable software
elements required to support the execution of
components that conform to the model.
 A software component infrastructure
o a set of interacting software components
designed to ensure that a software system or
subsystem constructed using those components
and interfaces will satisfy clearly defined
performance specification.
o Basic framework to construct, assemble, and
deployement components
27/01/2025 Introduction to software componen 8
ts and design patterns
Introduction to software component
design…
Component based software engineering
 It is the idea of building software systems from
established software components.
o Not building software systems from the ground
up.
 It is the process of the design and construction of
computer based systems using reusable
components.
 Components interact through well defined
interfaces.

27/01/2025 Introduction to software componen 9


ts and design patterns
Introduction to software component
design…
Apart from CBSE reuse benefits, it is based on
SE design principles
 Components are independent
o Don’t interfere each other
 Component implementations are hidden
 Communication is through well defined interfaces
 Component platforms are shared and reduces
development cost.

27/01/2025 Introduction to software componen 10


ts and design patterns
Introduction to software component
design…
Dis Advantages of
Advantages of CBSE CBSE
 Reduced cost and  Development of
schedule components
 Customization and  Quality of components
flexibility is questionable
 Scalability  Components
 Increased maintenance costs
maintainability  Sensitive to changes
 Enhanced quality
 Easy of assembly
 Reusability
27/01/2025 Introduction to software componen 11
ts and design patterns
Introduction to software component
design…
 Features of CBSE
o Coupling - inter-relatedness among
components
• Low coupling is desired.
o Cohesion - strength of association among
elements within a component
• High cohesion is desired.
o Complexity - the number and size of
components

27/01/2025 Introduction to software componen 12


ts and design patterns
Introduction to software component
design…
 Problems of CBSE
o Component trustworthiness
• No available source code
o Component certification
• Quality issue
o Emergent property prediction
• Emergent properties of components composition
o Requirements trade-offs
• Trade-offs analysis between the feature of
components

27/01/2025 Introduction to software componen 13


ts and design patterns
Introduction to software component
design
 Design is about how the internal components of the
system interact with each other.
 A complete set of software components is defined
during architectural design.
o But the internal data structures and processing
details of each component are not represented at a
level of abstraction that is close to code.
 Component-level design defines the data
structures, algorithms, interface characteristics, and
communication mechanisms allocated to each
component.
o is the definition and design of components and
modules after the architectural design phase.
27/01/2025 Introduction to software componen 14
ts and design patterns
Software design
concepts
 Software design
o is the process of envisioning and defining software solutions
o is a process to transform user requirements into some
suitable form, which helps the programmer in software coding
and implementation.
o One of the main components is software requirements
analysis (SRA).
 SRA is a part of the software development process that lists
specifications used in software engineering.
 For assessing user requirements, an SRS (Software
Requirement Specification) document is created
 For coding and implementation, there is a need of more
specific and detailed requirements in software terms.
 Software design is the first step in SDLC which moves the
concentration from problem domain to solution domain.
27/01/2025 Introduction to software componen 15
ts and design patterns
Software design levels
 Architectural Design
o is the highest abstract version of the system.
 High-level Design
o breaks the ‘single entity-multiple component’
concept of architectural design into less-abstracted
view of sub-systems and modules and depicts their
interaction with each other.
o It focuses on how the system along with all of its
components can be implemented in forms of
modules.
 Detailed Design
o deals with the implementation part of what is seen
as a system and its sub-systems in the previous
two designs.
o It defines logical structure of each module and their
27/01/2025 Introduction to software componen 16
interfaces to communicate with other modules.
ts and design patterns
Software architecture
Vs. design
 Software Architecture - is more about what want
the system to do
o focuses more on the interaction between the
externally visible components of the system
o is at a higher level of abstraction than the Software
Design.
o focus on the abstract view of idea and it pictures
the abstract view of the whole system
 Software Design - is about how we want to achieve
that.
o is about how the internal components of the system
interact with each other.
o focus on the implementation view of idea and
much more detailed than architecture.
o pictures the implementation of some specific
27/01/2025 Introduction to software componen 17
concerned domain.
ts and design patterns
Introduction to design patterns
 What is pattern?
o a repeated decorative design
o is an arrangement of lines or shapes,
especially a design in which the same shape is
repeated at regular intervals over a surface.
o is a way of doing something, or a way of
pursuing an intent.
o It is also a recurring solution to a standard
problem, in a context.

27/01/2025 Introduction to software componen 18


ts and design patterns
Introduction to design patterns…
 Patterns in engineering ? How do other engineers find
and use patterns?
o Mature engineering disciplines have handbooks
describing successful solutions to known problems
o Automobile designers don't design cars from scratch
using the laws of physics
o Instead, they reuse standard designs with successful
track records, learning from experience
o Should software engineers make use of patterns? Why?
o “Be sure that you make everything according to the
pattern
Developing software from scratch is also expensive
o Patterns support reuse of software architecture and
design

27/01/2025 Introduction to software componen 19


ts and design patterns
Introduction to software design
patterns
 “A pattern describes a problem which occurs over and over again in
our environment, and then describes the core of the solution to that
problem, in such a way that you can use this solution a million times
over, without ever doing it the same way twice.”(Christopher Al-
exander)
 Even though Alexander was talking about patterns in buildings and
towns, what he says is true about object-oriented design patterns.
 Our solutions are expressed in terms of objects and interfaces in-
stead of walls and doors.
27/01/2025 Introduction to software componen 20
ts and design patterns
Introduction to software design
patterns…
 Software patterns vs algorithms
o The pattern is not a specific piece of code, but a general
concept for solving a particular problem.
o Patterns are often confused with algorithms, because
both concepts describe typical solutions to some known
problems.
o While an algorithm always defines a clear set of actions
that can achieve specific goal, a pattern is a more high-
level description of a solution.
o Algorithms and data structures generally solve more
computational problems like sorting and searching.
o Patterns are typically concerned with broader
architectural issues that have larger-scale effects.

27/01/2025 Introduction to software componen 21


ts and design patterns
Introduction to software design
patterns…
Software patterns, architectures and frame-
works.
 Architectures model software structure at the
highest possible level, and give the overall sys-
tem view.
o Can use many different patterns in different
components
 Patterns are more like small-scale or local archi-
tectures for architectural components or sub-
components
 Frameworks are partially completed software
systems that may be targeted at a particular type
of application.
o These are tailored
27/01/2025 Introduction by completing
to software componen the unfin- 22
ts and design patterns
Introduction to software design
patterns…
Software patterns, architectures and frame-
works…
 Patterns are more general and abstract than
frameworks
o It is a description of a solution, not a solution
itself.
o Cannot be directly implemented. An imple-
mentation is an example of a pattern.
o Are more primitive than frameworks.
o A framework can employ several patterns.

27/01/2025 Introduction to software componen 23


ts and design patterns
Elements of software
design patterns
 Pattern name: is used to provide a single and
meaningful name to the pattern which defines a
design problem and a solution for it.
o meaningful text that reflects the problem, e.g.

Bridge, Mediator, Flyweight.


 This allows us to use a single word or short phrase
to refer to the pattern, and the knowledge and
structure it describes.
 Good pattern names form a vocabulary for
discussing conceptual abstractions.
 Sometimes a pattern may have more than one
commonly used or recognizable name.
27/01/2025 Introduction to software componen 24
ts and design patterns
Elements of software
design patterns…
 Problem: describes when to apply the
pattern.
 It explains the problem and its context.
 It might describe specific design problems
such as how to represent algorithms as
objects.
 It might describe a class or object structures that
are symptomatic of an inflexible design.
 Sometimes the problem will include a list of
conditions that must be met before it makes
sense to apply the pattern.

27/01/2025 Introduction to software componen 25


ts and design patterns
Elements of software
design patterns…
 Solution: describes the elements that make up
the design, their relationships,
responsibilities, and collaborations.
 The solution is not the complete code, but it
works as a template which can be fulfilled with
code.
 Instead, the pattern provides an abstract
description of a design problem and how a
general arrangement of elements (classes
and objects in our case) solves it.

27/01/2025 Introduction to software componen 26


ts and design patterns
Benefits of software
design patterns
 Code reusability - By following a standard structure,
developers can easily reuse code in different parts of an
application or even in different applications altogether.
 Scalability - This makes it easier to add new features
or make changes to existing ones without disrupting the
overall architecture of the application.
 Maintainability - This makes it easier for developers to
understand code written by others and to maintain it
over time.
 Reduced errors - can avoid common errors and pitfalls
that might arise when writing code from scratch.
 Performance - This can result in more efficient code
that executes faster and uses fewer resources.

27/01/2025 Introduction to software componen 27


ts and design patterns
Benefits of software
design patterns…
Pattern solves software Pattern solves non-
structural problems functional problems
 Abstraction,  Changeability
 Encapsulation  Interoperability
 Information hiding  Efficiency
 Separation of concerns  Reliability
 Coupling and cohesion
 Separation of interface
 Testability
and implementation  Reusability
 Single point of refer-
ence
 Divide and conquer

27/01/2025 Introduction to software componen 28


ts and design patterns
Drawbacks of design patterns
 Patterns are not solutions to new problems, they
are solutions to established and studied problems
that crop up again and again in object-oriented
systems
 Patterns are not specific to any code, language,
or implementation, they describe general
solutions.
 Patterns are validated by experience and
disturbance rather than by automated testing.
 Integrating patterns into a software development
process is a human-intensive activity.
 Patterns do not lead to direct code reuse

Patterns are deceptively


27/01/2025 simple
Introduction to software
ts and design patterns
componen 29
Software design
patterns are
Software design patterns are
 Recurring solutions to common problems of design
 Practical/concrete solutions to real world problems
 "Best-fits" for the given set of concerns/trade-offs
 A literary form for documenting best practices
 A shared vocabulary for problem-solving discussions
 An effective means of (re)using, sharing, and building
upon existing wisdom/experience/expertise

27/01/2025 Introduction to software componen 30


ts and design patterns
Software design
patterns are not
Design patterns are not
 Restricted to software design or Object-Oriented
design
 Untested ideas/theories or new inventions
 Solutions that have worked only once
 Any old thing written-up in pattern format
 Universally applicable for all contexts
 A "silver bullet" or panacea

27/01/2025 Introduction to software componen 31


ts and design patterns
Classification of software patterns

1. An architectural patterns
 It expresses a fundamental structural
organization schema for software systems.
 It provides a set of predefined subsystems,
specifies their responsibilities, and includes
rules and guidelines for organizing the
relationships between them.
 Are templates for concrete software
architectures.
 It provides a structure for interactive software
systems.
 Have elements of name, problem and solutions

27/01/2025 Introduction to software componen 32


ts and design patterns
Classification of software patterns…

2. Design patterns
 It provides a scheme for refining the subsystems
or components of a software system, or the
relationships between them.
 It describes a common recurring structure of
communicating components that solves a general
design problem.
 Design patterns are medium-scale patterns.
 They are smaller in scale than architectural
patterns, but tend to be independent of a
particular programming language or
programming paradigm.
27/01/2025 Introduction to software componen 33
ts and design patterns
Classification of software patterns…

3. Programing patterns (Idioms)


 Deal with the implementation of particular design
issues.
 An idiom is a low-level pattern specific to a
programming language.
 An idiom describes how to implement particular
aspects of
components or the relationships between them
using the features of the given language.
 Idioms represent the lowest-level patterns.
 They address aspects of both design and
implementation.
27/01/2025 Introduction to software componen 34
ts and design patterns
Software design
patterns
 A standard solution to a common programming
problem
• a design or implementation structure that achieves a
particular purpose
• a high-level programming idiom
 A technique for making code more flexible or efficient
• reduce coupling among program components
• reduce memory overhead
 Shorthand for describing program design
• a description of connections among program
components
• the shape of a heap snapshot or object model

27/01/2025 Introduction to software componen 35


ts and design patterns
Software design
patterns…
 It can also be seen as a template for how to solve
a problem that can occur in many different
situations and/or applications.
 It is not code reuse as it usually does not
specify code, but code can be easily created
from a design pattern.
 Object-oriented design patterns typically show
relationships and interactions between classes or
objects, without specifying the final application
classes or objects that are involved.

27/01/2025 Introduction to software componen 36


ts and design patterns
Describing a software
design patterns
 Name & Classification – Conveys the essence of the
pattern briefly.
 Intent – briefly describes both the problem and the
solution. It answer the following questions.
1. What does the design pattern do?
2. What is its rationale and intent?
3. What particular design issue or problem does it
address?
 Also Known As – Other well known names for this pattern
 Motivation – A scenario illustrating a design problem and
how its being solved by the pattern
 Applicability – Known situations where the pattern can
be applied. What are the situations in which the design
pattern can be applied? What are examples of poor designs
that the pattern can
27/01/2025 address?
Introduction How
to software can you recognize these37
componen
situations? ts and design patterns
Describing a software
design patterns…
 Structure – OMT (Object Modelling ) based graphic
representation of the classes in the pattern
 Participants – Classes and objects in the pattern with their
responsibilities
 Collaborations – How the participants collaborate to carry
out their responsibilities
 Consequences – What are the results and trade-offs
 Implementation – Hints on implementation of the pattern
like language dependency
 Sample Code – Sample code
 Known Uses – pattern found in real systems.
 Related Patterns – Other patterns closely related with the
pattern under consideration.

27/01/2025 Introduction to software componen 38


ts and design patterns
Software design
patterns are not
Software design patterns are not
 Data structures that can be encoded in classes and re-
used as is (i.e., linked lists, hash tables)
 Complex domain-specific designs
(for an entire application or subsystem)
 If they are not familiar data structures or complex do-
main-specific subsystems, what are they?
 They are:
o “Descriptions of communicating objects and classes
that are customized to solve a general design prob-
lem
in a particular context.”

27/01/2025 Introduction to software componen 39


ts and design patterns
Software design
patterns are not…
 The following are not design patterns
o Linked Lists
o Hash Tables
o Domain Specific designs for entire application
or subsystem
o A code solution ready for copy-and-paste
o Programming language features
o The same every time you see them

27/01/2025 Introduction to software componen 40


ts and design patterns
Why use design
patterns
 Design Objectives
- High readability
- High maintainability
- High extensibility
- High scalability
- High testability
- High reusability
- ….

27/01/2025 Introduction to software componen 41


ts and design patterns
Why use design
patterns
 .

27/01/2025 Introduction to software componen 42


ts and design patterns
Why you learn
software design
 patterns
They make it easier to reuse successful designs
and architectures
 They can make documentation and maintenance of
the systems easier
 Design Patterns help a designer design “right”
faster
 They provide a vocabulary that can be used
amongst software developers.
 Enable us to discuss low-level implementation in a
high-level, abstract manner.
 Help in extendibility and avoiding solution redesign

27/01/2025 Introduction to software componen 43


ts and design patterns
Steps of how design pattern solves
design problems
 Finding appropriate objects
o The hard part about OOD is decomposing a system
into objects
o They help to introduce an abstraction for treating
objects uniformly that doesn’t have a physical
counterpart
o They help to identify less obvious abstractions and
objects that can capture them
o These objects are seldom identified in a design
earlier and are discovered while making the design
reusable and more flexible
 Determining the object Granularity
o They help in specifying how to represent complete
subsystems as objects
o They help you in decomposing objects into smaller
27/01/2025 Introduction to software componen 44
objects ts and design patterns
Steps of how design pattern solves
design problems…
 Specifying Object Interfaces
o Help you in defining interfaces and the kinds of
data that get sent across them
o Might also tell what NOT to put into an interface
o Also specify relationships across interfaces
 Specifying object implementation
o An object's implementation is defined by its class.
o The class specifies the object's internal data and
representation and defines the operations the
object can perform.

27/01/2025 Introduction to software componen 45


ts and design patterns
Steps of how design pattern solves
design problems…
 Designing for Change
o Help you to avoid dependence on
specific operations
o Help you to avoid dependence on
hardware and software platforms
o Help to avoid algorithmic dependencies

27/01/2025 Introduction to software componen 46


ts and design patterns
Steps of how design pattern solves
design problems…
 5Identify Inheritance and Composition
o The two most common techniques for reusing
functionality in object-oriented systems are
class inheritance and object composition.
o Class inheritance lets you define the
implementation of one class in terms of
another's.
o Object composition is obtained by
assembling or composing objects to get more
complex functionality.
o Object composition requires that the objects
being composed have well-defined interfaces.
27/01/2025 Introduction to software componen 47
ts and design patterns
How to select a design patterns
 Approaches to finding the design pattern
that's right for your problem
o Consider how design patterns solve design
problems.
o Scan Intent sections.
o Study how patterns interrelate. shows
relationships
between design patterns graphically.
o Study patterns of like purpose
• Creational, structural or behavioural patterns
purpose
o Examine a cause of redesign - Consider what
should be variable
27/01/2025 insoftware
Introduction to your
ts and design patterns
design.
componen 48
How to use a design patterns
 Pay particular attention to the Applicability and
Consequences sections to ensure the pattern is right for
your problem.
 Go back and study the Structure, Participants, and
Collaborations sections.
 Make sure you understand the classes and objects in the
pattern and how they relate to one another.
 Look at the Sample Code section to see a concrete example
of the pattern in code. Studying the code helps you learn
how to implement the pattern.
 Choose names for pattern participants that are meaningful
in the application context.

27/01/2025 Introduction to software componen 49


ts and design patterns
How to use a design patterns…
 Define the classes - Declare their interfaces,
establish their inheritance relationships, and
define the instance variables that represent data
and object references. Identify existing classes in
your application that the pattern will affect, and
modify them accordingly.
 Define application-specific names for operations
in the pattern. Here again, the names generally
depend on the application.
 Implement the operations to carry out the
responsibilities and collaborations in the pattern.
The Implementation section offers hints to guide
you in the implementation.
27/01/2025 Introduction to software componen 50
ts and design patterns
Classification of software design
patterns

 History of design patterns (reading


assignment…)
 Based on GOF, the design, patterns can
be classified in two ways
o SCOPE Based Design Pattern

o PURPOSE Based Design Pattern

27/01/2025 Introduction to software componen 51


ts and design patterns
Classification of software design
patterns

SCOPE Based Design Pattern


 Class Patterns deals with the relationships
amongst the classes and their subclasses
o These relationships are established through
INHERITANCE, so they are static – fixed at
compile time
 Object Patterns deals with object relationships
which can be changed at runtime or are dynamic
o Note that most patterns are object patterns

27/01/2025 Introduction to software componen 52


ts and design patterns
Classification of software design
patterns

PURPOSE Based Design Pattern classification


 Creational Class patterns defer some part of
object creation to subclasses where as
creational object patterns defer it to another
object.
 Structural class patterns use inheritance to
compose classes, while structural object
patterns describe ways to assemble objects.
 Behavioral class patterns use inheritance to
describe algorithms and flow of control, whereas
the behavioral object patterns describe how a
group of objects cooperate to perform a task
27/01/2025 Introduction to software componen 53
ts and design patterns
Classification of software design
patterns

27/01/2025 Introduction to software componen 54


ts and design patterns
Summery
 Knowing the OO basics does not make you a good
OO designer.
 Good OO designs are reusable, extensible, and
maintainable.
 Patterns show you how to build systems with
good OO design qualities.
 Patterns are proven object-oriented experience.
 Patterns don’t give you code, they give you
general solutions to design problems.
 You apply them to your specific application.
 Patterns aren’t invented, they are discovered.

27/01/2025 Introduction to software componen 55


ts and design patterns
Summery…
 Most patterns and principles address issues of
change in software.
 Most patterns allow some part of a system to vary
independently of all other parts.
 We often try to take what varies in a system and
encapsulate it.
 Patterns provide a shared language that can
maximize the value of your communication with
other developers.

27/01/2025 Introduction to software componen 56


ts and design patterns
Introduction to software
components and design
patterns

Any
questions?
27/01/2025 Introduction to software componen 57
ts and design patterns

You might also like