InfoQ

Presentation

Recorded at:
Recorded at

How to Design a Good API & Why it Matters

Presented by Joshua Bloch on Nov 21, 2006

Community
Architecture,
Java
Topics
Programming
Tags
JavaPolis
Summary
A well-written API can be a great asset to the organization that wrote it and to all that use it. Given the importance of good API design, surprisingly little has been written on the subject. In this talk (recorded at Javapolis), Java library designer Joshua Bloch teaches how to design good APIs, with many examples of what good and bad APIs look like.

Bio
Joshua Bloch is a Principal Engineer at Google. He led the design and implementation of numerous Java platform features, including the Java Collections Framework. He is the author of the Jolt Award-winning book Effective Java. He holds a Ph.D. in Computer Science from Carnegie-Mellon University and a B.S. in Computer Science from Columbia.

About the conference

20 comments

Watch Thread Reply

Excellent! by Rafael de F. Ferreira Posted Nov 23, 2006 1:03 PM
Re: Excellent! by jacky chen Posted Jun 14, 2007 9:55 PM
Verrrry Nice by Vinu Varghese Posted Nov 23, 2006 2:17 PM
Well worth taking the time to watch. by tanguy rademakers Posted Nov 23, 2006 5:21 PM
Excellent! by Gabriel Ka. Posted Nov 26, 2006 6:54 AM
Re: Excellent! by karan malhi Posted Nov 26, 2006 9:12 AM
Makes a lot of activities in your brain by Alex Krotov Posted Dec 2, 2006 12:13 AM
Any chance in making your videos available in some sort of offline format? by Jason Finch Posted Dec 18, 2006 1:59 AM
Re: Any chance in making your videos available in some sort of offline form by Oliver Gierke Posted Dec 19, 2006 2:52 AM
Re: Any chance in making your videos available in some sort of offline form by jacky chen Posted Jun 14, 2007 9:35 PM
How to Design a Good API & Why it Matters by Mike Vladi Posted Dec 24, 2006 3:15 PM
Re: How to Design a Good API Why it Matters should avalible offline by nazish ali Posted May 2, 2007 7:48 AM
We need VideoCasts by Luiz Alberto Silva Oliveira Posted Jun 11, 2007 12:02 PM
Clear explanation of designing a good API. by YoungHyun Kim Posted Sep 4, 2007 11:52 PM
Excellent - as always by Georges Polyzois Posted Sep 5, 2007 2:48 AM
Download presentation by jimens lima Posted Oct 1, 2008 9:56 AM
Re: Download presentation by Jirapong Nanta Posted Oct 11, 2008 12:33 AM
Good article by zhang bin Posted Mar 6, 2009 3:41 AM
I love this website by Jerome St-Pierre Posted May 23, 2009 9:01 AM
It's probably just me... by Dag Johansen Posted Jun 12, 2009 3:18 AM
  1. Back to top

    Excellent!

    Nov 23, 2006 1:03 PM by Rafael de F. Ferreira

    Best presentation I've seen in a while.

  2. Back to top

    Verrrry Nice

    Nov 23, 2006 2:17 PM by Vinu Varghese

    Thanks for such a nice presentatiion

  3. Back to top

    Well worth taking the time to watch.

    Nov 23, 2006 5:21 PM by tanguy rademakers

    A great presentation, both interesting and well presented. Thanks InfoQ.

  4. Back to top

    Excellent!

    Nov 26, 2006 6:54 AM by Gabriel Ka.

    Sure to be not original at all but this presentation is excellent!
    Worth the time to watch.

  5. Back to top

    Re: Excellent!

    Nov 26, 2006 9:12 AM by karan malhi

    Very good presentation

  6. Back to top

    Makes a lot of activities in your brain

    Dec 2, 2006 12:13 AM by Alex Krotov

    Though I have 6 years of experience in Java field and more than half of advices/tips are already integrated in my head for long time, Joshua's presentation freshed my mind and revealed things I didn't consider closely.
    Thanks a lot for providing this video!
    It worth seeing twice if you're engaged in API (not only Java) design.

  7. Any chance in making your videos available in some sort of offline format?

  8. Some sort of podcast would be perfect... ;)

  9. Back to top

    How to Design a Good API & Why it Matters

    Dec 24, 2006 3:15 PM by Mike Vladi

    Mr. Bloch = Clear thinking + PhD + Occam's razor approach.

  10. This presentation clear my most of the points .because he addressed the very good points of an API design.I agree with Alex. This is not only JAVA .
    It's better to get it offline due to streaming prblms.

  11. Back to top

    We need VideoCasts

    Jun 11, 2007 12:02 PM by Luiz Alberto Silva Oliveira

    I want to reforce the question about off-line videos, WE need it!!!
    Congratulations, the presentation is Excellent!

  12. yes is very fun to listem such video ,i think its useful for listener

  13. Back to top

    Re: Excellent!

    Jun 14, 2007 9:55 PM by jacky chen

    where i can download this video

  14. Back to top

    Clear explanation of designing a good API.

    Sep 4, 2007 11:52 PM by YoungHyun Kim

    Actually, English is not my native language, but I could understand this presentation as he explained as well. Thanks Joshua & Thanks infoQ~!

  15. Back to top

    Excellent - as always

    Sep 5, 2007 2:48 AM by Georges Polyzois

    Thanx for this excellent presentation - as always by Joshua B.

    Pleas can we have an offline version!!

  16. Back to top

    Download presentation

    Oct 1, 2008 9:56 AM by jimens lima

    Where can i download presentation (ppt,pdf,...)?

  17. Back to top

    Re: Download presentation

    Oct 11, 2008 12:33 AM by Jirapong Nanta

    Hi all,
    i just google around ...
    pdf can download at - lcsd05.cs.tamu.edu/slides/keynote.pdf

    Enjoy

  18. Back to top

    Good article

    Mar 6, 2009 3:41 AM by zhang bin

    Good article

  19. Back to top

    I love this website

    May 23, 2009 9:01 AM by Jerome St-Pierre

    I just watched this presentation 4 years later and everything said is still actual and not only for Java. This is why I love design so much.

    This man is a good speaker and I think these Javapolis events looks very cool, even if I am a .NET developer.

    Thanks for the high quality content, I never got so addicted to a website before.

  20. Back to top

    It's probably just me...

    Jun 12, 2009 3:18 AM by Dag Johansen

    I don't get the idea with the ThreadLocal and the keys. Since Bloch is such a luminary I can only suppose that there is a good reason behind the design he came up with, but I can't see it. So, in the interest of learning, and I figure I may not be the only one who doesn't get it, I will simply ask and hope someone can enlighten me (us, if I am not alone in this).



    I do understand the issue with the string keys being "global namespace". Of course it's not really a namespace at all, but string comparison does mean different parts of the code could more easily overwrite one another's data. However, what is the point of using thread locals anyway? I thought the idea was to enable any object that participates in the work of a thread to easily share information *without* having to distribute a reference to anything all over the place. If so, replacing the string key with an object key negates the whole point of using thread locals in the first place.



    Furthermore, if I have to ensure all objects that need to access some data have a reference to the Key instance, isn't it just as easy then to instead ensure they have a reference to whatever is associated with that key?



    What is it that I have misunderstood or simply not understood?



    I don't want to risk this becoming a debate about whether Java or .net is better, but I have to say it seems to me the .net solution (in which one places a ThreadStatic attribute on a static field to indicate it should be stored as a thread-local variable) is rather better. It solves the problem of accidentally using the same variables where one meant to use different ones, requires extremely little code, is transparent to the user of the class declaring the static member (of course the field should be private and exposed via a property, but this changes none of what I've said), and does completely away with the need to write boilerplate code to obtain references to these objects.


    public class Log
    {
    [ThreadStatic]
    static Log current;

    static public Log Current
    {
    get { return current; }
    set { current = value; }
    }

    // .... Log implementation
    }




    Like this, whenever some operation starts that we'd like to log we'll simply create the log with
    Log.Current = new Log();
    and then any code that is called in the context of a current log can obtain a reference to it with
    Log log = Log.Current;
    or just use Log.Current.WriteLine() and so on directly.

Educational Content

QCon SF Keynote: Techie VC's Talk About Trends & Opportunities

Kevin Efrusy and Salil Deshpande talk about what makes a business successful or not, presenting three actual cases they have been involved with: Hyperic, G2One, SpringSource.

Project Lead Mark Fisher Discusses the Spring Integration Project

InfoQ talks to Mark Fisher, project lead for the Spring Integration project, about the framework.

How HTML5 Web Sockets Interact With Proxy Servers

Peter Lubbers explains in this article how HTML5 Web Sockets interact with proxy servers, and what proxy configuration or updates are needed for the Web Sockets traffic to go through.

Rails in the Large: How Agility Allows Us to Build One Of the World's Biggest Rails Apps

Neal Ford shows what ThoughtWorks learned from scaling Rails development: infrastructure, testing, messaging, optimization, performance.

Stuart Halloway on Clojure and Functional Programming

Stuart Halloway discusses Clojure and functional programing on the JVM in depth, and touches on the uses of a number of other modern JVM languages including JRuby, Groovy, Scala and Haskell.

Oren Teich and Blake Mizerany on Heroku

Oren Teich and Blake Mizerany talk about the technology behind Heroku and the benefits of the new add-on system.

Security for the Services World

Chris Riley presents security issues threatening service based systems, examining security threats, presenting measures to reduce the risks, and mentioning available security frameworks.

Navigating The Rapids:Real-World Lessons in Adopting Agile

This talk investigates technical issues encountered when moving to an Agile process.