From APIDesign

Jump to: navigation, search

All the code snippets shown in the Practical API Design book are extracted from real projects. As such it is guaranteed they are correct, they compile and can even be executed, debugged and tested.

Moreover, it is often not enough to see just a few lines of code in middle of a page, readers are recommended to get the whole tree of sources, including their history and play with them for real. Preferably use Mercurial to clone the sources Hg repository:

$ hg clone



In order to use the sample sources you may need:

  • At least JDK7 or [[JDK]8 - necessary for compilation and execution
  • At least Ant 1.8.1 - allows simple compilation and execution from command line
  • At least NetBeans IDE 6.9 - all projects are configured to smoothly open in NetBeans IDE

If you managed to successfully start NetBeans IDE, you probably have everything necessary installed on your computer.


Those that prefer ZIP over Mercurial (for example to get also all necessary libraries with the sources) can download the latest published build from our continuous build server. Download the latest version of, unzip it on your local computer. Start NetBeans IDE and open individual projects as needed.


It is always better to build the root project:

$ cd samples # in case of [[Mercurial]] checkout
$ ant build.xml # or from the IDE

before opening its sub-projects in the IDE. Failing to do so may cause the projects to show broken references (due to missing libraries that need to be downloaded first in the Mercurial case). Btw. in case you need to perform really clean build and download all libraries once again, you can

$ cd samples # in case of [[Mercurial]] checkout
$ rm -r libs/dist

Funny Stories

My Hudson server crashed in early months of 2014. I had to configure it from scratch. While doing so, I forgot to configure the job to produce file with sources. Has anyone noticed? Nobody sent me an email! Just yesterday Jáchym, my co-worker, who I torture by forcing him to read TheAPIBook and become good API designer, stopped in my office and timidly asked: Where can I get the sources? There is no ZIP file!

For a while I tried to blame him for not using Mercurial, but after a while I realized the problem is on my side. As a result, the zip file with sources is back as of Aug 8, 2014. Will anyone use them? It would be nice as reading Practical API Design book without having whole sources at your hand is like trying to understand Swing just by reading its Javadoc.

Let me know (Jáchym, you have to) whether you found the sources useful.


Personal tools