liveBook · Manning

Strategy pattern

As explained in Data-Oriented Programming in Java

The Strategy pattern encapsulates interchangeable implementations of an operation behind a common interface.

The Strategy pattern separates a workflow from interchangeable implementations of its operations. In manifest-driven ingestion, transformers convert cloud files into records and bulk loaders persist them behind shared interfaces. section 10.2

Manifest-driven ingestion

The loop retrieves each cloud object, asks the selected Transformer for records, and passes them to the matching BulkLoader. Adding a file type means registering new strategies rather than rewriting the loop.

How Data-Oriented Programming in Java covers it

How deep it goes
Defines interfaces, implementations, factory selection, and orchestration, while deferring broader abstraction through Template Pattern.
Examples
Uses account, invoice, and dispute files, transformers, repositories, a manifest, and a shared UpdatesAndInserts record.
What it assumes
Assumes familiarity with object-oriented interfaces, repositories, file ingestion, and basic Java collections.
What you can do after
Apply it via Java interfaces and a factory to add ingestion behaviors without changing the main processing loop.
How it connects
Connects object-oriented design with interfaces, factories, repositories, and the Template Pattern.

Also explained in

Compare how 4 books explain strategy pattern →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Data-Oriented Programming in Java. The section links point to the parts of the book it draws on.