mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-08-18 04:28:04 +00:00
docs: Content SEO updates (#2990)
* update yaml frontmatter format * update abstract document * update abstract factory * use the new pattern template * acyclic visitor seo * adapter seo * ambassador seo * acl seo * aaa seo * async method invocation seo * balking seo * bridge seo * builder seo * business delegate and bytecode seo * caching seo * callback seo * chain seo * update headings * circuit breaker seo * client session + collecting parameter seo * collection pipeline seo * combinator SEO * command seo * cqrs seo * commander seo * component seo * composite seo * composite entity seo * composite view seo * context object seo * converter seo * crtp seo * currying seo * dao seo * data bus seo * data locality seo * data mapper seo * dto seo * decorator seo * delegation seo * di seo * dirty flag seo * domain model seo * double buffer seo * double checked locking seo * double dispatch seo * dynamic proxy seo * event aggregator seo * event-based asynchronous seo * eda seo * event queue seo * event sourcing seo * execute around seo * extension objects seo * facade seo * factory seo * factory kit seo * factory method seo * fanout/fanin seo * feature toggle seo * filterer seo * fluent interface seo * flux seo * flyweight seo * front controller seo * function composition seo * game loop seo * gateway seo * guarded suspension seo * half-sync/half-async seo * health check seo * hexagonal seo * identity map seo * intercepting filter seo * interpreter seo * iterator seo * layers seo * lazy loading seo * leader election seo * leader/followers seo * lockable object seo * rename and add seo for marker interface * master-worker seo * mediator seo * memento seo * metadata mapping seo * microservice aggregator seo * api gw seo * microservices log aggregration seo * mvc seo * mvi seo * mvp seo * mvvm seo * monad seo * monitor seo * monostate seo * multiton seo * mute idiom seo * naked objects & notification seo * null object seo * object mother seo * object pool seo * observer seo * optimistic locking seo * page controller seo * page object seo * parameter object seo * partial response seo * pipeline seo * poison pill seo * presentation model seo * private class data seo * producer-consumer seo * promise seo * property seo * prototype seo * proxy seo * queue-based load leveling seo * reactor seo * registry seo * repository seo * RAII seo * retry seo * role object seo * saga seo * separated interface seo * serialized entity seo * serialized lob seo * servant seo * server session seo * service layer seo * service locator seo * service to worker seo * sharding seo * single table inheritance seo * singleton seo * spatial partition seo * special case seo * specification seo * state seo * step builder seo * strangler seo * strategy seo * subclass sandbox seo * table module seo * template method seo * throttling seo * tolerant reader seo * trampoline seo * transaction script seo * twin seo * type object seo * unit of work seo * update method seo * value object seo * version number seo * virtual proxy seo * visitor seo * seo enhancements * seo improvements * SEO enhancements * SEO improvements * SEO additions * SEO improvements * more SEO improvements * rename hexagonal + SEO improvements * SEO improvements * more SEO stuff * SEO improvements * SEO optimizations * SEO enhancements * enchance SEO * improve SEO * SEO improvements * update headers
This commit is contained in:
+19
-15
@@ -1,21 +1,23 @@
|
||||
---
|
||||
title: Registry
|
||||
title: "Registry Pattern in Java: Implementing a Centralized Control Mechanism for Java Objects"
|
||||
shortTitle: Registry
|
||||
description: "Explore the Registry design pattern in Java: Learn how it centralizes object management for improved access and control. Perfect for software developers and architects looking to optimize Java application architecture."
|
||||
category: Creational
|
||||
language: en
|
||||
tag:
|
||||
- API design
|
||||
- Data access
|
||||
- Decoupling
|
||||
- Dependency management
|
||||
- Enterprise patterns
|
||||
- Instantiation
|
||||
- API design
|
||||
- Data access
|
||||
- Decoupling
|
||||
- Dependency management
|
||||
- Enterprise patterns
|
||||
- Instantiation
|
||||
---
|
||||
|
||||
## Intent
|
||||
## Intent of Registry Design Pattern
|
||||
|
||||
To centralize the creation and management of a global set of objects, providing a single point of access and ensuring controlled instantiation.
|
||||
Registry Design Pattern centralizes the creation and management of a global set of objects, providing a single point of access and ensuring controlled instantiation.
|
||||
|
||||
## Explanation
|
||||
## Detailed Explanation of Registry Pattern with Real-World Examples
|
||||
|
||||
Real-world example
|
||||
|
||||
@@ -36,7 +38,7 @@ wiki.c2.com says
|
||||
|
||||
> A registry is a global association from keys to objects, allowing the objects to be reached from anywhere. It involves two methods: one that takes a key and an object and add objects to the registry and one that takes a key and returns the object for the key. It's similar to the MultitonPattern, but doesn't restrict instances to only those in the registry.
|
||||
|
||||
**Programmatic Example**
|
||||
## Programmatic Example of Registry Pattern in Java
|
||||
|
||||
The Registry design pattern is a well-known pattern used in software design where objects are stored and provide a global point of access to them. This pattern is particularly useful when you need to manage a global collection of objects, decouple the creation of objects from their usage, ensure a controlled lifecycle for objects, and avoid redundant creation of objects.
|
||||
|
||||
@@ -110,23 +112,25 @@ Running the example produces the following output:
|
||||
09:55:31.113 [main] INFO com.iluwatar.registry.App -- Julia Customer{id='2', name='Julia'}
|
||||
```
|
||||
|
||||
## Applicability
|
||||
## When to Use the Registry Pattern in Java
|
||||
|
||||
* When you need to manage a global collection of objects.
|
||||
* When you need to decouple the creation of objects from their usage.
|
||||
* When you need to ensure a controlled lifecycle for objects, such as services or resources.
|
||||
* When you want to avoid redundant creation of objects.
|
||||
|
||||
## Known Uses
|
||||
## Real-World Applications of Registry Pattern in Java
|
||||
|
||||
* Managing database connections in an enterprise application.
|
||||
* Providing a central place to register and retrieve services or components in a modular application.
|
||||
* Creating a central configuration registry that various parts of an application can access.
|
||||
|
||||
## Consequences
|
||||
## Benefits and Trade-offs of Registry Pattern
|
||||
|
||||
Benefits:
|
||||
|
||||
Key advantages of adopting the Registry pattern in Java
|
||||
|
||||
* Centralizes object management, making the application easier to maintain.
|
||||
* Promotes reuse and sharing of objects, which can reduce memory footprint and initialization time.
|
||||
* Facilitates decoupling between components.
|
||||
@@ -145,7 +149,7 @@ Trade-offs:
|
||||
* [Dependency Injection](https://java-design-patterns.com/patterns/dependency-injection/): Provides an alternative method for managing dependencies, which can sometimes replace the need for a Registry.
|
||||
* [Multiton](https://java-design-patterns.com/patterns/multiton/): Similar to the Registry in that it manages multiple instances, but does so based on keys, ensuring only one instance per key.
|
||||
|
||||
## Credits
|
||||
## References and Credits
|
||||
|
||||
* [Design Patterns: Elements of Reusable Object-Oriented Software](https://amzn.to/3w0pvKI)
|
||||
* [Patterns of Enterprise Application Architecture](https://amzn.to/3WfKBPR)
|
||||
|
||||
Reference in New Issue
Block a user