liveBook · Manning

Object-oriented programming

As explained in Data-Oriented Programming in Java

Object-oriented design is a software design approach that organizes functionality around objects, their interfaces, and collaborations.

Object-oriented programming organizes software around objects, their interfaces, and collaborations. Its central design question is “what does it do?”—especially which functionality an object should offer and how other objects consume it. section 10.2

A practical design starts by identifying common behavior and turning it into abstractions. In an ingestion system, downloading files, transforming them, and saving records become collaborating strategies behind BulkLoader and Transformer interfaces. section 10.2

An object-oriented ingestion loop

A manifest-driven Java service can select a Transformer and BulkLoader through a factory, then process account, invoice, and dispute files through the same loop. Repositories hide persistence, while concrete transformers handle each file format. This keeps the main workflow close to the domain story, but adds interfaces, factories, and implementation classes that must be coordinated. section 10.2

Object orientation is not a demand to hide every piece of data behind behavior. Data-oriented design complements it by making representations and meanings explicit. Good data types prevent illegal states and make object boundaries easier to understand; objects remain useful for encapsulating state and enforcing boundaries. section 1.7 section 1.1

Use object-oriented design when you need to:

  • Separate responsibilities behind interfaces such as Transformer and BulkLoader. section 10.2
  • Swap implementation strategies through factories or dependency injection. section 10.2
  • Encapsulate persistence and external-system details behind repositories. section 10.2
  • Question abstractions that make tests and central workflows depend on distant system details. section 10.2
Figure 10.2 Identifying common behaviors

Use the figure to trace how a concrete ETL workflow is decomposed into common behaviors and object interfaces. section 10.2

How Data-Oriented Programming in Java covers it

How deep it goes
Works through interfaces, strategies, repositories, factories, tests, and abstraction leakage, while stopping short of exhaustive pattern design.
Examples
Uses Java ingestion of account, invoice, and dispute files through transformers, repositories, factories, mocks, and manifest-driven loops.
What it assumes
Assumes Java familiarity and contrasts object-oriented design with explicit data modeling rather than teaching either from zero.
What you can do after
Build it from scratch by decomposing a workflow into interfaces, implementations, repositories, factories, and collaborating objects.
How it connects
Connects interfaces with the Strategy Pattern, Factory Pattern, Template Pattern, repositories, and data-oriented programming.

Also explained in

Compare how 13 books explain object-oriented programming →

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.