Home » Tag Archives: Design Patterns (page 2)

Tag Archives: Design Patterns

Understanding strategy pattern by designing game of chess

java-logo

Today we will try to understand Strategy Pattern with the help of an example. The example we will consider is The Game of Chess. The intention here is to explain strategy pattern and not to build a comprehensive Chess Game solution. Strategy Pattern : The Strategy pattern is known as a behavioural pattern – it’s used to manage algorithms, relationships ...

Read More »

Factory Without IF-ELSE

java-logo

Object Oriented Language has very powerful feature of Polymorphism, it is used to remove if/else or switch case in code. Code without condition is easy to read. There are some places where you have to put them and one of such example is Factory/ServiceProvider class. I am sure you have seen factory class with IF-ELSEIF which keeps on getting big. ...

Read More »

Clustered Idempotent Consumer Pattern with Infinispan

jboss-infinispan-logo

I’ve created a small project that shows how to use JBoss Infinispan with Apache Camel and the Idempotent Consumer Pattern to guarantee a message will not be processed twice in a clustered environment. Imagine you have an application that has to scale out easily by deploying it on multiple containers. But the application has to process each unique request only ...

Read More »

Pizza problem – builder vs decorator

java-logo

Problem Statement We need to build the software for a pizza company who wants to prepare different types of pizzas, e.g Chicken Pizza, Flat Bread, Pepperoni Pizza with Extra Cheese, put add on toppings on it. Lets try to see which design pattern suits this problem statement and under what scenario. Traditionally, for pizza problem, builder pattern is most commonly ...

Read More »

Command Design Pattern Applied

java-logo

Hi there! Today i’m gonna share with you a really great programming design pattern. It has a lot of usages and it is one of my favorites. The programming degin pattern command has a huge variety of use cases. In this post we will see how to implement something from the real world. We will implement an electronic car key ...

Read More »

Applying decorator pattern to decorate views on Android

android-logo

Hi there! Today i’m gonna show how to apply the design pattern decorator to android’s views making use of its dependency injection’s concept. I thought it was a nice, clear and simple way to decorate views and that’s my motivator to share it with you. I’m assuming you know the decorator pattern already and are looking for real examples involving ...

Read More »

Builder Design Pattern Applied

java-logo

Hi there! Today i’m gonna share the first of a brand new design pattern series i made. The builder design pattern is a very useful and common pattern while developing serious apps. In this post i’ll give a tiny builder pattern framework, so you can always come back here and get it to work with. A mnemonic, while dealing with ...

Read More »

Decorator Design Pattern Applied

java-logo

Hi there! Today i’m gonna show the decorator design pattern in action. The decorator design pattern is a largelly used design pattern while dealing with grafics, trees and dynamic changes during runtime. It is also a greate choice if you are looking or trying to do recursion with. I love it. In this post we will implement a students decoration. ...

Read More »

Template Method Pattern Example Using Java Generics

java-logo

If you find that a lot of your routines are exactly the same except for certain sections, you might want to consider the Template Method to eliminate error-prone code duplication. Here’s an example: Below are two classes that do similar things:                 Instantiate and initialize a Reader to read from a CSV file. Read ...

Read More »

Open Session In View Design Tradeoffs

software-development-2-logo

The Open Session in View (OSIV) pattern gives rise to different opinions in the Java development community. Let’s go over OSIV and some of the pros and cons of this pattern.   The problem The problem that OSIV solves is a mismatch between the Hibernate concept of session and it’s lifecycle and the way that many server-side view technologies work. ...

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