I/O Controller (IC)

ARCHITECTURAL Role

This pattern is layer-specific; it is used within the Inbound/Outbound  architectural layer.  An IC is the boundary class interacting with a Business Facade.

BEHAVIOR DEFINED

A PED I/O Controller (IC) supports the request/response life cycle and typically does not change state. Martin Fowler describes this pattern straight-forwardly:

“The controller’s job is to take the… input and figure out what to do with it.”

Some technologies use a specific pattern language; in the RESTful arena a similar class might be labelled a “resource”. However,  PED’s pursuit of a Unified Pattern Language favors ubiquitous pattern names that are technology agnostic. 

Structural Characteristics

Characteristic

Recommended

Note

 Extend Base Class Y  
 No-arg Constructor Y 1.
 CDI Scoping Optional  
 Instance State Optional  
 Static Public Methods (enum) N  
 Fluent Methods N  
 Delegate to Helper Optional  
 Worker-thread Safe N 2.
  1. A no-argument constructor enables scoping with a CDI bean instance/proxy.
  2. We recommend using an IC in a main thread context.
Source Example