CSE Roadmap

Core tier · about 2 hours · 7 parts

Part 1 of 7 · 1 min read

Why this page comes fifth

In this module you will

  • Define polymorphism and dynamic binding in plain words.
  • Write a subtype that overrides a method and call it through the parent type.
  • Replace a type tag and a switch with a class hierarchy.
  • Spot when a chain of if or instanceof tests signals missing polymorphism.
  • Say what makes a replacement safe (an early look at the Liskov idea of Level 2).

Modules 3 and 4 gave interfaces and reuse. Polymorphism is what makes those interfaces useful at run time, and it is the main tool for removing if chains. The sources are "Design Patterns" (GoF), chapter 1, and "Effective Java" (EJ) Item 23. Code was compiled and run before it was written here. Numbers marked "made up" only show the idea.