A design patterns are well-proved solution for solving the specific problem/task. When should we use the design patterns? We must use the design patterns during
the analysis and requirement phase of SDLC Design patterns ease the analysis and
requirement phase of SDLC by providing information
Categorization
of design patterns:
Basically,
design patterns are categorized into two parts:
Core Java (OOPS) Design Patterns
In core java,
there are mainly three types of design patterns, which are further divided into their sub-parts:
1.Creational Design Patterns Creational design
patterns provide solutions to instantiate an object in the best possible way for specific
situations.
2. Structural Design Patterns Structural design patterns are used to simplify and manage the relationships between objects and classes. They help in creating compositions of objects to form larger structures while ensuring that these
structures are flexible and easy to manage.
3. Behavioral Design Patterns Behavioral patterns provide a solution for better interaction between objects and how to provide loose-coupling and
flexibility to extend easily. |
This blog has information on Micro Services Architecture, Spring Boot, Spring Cloud, Java and Interview Questions,Tutorials. Also covers some articles on other technologies.
Showing posts with label Design Patterns. Show all posts
Showing posts with label Design Patterns. Show all posts
Friday, January 10, 2020
Design Patterns
Monday, August 29, 2016
Java Design Pattern Interview questions
If
two different class loaders load a singleton class, would they load it twice ?
Two
objects loaded by different class loaders are never equal even if they carry
the same values.
So,
each class loader will have its own singleton.
What
is Decorator design pattern?
The
decorator design pattern attaches responsibilities to objects at runtime.
BufferedInputStream
in java.io is an example of Decorator. It wraps around a InputStream and
provide additional buffering functionality.
What
is Strategy design pattern?
Strategy
design pattern lets you swap new algorithms and processes into your program
without
affecting
the objects that use them.
AWT
containers delegate the layout to layout managers. Layout managers use strategy
pattern to for appropriate layout.
What
is Iterator Design pattern?
Iterator
pattern is used to iterate over a collection sequentially and provide a way the
access the individual elements.
What
is Factory pattern?
Factory
pattern abstracts the object creation process from the code that uses the
objects.
What
is Front Controller design pattern?
Front
controller suggest using a single servlet for centralizing request handling and
delegating functions like validation and business process handling to helpers.
What
is Composite view pattern?
A
composite view is made of several sub-views.
A
JSP page can use a header jsp, footer jsp etc.
What
is View Helper pattern?
In
this pattern, the view delegates processing responsibilities to helper classes.
Implemented
using Javabeans.
Difference
between Service to Worker pattern and Dispatcher View pattern.
Both
pattern use Front controller combined with Helpers with Dispatcher component.
In
Service to worker, front controller delegates content retrieval to View
Helpers. Controller also takes care of tasks like authentication, authorization
etc.
In
Dispatcher View, Controller does not delegate content retrieval to helpers.
Most of the work is done by views.
Subscribe to:
Posts (Atom)