Home » Tag Archives: Design Patterns (page 3)

Tag Archives: Design Patterns

Java Singleton Design Pattern

java-logo

Its one of the simplest design pattern in Java. If any one asks me which design pattern you are good then I would proudly say Singleton. But when they ask in depth concept of singleton then I get stumped. Is it really singleton is that much difficult ? Really not but it has many scenarios that we need to understand ...

Read More »

Difference between State and Strategy Design Pattern in Java

java-logo

In order to make proper use of State and Strategy design Pattern in Core Java application, its important for a Java developer to clearly understand difference between them. Though both State and Strategy design patterns has similar structure, and both of them are based upon Open closed design principle, represents ‘O’ from SOLID design principles, they are totally different on ...

Read More »

Circuit Breaker Pattern in Apache Camel

apache-camel-logo

Camel is very often used in distributed environments for accessing remote resources. Remote services may fail for various reasons and periods. For services that are temporarily unavailable and recoverable after short period of time, a retry strategy may help. But some services can fail or hang for longer period of time making the calling application unresponsive and slow. A good ...

Read More »

The Builder pattern and the Spring framework

spring-interview-questions-answers

Introduction I like to make use of the builder pattern whenever an object has both mandatory and optional properties. But building objects is usually the Spring framework responsibility, so let’s see how you can employ it using both Java and XML-based Spring configurations. A Builder example Let’s start from the following Builder class.   public final class Configuration<T extends DataSource> ...

Read More »

Design Pattern: Immutable Embedded Builder

java-logo

Last week I wrote about what makes a pattern anti-pattern. This week I present a design pattern… or wait… perhaps this is an anti-pattern. Or is it? Let’ see! The builder pattern is a programming style when there is a class that build an instance of another. The original aim of the builder pattern is to separate the building process ...

Read More »

Design Patterns: Pattern or Anti-Pattern, that is the question

java-logo

I have recently encountered the wiki page Anti-pattern that has an exhaustive list of anti patterns. Some of them were obvious for me. Some of them made me think a bit, other a bit more. Then I started to look for the anti-pattern “singleton” on the page and I could not find it. (Text search stops at singlet…) Is singleton ...

Read More »

Three Reasons Why I Like the Builder Pattern

java-logo

There are three ways to create new objects in Java programming language: The telescoping constructor (anti)pattern The Javabeans pattern The builder pattern I prefer the builder pattern over the other two methods. Why? Joshua Bloch described the builder pattern and the benefits of using it in Effective Java. He did an excellent job and I will not repeat these benefits ...

Read More »

The Decorator Pattern

java-logo

The Decorator Pattern One design pattern that I don’t see being used very often is Decorator. I’m not sure why this pattern isn’t more popular, as it’s quite handy. The Decorator pattern allows one to add functionality to an object in a controlled manner. This works at runtime, even with statically typed languages! The decorator pattern is an alternative to subclassing. ...

Read More »

State Design Pattern in Java – Example Tutorial

java-logo

State pattern is one of the behavioral design pattern. State design pattern is used when an Object change it’s behavior based on it’s internal state. If we have to change the behavior of an object based on it’s state, we can have a state variable in the Object and use if-else condition block to perform different actions based on the ...

Read More »
Do you want to know how to develop your skillset and become a ...

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!
Get ready to Rock!
To download the books, please verify your email address by following the instructions found on the email we just sent you.

THANK YOU!

Close