How To Design A Good API and Why it Matters
Google TechTalksYouTube ↗
Further reading 2
What does a module promise its callers? →Try replacing a module whose callers rely on its incidental return order. Start with what the interface says, then trace the decisions it hides and the behaviors people have learned to expect.This video helps answer · Which choices should an API leave out?Can one record tell you both now and then? →Two reads disagree. First ask which moment each value describes, then who can change it. Keeping history and coordinating writes solve different problems.This video helps answer · Does hiding mutation remove coordination costs?
Caption notes
Bloch recommends designing APIs around concrete uses, testing them with clients early and omitting doubtful features before compatibility makes removal difficult.
Original passages · 7
you should start before you've
implemented the APInot be able to take it out once you put it into an API.don't make the client do
anything the module could do.programmatic access to
all data that is also available in string form.feels like an immutable
object, except that it has state inside it.APIs can be among a company's greatest assetsWhen it doubt, leave it out.