In the dark ages of programming, functions acted on data. To slice your bread, you passed a bread data structure to a slice function:
Then came object oriented programming. Instead of having an external function slice our bread, we would ask the bread to slice itself by calling the slice method on a bread object:
Obviously a vast improvement.
Now object oriented programming has become more refined. First we create a bread-slicing object and then we simply pass bread objects to the slice method on the bread-slicer:
BreadSlicer slicer = new BreadSlicer(); slicer.slice(bread);
More food analogies to software development
For a daily dose of computer science and related topics, follow @CompSciFact on Twitter.