June 2019
Beginner to intermediate
770 pages
19h 24m
English
The idea behind a callable object is that we have a class interface focused on a single method. This is also true for simple function definitions.
Some objects have multiple relevant methods. A Blackjack Hand, for example, has to add cards and produce a total. A Blackjack Player has to place bets, accept hands, and make play decisions (for example, hit, stand, split, insure, and double down). These are more complex interfaces that are not suitable to be callables.
The betting strategy, however, is a candidate for being a callable. While it will be implemented as several methods to set the state and get a bet, this seems excessive. For this simple case, the strategy can be a callable interface ...
Read now
Unlock full access