Gone Mobile
00:00:00
/
01:05:47

118: Mediator for Mobile

August 20th, 2024

In this episode, Jon and Allan discuss various topics, including office renovations, phone migrations, and the use of mediator patterns in app development. They explore the concept of vertical slicing in architecture and the benefits of using a mediator to route messages. Allan shares his experience with mediator patterns in server architecture and highlights the need for a mediator pattern in app development. They also touch on the scalability of mediator patterns and the potential challenges of using them in certain scenarios. The conversation explores the concept of using a mediator pattern to handle services in an app. The mediator pattern allows for loose coupling and easier unit testing. It also simplifies the management of common services and reduces the need for multiple service injections. The conversation also touches on the use of events and requests with responses in the mediator pattern. The implementation of the mediator pattern in the context of a Maui app is discussed, including handling events and requests, offline mode, caching, and resiliency. In this conversation, Jon and Allan discuss the benefits and use cases of using MediatR in mobile app development. They explore the concept of middleware and how it can be used to handle various aspects of app functionality. They also discuss the challenges of finding and managing dependencies in a loosely coupled architecture. Allan introduces his MediatR library and explains how it simplifies the implementation of Mediator patterns in mobile apps. They also touch on topics like offline caching, resiliency, and event handling.

Takeaways

  • Mediator patterns can be used to vertically slice business domains in app development.
  • Mediators act as traffic cops, directing messages to the appropriate services.
  • Mediator patterns can improve code organization and reduce the need for injecting multiple services.
  • Using a mediator pattern can make testing and maintaining code easier.
  • Mediator patterns may not be suitable for high-frequency messaging or performance-critical scenarios. The mediator pattern can be used to handle services in an app, providing loose coupling and easier unit testing.
  • Using a mediator pattern simplifies the management of common services and reduces the need for multiple service injections.
  • Events and requests with responses are key components of the mediator pattern.
  • The mediator pattern can be implemented in a Maui app to handle events and requests, enable offline mode, caching, and resiliency.
  • Attributes can be used to customize the behavior of the mediator pattern, such as handling offline mode, caching, and user notifications. MediatR is a powerful library that simplifies the implementation of Mediator patterns in mobile app development.
  • Middleware can be used to handle various aspects of app functionality, such as offline caching, resiliency, and event handling.
  • Loosely coupled architectures can be challenging to manage, but tools like MediatR can help alleviate some of the complexity.
  • Finding and managing dependencies in a messaging-based architecture can be difficult, but there are strategies like namespacing and code navigation that can help.
  • MediatR provides a flexible and extensible solution for handling requests and events in mobile apps.

People

  • Hosts: Jon Dick, Allan Ritchie
  • Audio Engineer: Jim Heath

Chapters

  • 00:00 Introduction and Office Renovations
  • 09:07 Phone Migrations and Mediator Patterns
  • 14:21 Understanding Mediator Patterns
  • 17:13 Challenges of Scaling Mediator Patterns
  • 23:04 Implementing the Mediator Pattern in a Maui App
  • 27:59 Enabling Offline Mode, Caching, and Resiliency
  • 41:42 Source Generation and Runtime Lookup
  • 43:24 Replay: Handling Async Enumerables
  • 46:04 Mediator as a Stepping Stone
  • 48:26 Removing Attributes and Changing Behavior
  • 52:05 Improving Developer Experience
  • 55:11 Using Essentials API for Main Thread Handling
  • 57:20 Offline Caching with MediatR
  • 01:00:18 Using Middleware for Request Handling
  • 01:02:34 Considering Dependencies and Library Usage

Episode Comments