Essence of Dispatch

Damien Cassou, St├ęphane Ducasse and Luc Fabresse

Remember: Implementing not in Two Methods

Not implementation

Stepping Back

Ok So What?

Message Sends Act as Case Statements

Sending a Message is Making a Choice


Can we implement the same implementation for Not in only one class?

Classes Play Case Roles

A Class Hierarchy is a Skeleton for Dynamic Dispatch

Compare the solution with one class vs. a hierarchy

One single class vs. a nice hierarchy.

Advantages of Class Hierarchy

One single class vs. a nice hierarchy.

More modular: We can package different classes in different packages

Let the Receiver Decide

Avoid Conditionals

Summary: Cornerstone of OOP