mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-14 08:58:26 +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:
+20
-17
@@ -1,25 +1,27 @@
|
||||
---
|
||||
title: Update Method
|
||||
title: "Update Method Pattern in Java: Enhancing Game Loop Efficiency with Systematic Updates"
|
||||
shortTitle: Update Method
|
||||
description: "Explore the Update Method design pattern for Java, ideal for real-time games and applications. Learn how it optimizes performance by updating objects frame-by-frame to maintain synchronized, efficient operations."
|
||||
category: Behavioral
|
||||
language: en
|
||||
tag:
|
||||
- Abstraction
|
||||
- Data processing
|
||||
- Decoupling
|
||||
- Event-driven
|
||||
- Game programming
|
||||
- Polymorphism
|
||||
- Abstraction
|
||||
- Data processing
|
||||
- Decoupling
|
||||
- Event-driven
|
||||
- Game programming
|
||||
- Polymorphism
|
||||
---
|
||||
|
||||
## Also known as
|
||||
|
||||
* Update Mechanism
|
||||
|
||||
## Intent
|
||||
## Intent of Update Method Design Pattern
|
||||
|
||||
Update method pattern simulates a collection of independent objects by telling each to process one frame of behavior at a time.
|
||||
The Update Method pattern in Java simulates a collection of independent objects by telling each to process one frame of behavior at a time.
|
||||
|
||||
## Explanation
|
||||
## Detailed Explanation of Update Method Pattern with Real-World Examples
|
||||
|
||||
Real-world example
|
||||
|
||||
@@ -33,9 +35,9 @@ gameprogrammingpatterns.com says
|
||||
|
||||
> The game world maintains a collection of objects. Each object implements an update method that simulates one frame of the object’s behavior. Each frame, the game updates every object in the collection.
|
||||
|
||||
**Programmatic Example**
|
||||
## Programmatic Example of Update Method Pattern in Java
|
||||
|
||||
The Update Method design pattern is a behavioral pattern that simulates a collection of independent objects by telling each to process one frame of behavior at a time. This pattern is commonly used in game development, where each object in the game world needs to be updated once per frame.
|
||||
The Update Method design pattern is a behavioral pattern that simulates a collection of independent game or application objects by telling each to process one frame of behavior at a time. This pattern is commonly used in game development, where each object in the game world needs to be updated once per frame.
|
||||
|
||||
The `World` class represents the game world. It maintains a list of entities (`List<Entity> entities`) and a boolean flag (`isRunning`) to indicate whether the game is running.
|
||||
|
||||
@@ -183,19 +185,20 @@ Console output:
|
||||
|
||||
This is a basic implementation of the Update Method pattern. In a real-world application, the `Entity` class would likely have additional methods and properties, and the `update` method would contain more complex logic to simulate the entity's behavior.
|
||||
|
||||
## Applicability
|
||||
## When to Use the Update Method Pattern in Java
|
||||
|
||||
Update Method works well when:
|
||||
|
||||
* Typically applied in scenarios where multiple objects need synchronous updates without the overhead of manual synchronization, making it a go-to for advanced Java developers.
|
||||
* The application has a number of objects or systems that need to run simultaneously.
|
||||
* Each object’s behavior is mostly independent of the others.
|
||||
* The objects need to be simulated over time.
|
||||
|
||||
## Known Uses
|
||||
## Real-World Applications of Update Method Pattern in Java
|
||||
|
||||
* Real-time games and data processing applications where world objects need to be updated once per frame.
|
||||
|
||||
## Consequences
|
||||
## Benefits and Trade-offs of Update Method Pattern
|
||||
|
||||
Benefits:
|
||||
|
||||
@@ -209,12 +212,12 @@ Trade-offs:
|
||||
* The state needs to be stored to enable resuming updates after each frame
|
||||
* Entities are simulated each frame, but they are not truly concurrent
|
||||
|
||||
## Related Patterns
|
||||
## Related Java Design Patterns
|
||||
|
||||
* [Component](https://java-design-patterns.com/patterns/component/): Often used in game development to allow entities to be composed of various components, each potentially having its own update method.
|
||||
* [Game Loop](https://java-design-patterns.com/patterns/game-loop/): Continuously updates game state and renders the game, which may include the Update Method for various game objects.
|
||||
|
||||
## Credits
|
||||
## References and Credits
|
||||
|
||||
* [Game Programming Patterns](https://amzn.to/3wLTbvr)
|
||||
* [Game Programming Patterns - Update Method](http://gameprogrammingpatterns.com/update-method.html)
|
||||
|
||||
Reference in New Issue
Block a user