Skip to content

First pass at polymorphism improvements - #3264

Draft
randomPoison wants to merge 2 commits into
google:mainfrom
randomPoison:legare/polymorphism-rework
Draft

First pass at polymorphism improvements#3264
randomPoison wants to merge 2 commits into
google:mainfrom
randomPoison:legare/polymorphism-rework

Conversation

@randomPoison

Copy link
Copy Markdown
Contributor

After teaching the Idiomatic course a couple of time, I have some ideas for how to iterate on and improve the polymorphism section. The main things I want to address are:

  • Differentiate between "static" polymorphism (generics) and "dynamic" polymorphism (enums and dyn), since those serve different purposes: Generics are primarily a tool for code reuse and building abstractions over types, enums and dyn provide tools for dynamically handling different types at runtime in a uniform way.
  • Emphasize enums more heavily. The current slides don't really mention enums, which I think is a big oversight since enums are our primary tool for doing dynamic polymorphism.
  • Compare enums and dyn to help students reason about which one is the best solution for any given problem.
  • Shift material out from the OOP section into more dedicated sections on generics, enums, and dyn. I think we can then flesh out the OOP section further by having it talk about how inheritance is used to solve certain problems and then talk about how we solve those same problems in Rust.

The things that this draft PR does currently are:

  • Break things up into sections on generics, enums, and dyn.
  • Various non-OOP-specific slides moved into the new sections.
  • Add new intro slides contextualizing polymorphism and how it comes up in a static language like Rust, and introducing our 3 flavors of polymorphism.
  • Add slides on enums and how they're used for polymorphism.
  • Add slide directly comparing enums and dyn.

I intend to teach from these slides in my next couple of classes and iterate on them more based on how that goes, but let me know if this direction makes sense or if you have ideas for further improvements or additions~! 🦀

- Break things up into sections on generics, enums, and dyn.
- Various non-OOP-specific slides moved into the new sections.
- Add new intro slides contextualizing polymorphism and how it comes up in a static language like Rust, and introducing our 3 flavors of polymorphism.
- Add slide directly comparing enums and dyn.
- Add slides on enums and how they're used for polymorphism.
@fw-immunant
fw-immunant self-requested a review August 26, 2026 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant