Visionary Software Solutions iSpy: OBSERVER, MEDIATOR, and Eventing Done Right.
Implementation of OBSERVER and MEDIATOR made after witnessing the debacle of Flutter's InheritedWidget and "Provider" packages and deciding "NOPE, DON'T WANT IT."
(Aside: It's literally shameful to me that so many new frameworks are being written by professionals that don't clearly and explicitly include such well-known concepts using the UBIQUITOUS LANGUAGE (Eric Evans Domain Driven Design) of Patterns to simplify themselves conceptually and promote greater understanding and professionalism in the field of software engineering.)
MVC and MVVM are classic and reliable architectural patterns for solid UIs. It's a shame that modern frameworks are encouraging newbies to programming to go away from them in favor of complicated specific abstractions that introduce tight coupling and make them think in framework specific ways as opposed to seeing the generalized patterns, to me a clear sign of VENDOR LOCK-IN and WOLF TICKET Anti-Patterns.
Features
- Provides ready to use implementations of OBSERVER and MEDIATOR for OBSERVER
- Immutable and Mutable options
- Enables MVC/MVVM style architectures with loose coupling
- Uses Generics for situations where users may want to leverage the compiler and only be interested in specific events/
- Offers simple implementations of DOMAIN EVENTS
- Building block pieces in place to build an Audit Log, the corner stone of the cornerstone of real time data processing
Getting started
No dependencies, pure Dart! It should work in any Dart 3+ runtime environment.
Usage
Check out the demos in example/i_spy_example.dart and the unit test test/i_spy_test.dart.
Here's a teaser
/// Basic demonstration of how OBSERVER and MEDIATOR enable decoupling between
/// two components. [Pinger] and [Ponger] don't know about each other.
final ping = Pinger();
final pong = Ponger();
final scribe = Scribe();
/// nor do they know that there's a [Scribe] jotting down what happens.
/// This loose coupling is a boon in many UI contexts.
ping.ping();
pong.pong();
scribe.update(Finished());
Additional information
This package is Free and Open Source Software by Visionary Software Solutions. Alternative licensing is available, on a sliding scale case-by-case basis. (Contact nico at visionary.software)
Libraries
- i_spy
- Implementation of OBSERVER and MEDIATOR made after witnessing the debacle of Flutter's "InheritedWidget" and "Provider" packages and deciding "NOPE, DON'T WANT IT." MVC and MVVM are classic and reliable architectural patterns for solid UIs. It's a shame that modern frameworks are encouraging newbies to programming to go away from them in favor of complicated specific abstractions that introduce tight coupling and make them think in framework specific ways as opposed to seeing the generalized patterns, to me a clear sign of VENDOR LOCK-IN and WOLF TICKET Anti-Patterns. As the Gang of Four themselves said in 1994: "MVC uses other design patterns, such as FACTORY METHOD (121) to specify the default controller class for a view and DECORATOR (196) to add scrolling to a view. But the main relationships in MVC are given by the Observer, Composite, and Strategy design patterns." STRATEGY is pretty much a given in a functional programming language, DECORATOR and COMPOSITE are already pretty heavily used in Flutter Widgets, OBSERVER and MEDIATOR bring conceptual clarity to allow for code that doesn't drive people batty.