Abstraction and Encapsulation

Learning Goals

  • Students are able to use classes and methods to make abstractions that improve code quality
  • Students are able to write classes that demonstrate encapsulation of data
  • Students are able to explain how their code achieves abstraction and encapsulation

Part 1: Solo Research (10 minutes)

Research the following questions:

  1. What is Abstraction?
  2. What is Encapsulation?

Part 2: Group Chart Paper (20 minutes)

As a group, create a chart paper with the following:

  1. What is Abstraction?
  2. Explain abstraction using a metaphor.
  3. What is Encapsulation?
  4. Explain encapsulation using a metaphor.

Part 3: Paired Coding (30 minutes)

  1. Clone down Driving Simulator.
  2. With your partner, discuss some of the additions suggested in the README. Note: you should not actually implement the additions right now. Simply talk through them.
  3. Discuss the questions in the README.
  4. Finally, take some time to refactor the existing code.

Checks for Understanding

  • What is Abstraction? Why is it important?
  • What is Encapsulation? Why is it important?

Lesson Search Results

Showing top 10 results