Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
The interview went great! But the traffic jam this morning got Mike thinking about how he could improve his navigator.
Mike could copy the Navigator class code and paste it into two more classes. Then his program could store three routes at once.
Right! Maintaining three copies of the same code is really messy. A lot of problems you need to solve need a way to represent one thing a bunch of different times. In this case, it’s a bunch of routes. But it could be a bunch of turbines, or dogs, or music files, or anything. All of those programs have one thing in common: they always need to treat the same kind of thing in the same way, no matter how many of the thing they’re dealing with.