Skip to content

Lesson 7 (Interfaces)

Courtney Frey edited this page Apr 14, 2022 · 3 revisions

Lesson 7: Interfaces and Polymorphism

In the prep work for this lesson, the students learned

  1. What polymorphism is.
  2. What interfaces are and the difference between interfaces and abstract classes.
  3. Different interfaces that are a part of Java, and how they can be used in our code.
  4. Best practices around unit tests and interfaces.

Announcements

  1. Check with your course manager for any important announcements.

For Part-Time Students:

  1. Graded Assignment #2 is due soon!

For Full-Time Students:

  • Welcome to Days 10-13!
  • Assignment 2 due by end of Day 14
  • Day 10:
    • Lesson 7 prep work in morning
    • Assignment 2 work time in afternoon
  • Day 11:
    • Lesson 7 lecture and studio in morning
    • Self-Assessment 1 in afternoon
    • Assignment 2 work time after Self-Assessment
  • Days 12 & 13:
    • Work days for Assignment 2

Large Group Time (Instructor)

Lesson 7 Topics That Require Careful Attention

  1. Polymorphism has a deceptively simple definition, but can be difficult to grasp. Have students share what polymorphism is to them and share examples to drive home this particular pillar of OOP.
    1. These examples could be continuations from the reading, such as the Cat and HouseCat classes, or the Temperature interface, the Fahrenheit class, and the Celsius class.
  2. Interfaces may not seem to serve much of a purpose to some. Go over some sample code or class diagram and explain why those behaviors were assigned to an interface. To drive it home, share what behaviors might go in an abstract class.
    1. For the sample, it would be good to share an example that is similar to something you may have worked on. Part of the reason some people may not be seeing the purpose in interfaces is because of the size of the application that we are building. In larger applications, the usefulness of interfaces becomes evidently clear. Also, sharing something like this can drive home that coding interfaces are an essential skill for Java programmers.

Small Group Time: Lesson 7 Studio (TA Notes)

  1. For this studio, go over with your group their thoughts on which behaviors are going to belong to the interface and which ones are going to belong to the abstract class. After everyone feels comfortable with the theory, they can code away!
  2. Remember to check in with every student in your group about how things are going and why they are making the design decisions they are making.