Home » Tag Archives: Design Patterns (page 7)

Tag Archives: Design Patterns

Loan pattern in Java (a.k.a lender lendee pattern)

java-logo

This post is about implementing loan pattern in Java. Use Case Implement separation between the code that holds resource from that of accessing it such that the accessing code doesn’t need to manage the resources. The use case mentioned holds true when we write code to read/write to a file or querying SQL / NOSQL dbs. There are certainly API’s ...

Read More »

Fluent Object Creation

java-logo

Many posts have been written on this subject (overwhelmingly many) but I just wanted to contribute my two-cents and write a short post about how I use the Fluent Object Creation pattern or object builders in Java to instantiate Value Objects. Value Objects are abstractions that are defined by their state (value) rather than their address in memory. Examples of ...

Read More »

Using Builder Pattern in JUnit tests

junit-logo

This is not intended to be a heavily technical post. The goal of this post is to give you some guidelines to make your JUnit testing life more easy, to enable you to write complex scenarios for tests in minutes with the bonus of having extremely readable tests.                 There are two major ...

Read More »

Decorate with decorator design pattern

java-logo

Decorator pattern is one of the widely used structural patterns. This pattern dynamically changes the functionality of an object at runtime without impacting the existing functionality of the objects. In short this pattern adds additional functionalities to the object by wrapping it. Problem statement: Imagine a scenario where we have a pizza which is already baked with tomato and cheese. ...

Read More »

Facade Design Pattern – Design standpoint

java-logo

In our previous article we have described about the Adapter Design Pattern. In today’s article we are going to show about another such Gang of Four Structural patterns. As the name suggests structural pattern is used to form a larger object structure from many different objects. Façade pattern is one such pattern which provides a simplified interface to a set ...

Read More »

Gang of Four – Proxy Design Pattern

java-logo

Proxy is another Structural design pattern which works ‘on behalf of’ or ‘in place of’ another object in order to access the later. When to use this pattern? Proxy pattern is used when we need to create a wrapper to cover the main object’s complexity from the client. What are the usage scenarios? Virtual Proxy – Imagine a situation where ...

Read More »

By your Command – Command design pattern

java-logo

Command design pattern is one of the widely known design pattern and it falls under the Behavioral Design Pattern (part of Gang of Four). As the name suggests it is related to actions and events in an application.   Problem statement: Imagine a scenario where we have a web page will multiple menus in it. One way of writing this ...

Read More »

Prototype Design Pattern: Creating another dolly

java-logo

It’s really a time consuming process to create objects and also an expensive affair. So we are now on a venture to save both time and money. How do we do that? Anybody remember about Dolly? Yes, it’s the sheep which was the first mammal to be cloned. Well I don’t want to dig into the details but the key ...

Read More »

Design Patterns: Mogwai or Gremlins?

software-development-2-logo

The 1994 book Design Patterns: Elements of Reusable Object-Oriented Software introduced many software developers to the concept of ‘a catalog of simple and succinct solutions to commonly occurring design problems’ that nearly every object-oriented software developer knows of today as ‘design patterns.’ Like most technical concepts (whether real or hype or somewhere in between), ‘design patterns’ seemed to go through ...

Read More »

Design Best practices using Factory Method Pattern

java-logo

In the previous Design Pattern example we have explained about a flavor of Factory pattern which is commonly used nowadays. In this session we will understand a more advanced solution which had more abstraction. This pattern is called Factory Method design pattern. Definition: The Factory method pattern exposes a method for creating objects but delegates the object creation to the ...

Read More »
Want to take your Java Skills to the next level?
Grab our programming books for FREE!
  • Save time by leveraging our field-tested solutions to common problems.
  • The books cover a wide range of topics, from JPA and JUnit, to JMeter and Android.
  • Each book comes as a standalone guide (with source code provided), so that you use it as reference.
Last Step ...

Where should we send the free eBooks?

Good Work!
To download the books, please verify your email address by following the instructions found on the email we just sent you.