< Previous | Contents | Next >

Understanding Abstraction

By writing and calling functions, you practice whats 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 customers 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 customers money, and gave the customer change. Not only would this level of detail make for a boring conversation, but its unnecessary. Both employees understand what it means to fill a Number 3 and size it.They dont have to concern themselves with all the details because theyre using abstraction.