From 4d1505c32de2ce6d65d4fad3d30f25bd13e1a178 Mon Sep 17 00:00:00 2001 From: oldregime Date: Fri, 17 Oct 2025 16:35:22 +0000 Subject: [PATCH] docs(factory-method): add class diagram section and normalize sequence diagram heading (#3366) --- factory-method/README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/factory-method/README.md b/factory-method/README.md index 4334b052353d..73e83685188b 100644 --- a/factory-method/README.md +++ b/factory-method/README.md @@ -36,10 +36,14 @@ Wikipedia says > 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. -Sequence diagram +## Sequence diagram ![Factory Method sequence diagram](./etc/factory-method-sequence-diagram.png) +## Class diagram + +![Factory Method class diagram](./etc/factory-method.urm.png) + ## Programmatic Example of Factory Method Pattern in Java The Factory Method approach is pivotal in Java Design Patterns for achieving flexible and maintainable code as we see in the following example.