Modern Java API Design
summary
Covers practical rules for Java library APIs: use consistent return types (Optional, empty collections, Stream.empty), keep parameter order or introduce an options/arguments type to avoid telescoping, prefer final and package-private for evolvability, avoid leaking third‑party types, and add tooling (custom checkstyle rules) to block implementation packages from becoming public. Notes sealed classes (JEP 360 preview in JDK 15) as a future API control, cites Azure SDK for Java as a real-world implementation and urges moving beyond Java 8 to Java 11+.
AI-written summary · about
chapters (14)
- 0:00Introduction to API design
- 3:04What defines a good API
- 4:46Importance of consistency
- 5:59Handling return types
- 7:20Method naming conventions
- 8:47Parameter ordering and design
- 10:42Restraint in feature design
- 14:21Using access modifiers
- 16:02Hiding implementation details
- 18:54Using sealed classes
- 20:15Developer empathy
- 21:02Documentation best practices
- 23:12Moving beyond Java 8
- 24:26Conclusion and resources
related talks
49mLet's make a contract: the art of designing a Java API
40mFuture-Proofing Java: The Art of Crafting Resilient APIs
51mLet's make a contract: the art of designing a Java API
44mMastering Resilient Java API Design: From Principles to Practice
51mRevisiting Effective Java in 2020
54mEffective JavaSE9 to 15APIs/Lang features, makes your life easier.
49mThe Good, the Bad and the Ugly of Java API design
01h 11mModern Java: This is not your father's Java anymore
