Discussion: Succinct Code

You use the concepts of abstraction and encapsulation every day. You may call it “understanding the bigger picture” or “seeing the forest for the trees.” It helps you manage the complexity of your tasks without getting bogged down in the details. Think about the ways in which you apply abstraction to your tasks or decisions. Think about the ways you apply encapsulation to your tasks and organizing your work. In the context of computer programming, abstraction requires you to eliminate detail from an object to identify its defining characteristics—the things that make the object “tick.”

Give an example that describes how you have used abstraction as a strategy and how it was beneficial to you. Be as specific as possible about the strategy and why you feel it worked well. How was encapsulation applied in your strategy?

Next, describe a situation in which abstraction or encapsulation may not yield the best results. After all, boiling a group of things down to their defining, component attributes may overlook unique and special characteristics of that group’s members, and this could lead to a less-than-ideal process or decision. Once again, be specific about your method and the results.

Sample Solution