avatarAli Zeynalli

Summary

The web content outlines ten essential software design patterns commonly used within Java Core Libraries, illustrating their application and providing examples and references for further reading.

Abstract

The article discusses ten software design patterns from the 21 famous patterns summarized by the Gang of Four (GoF) that are frequently found in Java Core Libraries. These patterns, which include Creational, Structural, and Behavioral types, are integral to object-oriented programming in Java. The Creational patterns covered are Factory, Abstract Factory, Builder, and Singleton, each providing a different approach to object instantiation and control. Structural patterns like Adapter and Facade simplify complex object structures, while Proxy adds a layer of substitution. Behavioral patterns such as Observer, Strategy, and Template facilitate communication between objects, strategy implementation, and object flexibility, respectively. The author also invites readers to connect on social platforms for further engagement.

Opinions

  • The author emphasizes the importance of understanding and applying design patterns in Java, suggesting they offer an "elegant way" to implement object-oriented programming.
  • The article implies that a centralized Factory class, as used in the Factory pattern, provides better control over object creation.
  • The author seems to advocate for the use of the Builder pattern to construct complex objects through simpler interfaces.
  • The Singleton pattern is highlighted as a commonly used pattern that ensures a class has only one instance.
  • The Adapter pattern is presented as a solution for connecting incompatible interfaces, indicating its utility in practical programming scenarios.
  • The Facade pattern is recommended for simplifying complex interfaces, suggesting it adds user-friendliness to the software design.
  • The Proxy pattern is discussed as a method for adding substitution to complex objects, which can be beneficial for controlling access to resources.
  • The Observer pattern is described as facilitating communication between subjects and objects, indicating its effectiveness in managing dependencies.
  • The Strategy pattern is portrayed as allowing for the use of different algorithms within a set of generic code, promoting flexibility and interchangeability.
  • The Template pattern is suggested to provide object flexibility by abstracting sub-parts and allowing extenders to implement them, showcasing its role in reducing code duplication.
  • The author provides links to their other articles for readers interested in a deeper dive into specific patterns, indicating a commitment to educating and engaging with the audience.
  • By offering links to their Twitter and LinkedIn profiles, the author encourages professional networking and further discussion on the topic.

10 Software Design Patterns used in Java Core Libraries

Essential Design Patterns that are used in JDK

Photo by Ryunosuke Kikuno on Unsplash

21 famous software design patterns that are summarised and presented by GoF can be found frequently in Java Core Libraries. Depending on situation different patterns are elegant way to implement object oriented programming. Let us have a quick overview to 10 design patterns that are applied in different parts of Java Development Kit.

Creational Design Patterns — this patterns deal with different techniques of object instantiation.

Factory — this design pattern aims to collect instantiation of classes in a single centralised Factory class in order to have a full control over objects. Please see my other article for more information about this pattern. Examples are:

Abstract Factory — this is a factory design pattern with extra level of abstraction. Examples are:

Builder — this pattern helps us to construct complex objects with the help of simpler interfaces. Examples are:

Singleton — this pattern is one of the most used patterns and its goal is to prevent instantiating the same class multiple times allowing only single instance across the given context. Please see my other article for more information about this pattern. Examples are:

Structural Design Patterns — this kind of design patterns cope with structural composition of software components to simplify the complex objects using mostly inheritance.

Adapter — this design patterns, as name suggests, is a converter pattern that connects incompatible interfaces. Examples are:

Facade — this design pattern is basically adding another interface to simplify complex interfaces. Examples are:

  • Faces Api HttpServletRequest, HttpServletResponse

Proxy — this pattern uses proxies to add substitution to complex objects. Please see my other article for more information about this pattern. Examples are:

Behavioural Design Patterns — this design patterns deal with the way how the different objects interact with each other.

Observer — this pattern is making communication between subject and object to let them know that changes are happened. Examples are:

Strategy — this design pattern allows us using different strategies by writing generic code. Examples are:

Template — this design pattern provides flexibility to objects by abstracting several sub-parts and letting extenders to implement it. Please see my other article for more information about this pattern. Examples are:

P.S. You can connect with me on twitter or linkedin.

Software Development
Software Engineering
Software Architecture
Software Design
Java
Recommended from ReadMedium