Skip to main content
Execute Around

Also known as

  • Around Method Pattern
  • Resource Block Management

Intent

Execute Around idiom frees the user from certain actions that should always be executed before and after the business method. A good example of this is resource allocation and deallocation leaving the user to specify only what to do with the resource.


iluwatarAbout 2 minBehavioralClosureCode simplificationEncapsulationFunctional decompositionResource management
Facade

Intent

Provide a unified interface to a set of interfaces in a subsystem. Facade defines a higher-level interface that makes the subsystem easier to use.

Explanation

Real-world example

How does a goldmine work? "Well, the miners go down there and dig gold!" you say. That is what you believe because you are using a simple interface that goldmine provides on the outside, internally it has to do a lot of stuff to make it happen. This simple interface to the complex subsystem is a facade.


iluwatarAbout 3 minStructuralCode simplificationEncapsulationGang Of FourObject composition
Fluent Interface

Also known as

  • Fluent API
  • Method Chaining

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


iluwatarAbout 3 minBehavioralAPI designCode simplificationDecouplingObject compositionReactive