/**
* Copyright (C) 2022 by Martin Robillard. See https://codesample.info/about.html
*/
package e2.chapter8;
/**
* An object that observes a CardStack. Design with push data flow.
*/
public interface CardStackObserver {
default void pushed(Card pCard) {}
default void popped(Card pCard) {}
default void cleared() {}
}
Chapter 8, insight #11
If it is often the case that observers implement callbacks by doing nothing, consider using adapter classes or default methods
Chapter 8, insight #11
If it is often the case that observers implement callbacks by doing nothing, consider using adapter classes or default methods
Chapter 8, insight #10
An abstract observer can define multiple callbacks. Abstract observer interfaces can also be split up in smaller observer interfaces to afford more flexibility in defining how observers can respond to events
Chapter 8, insight #10
An abstract observer can define multiple callbacks. Abstract observer interfaces can also be split up in smaller observer interfaces to afford more flexibility in defining how observers can respond to events