Minh  Quang

Minh Quang


Proxy design pattern | Code là dễ :D | Java

Hế lô hế lô, Ông dev đây!

Trong video này mình sẽ giới thiệu về Proxy Design Pattern.


  • 0:00 Giới thiệu, ví dụ
  • 4:43 Class Diagram
  • 5:47 Code

Source code: https://github.com/MiloNguyen95/design-pattern-tutorial

#design-pattern #developer

What is GEEK

Buddha Community

Proxy design pattern | Code là dễ :D | Java
Aileen  Jacobs

Aileen Jacobs


Proxy Design Pattern in JAVA

In this blog, we will discuss Proxy Design Pattern, its example, and how it is different from the other design patterns. But, it’s important to have an understanding of the design patterns first. You can refer here.

What is a Proxy

A Proxy is something that has the authority to do some activity on behalf of the original object. For example, when you are busy for the day and you have to pay electricity bill. So, your approach would be like you will ask someone else to pay on behalf of you.

Proxy Pattern

In the proxy patterns, a class represents the functionality of another class. These type of design patterns comes under structural patterns. Here, we create an object having original object to interface its functionality to outer world.

Why we need Proxy Pattern

This proxy is helpful when we don’t want to manipulate our main object. It avoids the duplication of objects so less memory is used which turns out to increases the performance of the application. And one of the advantages of Proxy pattern is good security.

Example for Proxy Pattern

Let’s see how to write a program using the Proxy Pattern.

So we start by creating a simple interface.

public interface College  {

    public void attendance(String student) ;


#functional programming #java #tech blogs #design pattern #functional java #java #proxy design pattern

Composite design pattern — Java

Composite Pattern tutorial

Definition of Composite pattern

In software engineering, the composite pattern is a partitioning design pattern. The composite pattern describes a group of objects that are treated the same way as a single instance of the same type of object. The intent of a composite is to “compose” objects into tree structures to represent part-whole hierarchies. Implementing the composite pattern lets clients treat individual objects and compositions uniformly.

Where to use the Composite pattern?

UML example

Implementation of the Composite pattern

#design-patterns #java #code #composite-design-pattern #tutorial #composite design pattern — java

Joseph  Murray

Joseph Murray


Factory design pattern — Java

Definition of the Factory pattern

In class-based programming, the factory method pattern is a creational pattern that uses factory methods to deal with the problem of creating objects without having to specify the exact class of the object that will be created. This is done by creating objects by calling a _factory method _— either specified in an interface and implemented by child classes, or implemented in a base class and optionally overridden by derived classes — rather than by calling a constructor.

Where to use the Factory pattern

  • When a class doesn’t know what sub-classes will be required to create
  • When a class wants that its sub-classes specify the objects to be created.
  • When the parent classes choose the creation of objects to its sub-classes.

#factory-design-pattern #code #tutorial #design-patterns #java #factory design pattern — java

Samanta  Moore

Samanta Moore


Builder Design Pattern

What is Builder Design Pattern ? Why we should care about it ?

Starting from **Creational Design Pattern, **so wikipedia says “creational design pattern are design pattern that deals with object creation mechanism, trying to create objects in manner that is suitable to the situation”.

The basic form of object creations could result in design problems and result in complex design problems, so to overcome this problem Creational Design Pattern somehow allows you to create the object.

Builder is one of the** Creational Design Pattern**.

When to consider the Builder Design Pattern ?

Builder is useful when you need to do lot of things to build an Object. Let’s imagine DOM (Document Object Model), so if we need to create the DOM, We could have to do lot of things, appending plenty of nodes and attaching attributes to them. We could also imagine about the huge XML Object creation where we will have to do lot of work to create the Object. A Factory is used basically when we could create the entire object in one shot.

As **Joshua Bloch (**He led the Design of the many library Java Collections Framework and many more) – “Builder Pattern is good choice when designing the class whose constructor or static factories would have more than handful of parameters

#java #builder #builder pattern #creational design pattern #design pattern #factory pattern #java design pattern

Samanta  Moore

Samanta Moore


Guidelines for Java Code Reviews

Get a jump-start on your next code review session with this list.

Having another pair of eyes scan your code is always useful and helps you spot mistakes before you break production. You need not be an expert to review someone’s code. Some experience with the programming language and a review checklist should help you get started. We’ve put together a list of things you should keep in mind when you’re reviewing Java code. Read on!

1. Follow Java Code Conventions

2. Replace Imperative Code With Lambdas and Streams

3. Beware of the NullPointerException

4. Directly Assigning References From Client Code to a Field

5. Handle Exceptions With Care

#java #code quality #java tutorial #code analysis #code reviews #code review tips #code analysis tools #java tutorial for beginners #java code review