Articles

In this video tutorial, we take a closer look at Object Pool Design Pattern in Java. This tutorial includes an introduction, example, and key points. Let’s get started!

Source de l’article sur DZONE

Bridge Design Pattern is a Structural Design Pattern used to decouple a class into two parts — abstraction and it’s implementation — so that both can be developed independently. This promotes the loose coupling between class abstraction and its implementation. You get this decoupling by adding one more level of indirection i.e. an interface that acts as a bridge between your original class and functionality. Insulation is another name of the Bridge Design Pattern in the C++ world.

"All problems in computer science can be solved by another level of indirection." — David Wheeler

Source de l’article sur DZONE

Here’s the context of how the need for AWS Eventbridge came to be.

As the march of technology is never-ending, the only constant we can expect is change. This is especially true considering the strides that serverless has made in the industry, especially with the release of the AWS Lambda back in 2014. Upon its release, AWS Lambda was quick to take front and center position in the FaaS services making up the core of serverless applications. It was rightly heralded as one of the most important releases within the domain. This further lead to an array of best practices dictating how applications were built using FaaS services achieving serverless capabilities. 

You may also enjoy:  Explaining Eventbridge Amidst the Hype

However, as the course of technology meanders in its ongoing path, new innovations are constantly redefining the way we build applications. One such innovative service announced this year was AWS EventBridge, and its release has since caused an uproar in the domain of serverless. Many blogs and posts within the community that followed the announcement characterized it as the most important announcement after the release of AWS Lambda. 

Source de l’article sur DZONE

Here I am with another useful design pattern for you — the adapter design pattern. I will also highlight the differences between the decorator design pattern (see my previous article, Decorator Design Pattern in Java, here) and the adapter design pattern.

Adapter Design Pattern

  • The adapter design pattern is a structural design pattern that allows two unrelated/uncommon interfaces to work together. In other words, the adapter pattern makes two incompatible interfaces compatible without changing their existing code.
  • Interfaces may be incompatible, but the inner functionality should match the requirement.
  • The adapter pattern is often used to make existing classes work with others without modifying their source code.
  • Adapter patterns use a single class (the adapter class) to join functionalities of independent or incompatible interfaces/classes.
  • The adapter pattern also is known as the wrapper, an alternative naming shared with the decorator design pattern.
  • This pattern converts the (incompatible) interface of a class (the adaptee) into another interface (the target) that clients require.
  • The adapter pattern also lets classes work together, which, otherwise, couldn’t have worked, because of the incompatible interfaces.
  • For example, let’s take a look at a person traveling in different countries with their laptop and mobile devices. We have a different electric socket, volt, and frequency measured in different countries and that makes the use of any appliance of one country to be freely used in a different country. In the United Kingdom, we use Type G socket with 230 volts and 50 Hz frequency. In the United States, we use Type A and Type B sockets with 120 volts and 60 Hz frequency. In India, we use Type C, Type D. and Type M sockets with 230 volts and 50 Hz. lastly, in Japan, we use Type A and Type B sockets with 110 volts and 50 Hz frequency. This makes the appliances we carry incompatible with the electric specifications we have at different places.
  • This makes the adapter tool essential because it can make/convert incompatible code into compatible code. Please notice here that we have not achieved anything additional here — there is no additional functionality, only compatibility.

To better understand this, let’s look at an example of geometric shapes. I am keeping the example relatively simple to keep the focus on the pattern. Suppose we have a project of drawing, in which we are required to develop different kinds of geometric shapes that will be used in the Drawing via a common interface called  Shape.

Source de l’article sur DZONE

Java design patterns have many benefits and use cases, specifically when it comes to building an application, like web-based, SDK, application services, etc. The Chain of Responsibility (CoR) is one of the most commonly used behavioral design patterns in Java. In this article, I will take a look at a problem and its relation with the CoR design pattern.

Tile Flooring Problem

Situation: There is a room (rectangular in size) floor that needs to be completely covered with tiles on the floor. So, the two variables are x and y, which are the dimensions of the room.

Source de l’article sur DZONE