CH-1 and 2
CH-1 and 2
Course code:-SWEG3093
Definitions
Program : is A set of statements used to instruct a Machine.
Software: Is basically set of programs along with Libraries,
Documentation and related aspect devised for some specific activity.
Software Engineering: Is an engineering discipline that is concerend with
all aspect of software production.
Definitions
Program : is A set of statements used to instruct a Machine.
Software: Is basically set of programs along with Libraries,
Documentation and related aspect devised for some specific activity.
Software Engineering: Is an engineering discipline that is concerend with
all aspect of software production.
Definitions
Program : is A set of statements used to instruct a Machine.
Software: Is basically set of programs along with Libraries,
Documentation and related aspect devised for some specific activity.
Software Engineering: Is an engineering discipline that is concerend with
all aspect of software production.
Definitions
Program : is A set of statements used to instruct a Machine.
Software: Is basically set of programs along with Libraries,
Documentation and related aspect devised for some specific activity.
Software Engineering: Is an engineering discipline that is concerend with
all aspect of software production.
Definitions
Program : is A set of statements used to instruct a Machine.
Software: Is basically set of programs along with Libraries,
Documentation and related aspect devised for some specific activity.
Software Engineering: Is an engineering discipline that is concerend with
all aspect of software production.
1 Build-and-Fix Model
There is NO specification or design attempt in this model.
The Engineers build the SW by reworking as many times as necessary to
satisfy customer.
Un-Satisfactory Model
Software Development Roadmap
1 Build-and-Fix Model
There is NO specification or design attempt in this model.
The Engineers build the SW by reworking as many times as necessary to
satisfy customer.
Un-Satisfactory Model
Software Development Roadmap...
2 Waterfall Model
The First published Model and classical model in SDLC
Widely used in government projects and in many major companies
Is Plan-Driven-Process - ??
Must be Planned and scheduled every process activities before moving to the
work
Two versions :
Pure Waterfall Model : There is Overlapping phases. starts @ System
Requirement → Analysis → Design → Implemenation → Maintenance → Retire
Modified Waterfall Model : Enables the phases to overlap when needed
2 Rapid Prototyping Model
Is a working model functionally equivalent to the subset of the products.
The first Step is to Rapid Prototype let the clients and users interact and
experiemetn with the prototype.
If the Client is OK → Specification is drawn
Software Development Roadmap...
2 Waterfall Model
The First published Model and classical model in SDLC
Widely used in government projects and in many major companies
Is Plan-Driven-Process - ??
Must be Planned and scheduled every process activities before moving to the
work
Two versions :
Pure Waterfall Model : There is Overlapping phases. starts @ System
Requirement → Analysis → Design → Implemenation → Maintenance → Retire
Modified Waterfall Model : Enables the phases to overlap when needed
2 Rapid Prototyping Model
Is a working model functionally equivalent to the subset of the products.
The first Step is to Rapid Prototype let the clients and users interact and
experiemetn with the prototype.
If the Client is OK → Specification is drawn
Software Development Roadmap...
2 Waterfall Model
The First published Model and classical model in SDLC
Widely used in government projects and in many major companies
Is Plan-Driven-Process - ??
Must be Planned and scheduled every process activities before moving to the
work
Two versions :
Pure Waterfall Model : There is Overlapping phases. starts @ System
Requirement → Analysis → Design → Implemenation → Maintenance → Retire
Modified Waterfall Model : Enables the phases to overlap when needed
2 Rapid Prototyping Model
Is a working model functionally equivalent to the subset of the products.
The first Step is to Rapid Prototype let the clients and users interact and
experiemetn with the prototype.
If the Client is OK → Specification is drawn
Software Development Roadmap...
Figure: Build-and-Fix
Figure: Rapid Protoyping
Model Figure: Waterfall Model
Model
Recall the issues on the other SDLC Model ....
Software Development Roadmap...
Figure: Build-and-Fix
Figure: Rapid Protoyping
Model Figure: Waterfall Model
Model
Recall the issues on the other SDLC Model ....
What is Object-Orientation ..
Is about viewing and modeling the system as a set of interacting and
interrelated objects.
Principles/features of Object-Orientation
Design model : Shows the object / object class in the system and their
relationship between them.
Two Type of deisgn model n OOD :
1 Static model : indicate the static structure of the system using object class
and their relationship.
2 Dynamic model : the dynamic structure of the system and show the
interaction between objects in the system.
What is Object-Orientation ..
Is about viewing and modeling the system as a set of interacting and
interrelated objects.
Principles/features of Object-Orientation
Design model : Shows the object / object class in the system and their
relationship between them.
Two Type of deisgn model n OOD :
1 Static model : indicate the static structure of the system using object class
and their relationship.
2 Dynamic model : the dynamic structure of the system and show the
interaction between objects in the system.
What is Object-Orientation ..
Is about viewing and modeling the system as a set of interacting and
interrelated objects.
Principles/features of Object-Orientation
Design model : Shows the object / object class in the system and their
relationship between them.
Two Type of deisgn model n OOD :
1 Static model : indicate the static structure of the system using object class
and their relationship.
2 Dynamic model : the dynamic structure of the system and show the
interaction between objects in the system.
Object-Oriented based Design (OOAD)
3 Dynamic Modeling
Determine the actions performed by or to each class or subclass.
Presented in the form of diagram Called State diagram
This step is Action-Oriented Step
For Example :- A product is to be installed to control n elevetors in a building
with m floors. The problem concerns the logic required to move elevetors
between floors according to ff constriants.
1 Each elevetors has setof m buttons one for each floor. These illumnate
when pressed and cause the elevetor to visit the corresponding floor. The
illumination cancelled when the corresponding floor is visited by elevator.
2 Each floor, except the ist floor and the top floor has 2 buttons,One to
request ↑ and other to request ↓
3 When an elevator has no requests,it remains at its current floor with its
doors closed.
Object-Oriented based analysis and Design (OOAD)...
Use-Case Diagram : What ddo you think is the interaction b/n user and
elevator ?
User Press button to get the elevator
User press floor button to request the elevator to stop at specific floor
Independent
Should be self-contaied possibly be composed and
deployed without requiring other specific component.
Composable
Must able be integrated, All external interaction must
happen via Publicly defined interfaces
Deployable
Self-contained and able to operate as stand-alone
entityon component platform provides implementaion
of the component model.
Documented
Must be fully documented so potential users can
decide whether or not the components meet their
needs.
X-tistics of Components
Independent
Should be self-contaied possibly be composed and
deployed without requiring other specific component.
Composable
Must able be integrated, All external interaction must
happen via Publicly defined interfaces
Deployable
Self-contained and able to operate as stand-alone
entityon component platform provides implementaion
of the component model.
Documented
Must be fully documented so potential users can
decide whether or not the components meet their
needs.
X-tistics of Components
Independent
Should be self-contaied possibly be composed and
deployed without requiring other specific component.
Composable
Must able be integrated, All external interaction must
happen via Publicly defined interfaces
Deployable
Self-contained and able to operate as stand-alone
entityon component platform provides implementaion
of the component model.
Documented
Must be fully documented so potential users can
decide whether or not the components meet their
needs.
X-tistics of Components
Independent
Should be self-contaied possibly be composed and
deployed without requiring other specific component.
Composable
Must able be integrated, All external interaction must
happen via Publicly defined interfaces
Deployable
Self-contained and able to operate as stand-alone
entityon component platform provides implementaion
of the component model.
Documented
Must be fully documented so potential users can
decide whether or not the components meet their
needs.
X-tistics of Components
Independent
Should be self-contaied possibly be composed and
deployed without requiring other specific component.
Composable
Must able be integrated, All external interaction must
happen via Publicly defined interfaces
Deployable
Self-contained and able to operate as stand-alone
entityon component platform provides implementaion
of the component model.
Documented
Must be fully documented so potential users can
decide whether or not the components meet their
needs.
X-tistics of Components
Independent
Should be self-contaied possibly be composed and
deployed without requiring other specific component.
Composable
Must able be integrated, All external interaction must
happen via Publicly defined interfaces
Deployable
Self-contained and able to operate as stand-alone
entityon component platform provides implementaion
of the component model.
Documented
Must be fully documented so potential users can
decide whether or not the components meet their
needs.
Component Based Engineering
1 Provides Interface :
Defines the services offered or given by the components.
Basically defines Methods invoked by other components.
In UML Component Diagram represented by circle
2 Requires Interface
Specifies What services must be provided by other components in the
system for proper operation.
Has Methods.
In UML Component Diagram represented by semi-circle/arc
1 Provides Interface :
Defines the services offered or given by the components.
Basically defines Methods invoked by other components.
In UML Component Diagram represented by circle
2 Requires Interface
Specifies What services must be provided by other components in the
system for proper operation.
Has Methods.
In UML Component Diagram represented by semi-circle/arc
1 Provides Interface :
Defines the services offered or given by the components.
Basically defines Methods invoked by other components.
In UML Component Diagram represented by circle
2 Requires Interface
Specifies What services must be provided by other components in the
system for proper operation.
Has Methods.
In UML Component Diagram represented by semi-circle/arc
1 Interfaces
Used to define components of systems.
CM specifies elements (i.e. Operation names, parameters and exception
logics) of interfaces and how they are defined.
Theoretically, CM also defines the programming language used to define
interfaces.
Specific interfaces defined by the components for composing component
infrastructure. (provides for security and managment purpose)
2 Component Usage
Components must have Unique name: coz might be distributed and
remotely accessed.
Component Meta-data is a data about the components itself. (information
about its interfaces and attributes)
3 Deployement and Use
The CM also defines specification of how components should be packaged
for deployement as independents as wel as executable entities.
Evolution Support: as the requirement changes components will have to to
be changed and replaced.
Component Models (CM)
1 Interfaces
Used to define components of systems.
CM specifies elements (i.e. Operation names, parameters and exception
logics) of interfaces and how they are defined.
Theoretically, CM also defines the programming language used to define
interfaces.
Specific interfaces defined by the components for composing component
infrastructure. (provides for security and managment purpose)
2 Component Usage
Components must have Unique name: coz might be distributed and
remotely accessed.
Component Meta-data is a data about the components itself. (information
about its interfaces and attributes)
3 Deployement and Use
The CM also defines specification of how components should be packaged
for deployement as independents as wel as executable entities.
Evolution Support: as the requirement changes components will have to to
be changed and replaced.
Component Models (CM)
1 Interfaces
Used to define components of systems.
CM specifies elements (i.e. Operation names, parameters and exception
logics) of interfaces and how they are defined.
Theoretically, CM also defines the programming language used to define
interfaces.
Specific interfaces defined by the components for composing component
infrastructure. (provides for security and managment purpose)
2 Component Usage
Components must have Unique name: coz might be distributed and
remotely accessed.
Component Meta-data is a data about the components itself. (information
about its interfaces and attributes)
3 Deployement and Use
The CM also defines specification of how components should be packaged
for deployement as independents as wel as executable entities.
Evolution Support: as the requirement changes components will have to to
be changed and replaced.
Component Models (CM)
Component Composition
is a process/ mechanics of integrating various components with each other
and with specially written glue code for creating system as well as another
components.
Three Flavours:
1 Sequential composition
2 Hierarchical composition
3 Additive composition
1 Sequential composition
is a way of building distnict/new component from two existing components
by calling them sequentially. (Provides interface)
2 Hierarchical composition
Occurs when One component calls directly on the services provided by
another component.
So that the invoked component provides services invoking component.
3 Additive composition
is Combination of two or more components to build new component based
on their functionality.
Component Composition
Component Composition
is a process/ mechanics of integrating various components with each other
and with specially written glue code for creating system as well as another
components.
Three Flavours:
1 Sequential composition
2 Hierarchical composition
3 Additive composition
1 Sequential composition
is a way of building distnict/new component from two existing components
by calling them sequentially. (Provides interface)
2 Hierarchical composition
Occurs when One component calls directly on the services provided by
another component.
So that the invoked component provides services invoking component.
3 Additive composition
is Combination of two or more components to build new component based
on their functionality.
Component Composition
Component Composition
is a process/ mechanics of integrating various components with each other
and with specially written glue code for creating system as well as another
components.
Three Flavours:
1 Sequential composition
2 Hierarchical composition
3 Additive composition
1 Sequential composition
is a way of building distnict/new component from two existing components
by calling them sequentially. (Provides interface)
2 Hierarchical composition
Occurs when One component calls directly on the services provided by
another component.
So that the invoked component provides services invoking component.
3 Additive composition
is Combination of two or more components to build new component based
on their functionality.
Component Models (CM)
Sequential composition
Hierarchical composition
Additive composition
Component Models (CM)
Possibly to use all type of composition But we need ”Glue code” that links
the components.
When Components are are developed independently for reuse :
Incompatability might occur :- Interfaces of the component needs to be
composed might not be the same.
Three type of Incompatability :
1 Parameter Incompatability
Having the same interface name but d/t in parameter number, type
2 Operation Incompatability
The difference of operation in Both interfaces
3 Operation Incompatability
The Provides interface of the component is subset of requires interface of
another component and vice versa
So what is the solution for incompatability ????: ”Adaptors”
Component Models (CM)
Possibly to use all type of composition But we need ”Glue code” that links
the components.
When Components are are developed independently for reuse :
Incompatability might occur :- Interfaces of the component needs to be
composed might not be the same.
Three type of Incompatability :
1 Parameter Incompatability
Having the same interface name but d/t in parameter number, type
2 Operation Incompatability
The difference of operation in Both interfaces
3 Operation Incompatability
The Provides interface of the component is subset of requires interface of
another component and vice versa
So what is the solution for incompatability ????: ”Adaptors”
Component Models (CM)
Possibly to use all type of composition But we need ”Glue code” that links
the components.
When Components are are developed independently for reuse :
Incompatability might occur :- Interfaces of the component needs to be
composed might not be the same.
Three type of Incompatability :
1 Parameter Incompatability
Having the same interface name but d/t in parameter number, type
2 Operation Incompatability
The difference of operation in Both interfaces
3 Operation Incompatability
The Provides interface of the component is subset of requires interface of
another component and vice versa
So what is the solution for incompatability ????: ”Adaptors”
Component Models (CM)
Possibly to use all type of composition But we need ”Glue code” that links
the components.
When Components are are developed independently for reuse :
Incompatability might occur :- Interfaces of the component needs to be
composed might not be the same.
Three type of Incompatability :
1 Parameter Incompatability
Having the same interface name but d/t in parameter number, type
2 Operation Incompatability
The difference of operation in Both interfaces
3 Operation Incompatability
The Provides interface of the component is subset of requires interface of
another component and vice versa
So what is the solution for incompatability ????: ”Adaptors”
Component Models (CM)
Defination
Design pattern is a general repeatable solution to a
commonly occurring problem in software design.
What is Design A design pattern is not a finished design that can be
Patterns In transformed directly into code.
Software It is a description or template for how to solve a problem
that can be used in many different situations.
Engineering?
Christopher Alexander
”A design pattern describes a problem that 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
the solution over and over again a million ways, without ever
doing it the same way twice.”
Overiew of Design patterns
Defination
Design pattern is a general repeatable solution to a
commonly occurring problem in software design.
What is Design A design pattern is not a finished design that can be
Patterns In transformed directly into code.
Software It is a description or template for how to solve a problem
that can be used in many different situations.
Engineering?
Christopher Alexander
”A design pattern describes a problem that 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
the solution over and over again a million ways, without ever
doing it the same way twice.”
Overiew of Design patterns
Defination
Design pattern is a general repeatable solution to a
commonly occurring problem in software design.
What is Design A design pattern is not a finished design that can be
Patterns In transformed directly into code.
Software It is a description or template for how to solve a problem
that can be used in many different situations.
Engineering?
Christopher Alexander
”A design pattern describes a problem that 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
the solution over and over again a million ways, without ever
doing it the same way twice.”
Overiew of Design patterns
Defination
Design pattern is a general repeatable solution to a
commonly occurring problem in software design.
What is Design A design pattern is not a finished design that can be
Patterns In transformed directly into code.
Software It is a description or template for how to solve a problem
that can be used in many different situations.
Engineering?
Christopher Alexander
”A design pattern describes a problem that 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
the solution over and over again a million ways, without ever
doing it the same way twice.”
Overiew of Design patterns
There are two core reason for the existence of Design patterns.
1 Design patterns streamlines communication between developers.
It Serve as a common communication language between software developers.
2 They are off-the-shelf solution-forms for common problem-forms.
Help you to identify problems and solve that happened in Off-the-shelf Products.
Benefits of Design patterens:
Highly Maintainable Product
Enhanced Code Reusability
Improve the development of loosely coupled Products
Minimize the Total cost of Ownership
Pattern has four essential elements:
1 Pattern Name:
Describes a design problem, its solutions, and consequences in a word or two.
This is what the pattern will be referred to as → Association
2 The Problem:
This describes the scope of the problem the design pattern is solving.
Describes when to apply the pattern.
Also describe the problem and the application domain/context domain
describe specific design problems
Overiew of Design patterns
3 Solution
Describes the elements that make up the design, their relationships,
responsibilities, and collaborations.
Doesn’t Explain a particular concrete design or implementation,
3 Consequences
are the results and trade-offs of applying the pattern.
The consequences for software often concern space and time trade-offs
3 Solution
Describes the elements that make up the design, their relationships,
responsibilities, and collaborations.
Doesn’t Explain a particular concrete design or implementation,
3 Consequences
are the results and trade-offs of applying the pattern.
The consequences for software often concern space and time trade-offs
3 Solution
Describes the elements that make up the design, their relationships,
responsibilities, and collaborations.
Doesn’t Explain a particular concrete design or implementation,
3 Consequences
are the results and trade-offs of applying the pattern.
The consequences for software often concern space and time trade-offs
3 Solution
Describes the elements that make up the design, their relationships,
responsibilities, and collaborations.
Doesn’t Explain a particular concrete design or implementation,
3 Consequences
are the results and trade-offs of applying the pattern.
The consequences for software often concern space and time trade-offs
1 Singelton
2 Factory method
5 Creational Design → 3 Abstract Factory
patterns
4 Builder
5 Prototype
Types of Design patterens
1 Singelton
2 Factory method
5 Creational Design → 3 Abstract Factory
patterns
4 Builder
5 Prototype
Types of Design patterens
1 Singelton
2 Factory method
5 Creational Design → 3 Abstract Factory
patterns
4 Builder
5 Prototype
Types of Design patterens
1 Singelton
2 Factory method
5 Creational Design → 3 Abstract Factory
patterns
4 Builder
5 Prototype
Overiew of Design patterns
Singelton Pattern
The most popular pattern which restricts the instantiation of a class.
And ensures that only one instance of the class exists in the JVM.
Is there techniqe to ensure single object exists And the way accessed? Yes
I A global variable makes an object accessible, but it doesn’t keep you from
instantiating multiple objects
II To make the class itself responsible for keeping track of its sole instance
→ By providing a way to access the instance.
→ The class can ensure that no other instance can be created
Applicability :
There is exactly one instance of a class,
It must be accessible to clients from a well-known access point.
When the sole instance should be extensible by subclassing, and clients should be
able to use an extended instance without modifying their code
Implemenation Consideration:
Ensuring a unique instance
Subclassing the Singleton class
Overiew of Design patterns
Singelton Pattern
The most popular pattern which restricts the instantiation of a class.
And ensures that only one instance of the class exists in the JVM.
Is there techniqe to ensure single object exists And the way accessed? Yes
I A global variable makes an object accessible, but it doesn’t keep you from
instantiating multiple objects
II To make the class itself responsible for keeping track of its sole instance
→ By providing a way to access the instance.
→ The class can ensure that no other instance can be created
Applicability :
There is exactly one instance of a class,
It must be accessible to clients from a well-known access point.
When the sole instance should be extensible by subclassing, and clients should be
able to use an extended instance without modifying their code
Implemenation Consideration:
Ensuring a unique instance
Subclassing the Singleton class
Overiew of Design patterns
Singelton Pattern
The most popular pattern which restricts the instantiation of a class.
And ensures that only one instance of the class exists in the JVM.
Is there techniqe to ensure single object exists And the way accessed? Yes
I A global variable makes an object accessible, but it doesn’t keep you from
instantiating multiple objects
II To make the class itself responsible for keeping track of its sole instance
→ By providing a way to access the instance.
→ The class can ensure that no other instance can be created
Applicability :
There is exactly one instance of a class,
It must be accessible to clients from a well-known access point.
When the sole instance should be extensible by subclassing, and clients should be
able to use an extended instance without modifying their code
Implemenation Consideration:
Ensuring a unique instance
Subclassing the Singleton class
Overiew of Design patterns
Singelton Pattern
The most popular pattern which restricts the instantiation of a class.
And ensures that only one instance of the class exists in the JVM.
Is there techniqe to ensure single object exists And the way accessed? Yes
I A global variable makes an object accessible, but it doesn’t keep you from
instantiating multiple objects
II To make the class itself responsible for keeping track of its sole instance
→ By providing a way to access the instance.
→ The class can ensure that no other instance can be created
Applicability :
There is exactly one instance of a class,
It must be accessible to clients from a well-known access point.
When the sole instance should be extensible by subclassing, and clients should be
able to use an extended instance without modifying their code
Implemenation Consideration:
Ensuring a unique instance
Subclassing the Singleton class
Overiew of Design patterns
Singelton Pattern
The most popular pattern which restricts the instantiation of a class.
And ensures that only one instance of the class exists in the JVM.
Is there techniqe to ensure single object exists And the way accessed? Yes
I A global variable makes an object accessible, but it doesn’t keep you from
instantiating multiple objects
II To make the class itself responsible for keeping track of its sole instance
→ By providing a way to access the instance.
→ The class can ensure that no other instance can be created
Applicability :
There is exactly one instance of a class,
It must be accessible to clients from a well-known access point.
When the sole instance should be extensible by subclassing, and clients should be
able to use an extended instance without modifying their code
Implemenation Consideration:
Ensuring a unique instance
Subclassing the Singleton class
Singelton Pattern
Implementation :
Create the class structure
Create a object of the class
Create the constructor of the class
Get the only object of the class via getInstance
method
Factory Patterns
Define an interface or abstract class for creating an object but let the
subclasses decide which class to instantiate.
Factory pattern is used when we have a super class with multiple
sub-classes and, based on input, we need to return one of the sub-classes.
This pattern removes the responsibility of instantiation of a class from the
client program to the factory class.
Also referred as Virtual Constructor.
When to apply such Patterns ?
When a class doesn’t know what sub-classes will be required to create.
When a class wants that its sub-classes specify the objects to be created.
When the parent classes choose the creation of objects to its sub-classes.
Important points about Factory Design Pattern:
Keep Factory class Singleton or we can keep the method that returns the
subclass as static.
Based on the input parameter, different subclass is created and returned.
Factory Patterns
Define an interface or abstract class for creating an object but let the
subclasses decide which class to instantiate.
Factory pattern is used when we have a super class with multiple
sub-classes and, based on input, we need to return one of the sub-classes.
This pattern removes the responsibility of instantiation of a class from the
client program to the factory class.
Also referred as Virtual Constructor.
When to apply such Patterns ?
When a class doesn’t know what sub-classes will be required to create.
When a class wants that its sub-classes specify the objects to be created.
When the parent classes choose the creation of objects to its sub-classes.
Important points about Factory Design Pattern:
Keep Factory class Singleton or we can keep the method that returns the
subclass as static.
Based on the input parameter, different subclass is created and returned.
Factory Patterns
Define an interface or abstract class for creating an object but let the
subclasses decide which class to instantiate.
Factory pattern is used when we have a super class with multiple
sub-classes and, based on input, we need to return one of the sub-classes.
This pattern removes the responsibility of instantiation of a class from the
client program to the factory class.
Also referred as Virtual Constructor.
When to apply such Patterns ?
When a class doesn’t know what sub-classes will be required to create.
When a class wants that its sub-classes specify the objects to be created.
When the parent classes choose the creation of objects to its sub-classes.
Important points about Factory Design Pattern:
Keep Factory class Singleton or we can keep the method that returns the
subclass as static.
Based on the input parameter, different subclass is created and returned.
Factory Patterns
Define an interface or abstract class for creating an object but let the
subclasses decide which class to instantiate.
Factory pattern is used when we have a super class with multiple
sub-classes and, based on input, we need to return one of the sub-classes.
This pattern removes the responsibility of instantiation of a class from the
client program to the factory class.
Also referred as Virtual Constructor.
When to apply such Patterns ?
When a class doesn’t know what sub-classes will be required to create.
When a class wants that its sub-classes specify the objects to be created.
When the parent classes choose the creation of objects to its sub-classes.
Important points about Factory Design Pattern:
Keep Factory class Singleton or we can keep the method that returns the
subclass as static.
Based on the input parameter, different subclass is created and returned.
Factory Patterns
Define an interface or abstract class for creating an object but let the
subclasses decide which class to instantiate.
Factory pattern is used when we have a super class with multiple
sub-classes and, based on input, we need to return one of the sub-classes.
This pattern removes the responsibility of instantiation of a class from the
client program to the factory class.
Also referred as Virtual Constructor.
When to apply such Patterns ?
When a class doesn’t know what sub-classes will be required to create.
When a class wants that its sub-classes specify the objects to be created.
When the parent classes choose the creation of objects to its sub-classes.
Important points about Factory Design Pattern:
Keep Factory class Singleton or we can keep the method that returns the
subclass as static.
Based on the input parameter, different subclass is created and returned.
Factory Patterns
Define an interface or abstract class for creating an object but let the
subclasses decide which class to instantiate.
Factory pattern is used when we have a super class with multiple
sub-classes and, based on input, we need to return one of the sub-classes.
This pattern removes the responsibility of instantiation of a class from the
client program to the factory class.
Also referred as Virtual Constructor.
When to apply such Patterns ?
When a class doesn’t know what sub-classes will be required to create.
When a class wants that its sub-classes specify the objects to be created.
When the parent classes choose the creation of objects to its sub-classes.
Important points about Factory Design Pattern:
Keep Factory class Singleton or we can keep the method that returns the
subclass as static.
Based on the input parameter, different subclass is created and returned.
Factory Patterns
Define an interface or abstract class for creating an object but let the
subclasses decide which class to instantiate.
Factory pattern is used when we have a super class with multiple
sub-classes and, based on input, we need to return one of the sub-classes.
This pattern removes the responsibility of instantiation of a class from the
client program to the factory class.
Also referred as Virtual Constructor.
When to apply such Patterns ?
When a class doesn’t know what sub-classes will be required to create.
When a class wants that its sub-classes specify the objects to be created.
When the parent classes choose the creation of objects to its sub-classes.
Important points about Factory Design Pattern:
Keep Factory class Singleton or we can keep the method that returns the
subclass as static.
Based on the input parameter, different subclass is created and returned.
Factory Patterns ...
i Adapter
ii proxy
Structural Design → iii Composite
patterns iv Decorator
v Facade
vi Flyweight
Structural Design pattern
i Adapter
ii proxy
Structural Design → iii Composite
patterns iv Decorator
v Facade
vi Flyweight
Structural Design patterns
i Adapter
also known as Wrappers
Mainly Focus on Converting the interface of a class into another interface
clients expect.
Adapter lets classes work together that couldn’t otherwise because of
incompatible interfaces.
i Observers
ii Itereators
iii Chain of responsibility
Behavioral Design → iv Command
patterns v Interpreter
vi Mediator
vii State
viii Visitor.
Behavioral Design patterns
i Observers
ii Itereators
iii Chain of responsibility
Behavioral Design → iv Command
patterns v Interpreter
vi Mediator
vii State
viii Visitor.
Behavioral Design patterns
Analogical Problem :