< Previous | Contents | Next >
By writing and calling functions, you practice what’s known as abstraction. Abstraction lets you think about the big picture without worrying about the details. In this program, I can simply use the function instructions() without worrying about the details of displaying the text. All I have to do is call the function with one line of code, and it gets the job done.
You might be surprised where you find abstraction, but people use it all the time. For example, consider two employees at a fast-food restaurant. If one tells the other that he just filled a Number 3 and “sized it,” the other employee knows that the first employee took a customer’s order, went to the heat lamps, grabbed a burger, went over to the deep fryer, filled their biggest cardboard container with french fries, went to the soda fountain, grabbed their biggest cup, filled it with soda, gave it all to the customer, took the customer’s money, and gave the customer change. Not only would this level of detail make for a boring conversation, but it’s unnecessary. Both employees understand what it means to fill a Number 3 and “size it.” They don’t have to concern themselves with all the details because they’re using abstraction.