Java Omnibus
OOAD & Architecture / GoF patterns / Structural / Facade Pattern in Java
GoF Structural Java Order Management
GoF Pattern

Facade is best when a subsystem is too noisy or fragmented and clients need a simpler entry point.

Provide a unified higher-level interface that makes a subsystem easier to use.

Intent

What the pattern is trying to do

Provide a unified higher-level interface that makes a subsystem easier to use.

Problem

What force creates the need

Clients must coordinate too many subsystem classes and low-level steps just to achieve one business-level outcome.

Solution

How the pattern responds

Create a facade that hides subsystem chatter behind a simpler, task-oriented API.

Structure

How the moving parts fit together

A facade exposes coarse-grained methods and internally orchestrates a set of subsystem collaborators without forcing clients to know the details.

Java Example

Java example in the Order Management domain

Facade Pattern in Java example
package org.javaomnibus.ecommerce.gof.structural;

public final class OrderPlacementFacade {
    private final InventoryService inventoryService;
    private final PaymentService paymentService;
    private final ShipmentService shipmentService;

    public OrderPlacementFacade(
        InventoryService inventoryService,
        PaymentService paymentService,
        ShipmentService shipmentService
    ) {
        this.inventoryService = inventoryService;
        this.paymentService = paymentService;
        this.shipmentService = shipmentService;
    }

    public void place(Order order) {
        inventoryService.reserve(order);
        paymentService.capture(order);
        shipmentService.schedule(order);
    }
}
Code Walkthrough

Step by step

  1. Clients call one business-oriented method instead of orchestrating several services directly.
  2. The subsystem remains available internally, but most callers no longer need its low-level choreography.
  3. Facade is about simplification and coordination, not interface translation or access mediation.
  4. It is especially useful when application services would otherwise duplicate the same orchestration logic.
When To Use

Where this pattern helps

  • When many clients need a simpler entry point into a noisy subsystem
  • When business flows repeatedly coordinate the same lower-level collaborators
When Not To Use

When a simpler design is better

  • When clients genuinely need fine-grained subsystem control
  • When the wrapper is only translating one interface or guarding access to one object
Trade-Offs

What this pattern costs

  • A facade can become too broad if every use case is pushed into one class
  • Over-simplification can hide important subsystem variation from advanced callers
Modern Relevance

How this fits today

Facade is common in Java service layers, orchestration modules, and integration boundaries where teams need stable entry points into broader subsystems.

Common Misuse

Where teams get it wrong

Calling every service class a facade dilutes the pattern; the key is subsystem simplification, not just 'one class calls a few others.'

Related Patterns

Compare with nearby choices


What To Read Next