Agenda

Design Service-Oriented Objects that use their
state to decide how to behave.

Use Messengers to transmit information.

The State Pattern.

Use Stateless Objects as pluggable nuggets of behavior.

Use Immutables to represent values of abstract data types.

Significance of the Object

Guideline: Appreciate the significance of the object.

For people who develop software, not computers that run software

Objects are machines that programmers use as tools

Good = works well + easy to use

Like a television set

Managing Complexity

An understandable unit: Program complexity partitioned into areas of
responsibility

A discussable unit: Has meaning in code and conversation

Name implies Services (interface syntax + semantics)

A debuggable unit: Helps you manage, not eliminate, complexity

A testable unit: Encapsulates behavior

Managing Change

A flexible unit: Separation of interface and implementation enables you
manage change by minimizing coupling

An abstract unit: Behavior-oriented contracts more abstract than data-oriented

A impenetrable unit: Can't go around the interface

James Gosling: What is the API to Windows? Nobody knows. In fact, even Microsoft doesn't know what the Windows API is.
Because they publish an API, but lots of people sneak in through back doors. [...]

Because there isn't a really good, strong interface notion in C, people just sort of reach in through the back doors.
And they do God knows what. And so when Microsoft goes to release a new version of Windows, what
they essentially have to do is test everything.

It was a very important property of interfaces that they are very strict. That wasn't just me deciding to be
nasty. That was the world is madness if the contracts aren't strict. Because then all of a sudden--the whole
notion of object-oriented programming falls apart.
You lose the ability to unplug this and plug that in. If you don't
know what the shape of the plug is, how do you know it can plug in?

Discussion

Guideline: Appreciate the significance of the object.

Object as Service

Guideline: See objects as bundles of services, not bundles of data.

Each method offers a service; Each set of methods offers a service.

Thus, each object offers a service through its interface.

Most objects have state to help them provide their bundle of services.