mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-06-05 04:13:49 +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:
+21
-19
@@ -1,28 +1,30 @@
|
||||
---
|
||||
title: Model-View-Intent
|
||||
title: "Model-View-Intent Pattern in Java: Building Robust and Scalable Java UIs with MVI"
|
||||
shortTitle: Model-View-Intent (MVI)
|
||||
description: "Discover the Model-View-Intent (MVI) pattern for Java applications. Learn how MVI enhances UI predictability, maintainability, and state management through unidirectional data flow. Explore real-world examples and implementation details."
|
||||
category: Architectural
|
||||
language: en
|
||||
tags:
|
||||
- Abstraction
|
||||
- Decoupling
|
||||
- Presentation
|
||||
- Reactive
|
||||
- State tracking
|
||||
- Abstraction
|
||||
- Decoupling
|
||||
- Presentation
|
||||
- Reactive
|
||||
- State tracking
|
||||
---
|
||||
|
||||
## Also known as
|
||||
|
||||
* MVI
|
||||
|
||||
## Intent
|
||||
## Intent of Model-View-Intent Design Pattern
|
||||
|
||||
To create a unidirectional and cyclical data flow between the Model, View, and Intent components, enhancing predictability and maintainability in user interface logic.
|
||||
The Model-View-Intent (MVI) pattern for Java applications creates a unidirectional and cyclical data flow between the Model, View, and Intent components, enhancing UI predictability and state management.
|
||||
|
||||
## Explanation
|
||||
## Detailed Explanation of Model-View-Intent Pattern with Real-World Examples
|
||||
|
||||
Real-world example
|
||||
|
||||
> Consider a real-world analogy of the Model-View-Intent (MVI) pattern using the scenario of ordering at a fast-food restaurant.
|
||||
> Consider a real-world analogy of the Model-View-Intent (MVI) pattern in Java using the scenario of ordering at a fast-food restaurant to understand its application in enhancing UI state management.
|
||||
>
|
||||
> In this analogy:
|
||||
> - **Model:** It's like the kitchen of the restaurant, where the current state of your order is managed. As you choose items, the kitchen updates the order status and ingredients used.
|
||||
@@ -35,9 +37,9 @@ In plain words
|
||||
|
||||
> The Model-View-Intent (MVI) pattern is a reactive architectural approach where user actions (Intent) modify the application state (Model), and the updated state is then reflected back in the user interface (View) in a unidirectional and cyclical data flow.
|
||||
|
||||
**Programmatic Example**
|
||||
## Programmatic Example of Model-View-Intent Pattern in Java
|
||||
|
||||
The Model-View-Intent (MVI) pattern is a modern approach to structuring your application's logic. It's a variation of the Model-View-Presenter (MVP) and Model-View-ViewModel (MVVM) patterns, but with a more streamlined flow of data and events.
|
||||
The Model-View-Intent (MVI) pattern for Java is a modern approach to structuring your application's logic, ensuring a smooth, unidirectional flow of data and events. It's a variation of the Model-View-Presenter (MVP) and Model-View-ViewModel (MVVM) patterns, but with a more streamlined flow of data and events.
|
||||
|
||||
In MVI, the View sends user events to the Intent. The Intent translates these events into a state change in the Model. The Model then pushes this new state to the View, which updates itself accordingly. This creates a unidirectional data flow, which can make your code easier to understand and debug.
|
||||
|
||||
@@ -182,22 +184,22 @@ public class SetVariableEvent implements UserEvent {
|
||||
|
||||
This example demonstrates the key aspects of the MVI pattern: unidirectional data flow, clear separation of concerns, and the use of events to drive changes in the Model's state.
|
||||
|
||||
## Applicability
|
||||
## When to Use the Model-View-Intent Pattern in Java
|
||||
|
||||
* Useful in applications with complex user interfaces that require a clear separation of concerns and predictable state management.
|
||||
* The MVI pattern is useful in Java applications with complex user interfaces that require a clear separation of concerns, predictable state management, and enhanced maintainability.
|
||||
* Often applied in reactive programming environments to ensure a smooth data flow and state consistency.
|
||||
|
||||
## Tutorials
|
||||
## Model-View-Intent Pattern Java Tutorials
|
||||
|
||||
* [Model View Intent: a new Android Architecture Pattern (Apium Academy)](https://apiumacademy.com/blog/model-view-intent-pattern/)
|
||||
* [MVI Architecture for Android Tutorial: Getting Started (Kodeco)](https://www.kodeco.com/817602-mvi-architecture-for-android-tutorial-getting-started)
|
||||
|
||||
## Known uses
|
||||
## Real-World Applications of Model-View-Intent Pattern in Java
|
||||
|
||||
* Widely adopted in reactive and event-driven Java applications, particularly those using frameworks like RxJava or Project Reactor.
|
||||
* Used in Android development, especially with libraries that support reactive programming such as RxJava and LiveData.
|
||||
|
||||
## Consequences
|
||||
## Benefits and Trade-offs of Model-View-Intent Pattern
|
||||
|
||||
Benefits:
|
||||
|
||||
@@ -211,13 +213,13 @@ Trade-offs:
|
||||
* Requires familiarity with reactive programming paradigms.
|
||||
* Can lead to boilerplate code if not managed properly.
|
||||
|
||||
## Related patterns
|
||||
## Related Java Design Patterns
|
||||
|
||||
[Model-View-ViewModel (MVVM)](https://java-design-patterns.com/patterns/model-view-viewmodel/): Shares a similar goal of separating the view from the model but differs as MVI introduces a cyclical data flow.
|
||||
[Model-View-Controller (MVC)](https://java-design-patterns.com/patterns/model-view-controller/): MVI can be seen as an evolution of MVC, focusing more on reactive programming and unidirectional data flow.
|
||||
[Observer](https://java-design-patterns.com/patterns/observer/): Essential in MVI to observe changes in the Model and update the View accordingly.
|
||||
|
||||
## Credits
|
||||
## References and Credits
|
||||
|
||||
* [Functional and Reactive Domain Modeling](https://amzn.to/4adghJ8)
|
||||
* [Reactive Programming with RxJava: Creating Asynchronous, Event-Based Applications](https://amzn.to/4dxwawC)
|
||||
|
||||
Reference in New Issue
Block a user