10 Software Design Patterns used in Java Core Libraries
Essential Design Patterns that are used in JDK
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:
- java.util.Collections — singletonList(), singletonMap()
- java.util.ResourceBundle — getBundle()
Abstract Factory — this is a factory design pattern with extra level of abstraction. Examples are:
- javax.xml.parsers.DocumentBuilderFactory — newInstance()
- javax.xml.transform.TransformerFactory — newInstance()
- javax.xml.xpath.XPathFactory — newInstance()