INF1B: Week 9: Abstract Classes and Interfaces; Object Design

Week Highlights

By the end of this week, you should understand:

From Lecture 15: 

  • what abstract classes and abstract methods are and when you might use them
  • Why you cannot create an instantiation of an abstract method in the general case
  • How to creating instantiations of abstract methods by extending them
  • When you should use an abstract class and when a concrete class
  • What interfaces are and when you would want to use them
  • Why the Deadly Diamond of Death is not allowed in Java
  • How to implement an interface
  • Why Java allows a class to implement several interfaces but not to extend multiple abstract classes
  • What the comparable interface is and when to use it

Lecture 15: Abstract Classes and Interfaces

Lecture 15 ➡ Objects First: read Chapter 12. Further Abstraction Techniques.

Lecture 16: Object Design

Lecture 16 ➡ Objects First: read Chapter 8. Designing Classes.

Lecture 16 ➡ see last slide for web resources.

Tutorial: Object Design

This week we will be looking at making design decisions when creating your own classes.

Instructions and materials: 

Solutions: 

Lab exercises

This week's lab exercises cover inheritance and enums. There are three core exercises.

What should I be doing with assessment?

Continue working on assignment 2 part 2.

License
Creative Commons - Attribution Share A Like