16 Polymorphism
This chapter covers
- What polymorphism is
- The benefits of polymorphism and when to use it in an API
- How best to structure polymorphic resources
- Why polymorphic methods should be avoided in resource-oriented APIs
When building software systems, polymorphism provides the ability for objects to take many different forms, typically relying on explicit object inheritance. In this pattern, we’ll explore how to translate this powerful tool from the world of object-oriented programming to that of resource-oriented API design. We’ll also investigate a few guidelines for when to rely on polymorphic resources over completely independent resources.
16.1 Motivation
In object-oriented programming (OOP), polymorphism is the idea of using ...
Get API Design Patterns now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.