Async Method Invocation

Intent

Asynchronous method invocation is a pattern where the calling thread is not blocked while waiting results of tasks. The pattern provides parallel processing of multiple independent tasks and retrieving the results via callbacks or waiting until everything is done.

Explanation


iluwatarConcurrencyReactiveAbout 3 min
Callback

Intent

Callback is a piece of executable code that is passed as an argument to other code, which is expected to call back (execute) the argument at some convenient time.

Explanation

Real world example

We need to be notified after executing task has finished. We pass a callback method for the executor and wait for it to call back on us.


iluwatarIdiomReactiveLess than 1 minute
Collection Pipeline

Intent

Collection Pipeline introduces Function Composition and Collection Pipeline, two functional-style patterns that you can combine to iterate collections in your code. In functional programming, it's common to sequence complex operations through a series of smaller modular functions or operations. The series is called a composition of functions, or a function composition. When a collection of data flows through a function composition, it becomes a collection pipeline. Function Composition and Collection Pipeline are two design patterns frequently used in functional-style programming.


iluwatarFunctionalReactiveLess than 1 minute
Combinator

Also known as

Composition pattern

Intent

The functional pattern representing a style of organizing libraries centered around the idea of combining functions. Putting it simply, there is some type T, some functions for constructing “primitive” values of type T, and some “combinators” which can combine values of type T in various ways to build up more complex values of type T.


iluwatarIdiomReactiveAbout 3 min
Event Aggregator

Name

Event Aggregator

Intent

A system with lots of objects can lead to complexities when a client wants to subscribe to events. The client has to find and register for each object individually, if each object has multiple events then each event requires a separate subscription. An Event Aggregator acts as a single source of events for many objects. It registers for all the events of the many objects allowing clients to register with just the aggregator.


iluwatarStructuralReactiveAbout 2 min
Event-based Asynchronous

Intent

The Event-based Asynchronous Pattern makes available the advantages of multithreaded applications while hiding many of the complex issues inherent in multithreaded design. Using a class that supports this pattern can allow you to:

  1. Perform time-consuming tasks, such as downloads and database operations, "in the background," without interrupting your application.
  2. Execute multiple operations simultaneously, receiving notifications when each completes.
  3. Wait for resources to become available without stopping ("hanging") your application.
  4. Communicate with pending asynchronous operations using the familiar events-and-delegates model.

iluwatarConcurrencyReactiveLess than 1 minute
Event Driven Architecture

Intent

Send and notify state changes of your objects to other applications using an Event-driven Architecture.

Class diagram

Applicability

Use an Event-driven architecture when

  • you want to create a loosely coupled system
  • you want to build a more responsive system
  • you want a system that is easier to extend

iluwatarArchitecturalReactiveLess than 1 minute
Fluent Interface

Intent

A fluent interface provides an easy-readable, flowing interface, that often mimics a domain specific language. Using this pattern results in code that can be read nearly as human language.

Explanation

The Fluent Interface pattern is useful when you want to provide an easy readable, flowing API. Those interfaces tend to mimic domain specific languages, so they can nearly be read as human languages.


iluwatarFunctionalReactiveAbout 2 min
Monad

Intent

Monad pattern based on monad from linear algebra represents the way of chaining operations together step by step. Binding functions can be described as passing one's output to another's input basing on the 'same type' contract. Formally, monad consists of a type constructor M and two operations: bind - that takes monadic object and a function from plain object to monadic value and returns monadic value return - that takes plain type object and returns this object wrapped in a monadic value.


iluwatarFunctionalReactiveLess than 1 minute
Observer

Also known as

Dependents, Publish-Subscribe

Intent

Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.

Explanation

Real-world example

In a land far away live the races of hobbits and orcs. Both of them are mostly outdoors so they closely follow the weather changes. One could say that they are constantly observing the weather.


iluwatarBehavioralGang Of FourReactiveAbout 2 min
2