Do you remember the last time you stuffed a bunch of different algorithms in the same block of code and used spaghetti of
switch-case conditional statements to determine which one to use? The algorithms could be a bunch of functions/methods of similar classes that solve related problems. For example, I have a routine that validates some input data. The data itself can be of any data type (e.g.,
NSInteger, etc.). Each of the data types requires a different validation algorithm. If we can encapsulate each algorithm as an object, then we can eliminate a bunch of
switch-case statements for data type checking in order to determine what algorithm to use.
In object-oriented software design, we ...