Sources

From APIDesign

(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
-
The [[TheAPIBook|Practical API Design]] book comes with huge amount of additional [[sources]]. All of them, including their history, are available online. This page provides basic information for those who want to study them.
+
All the code snippets shown in the [[TheAPIBook|Practical API Design]] book
 +
are extracted from real projects. As such it is guaranteed they are correct, they compile and can even be executed, [[debugger|debugged]] and tested.
 +
 
 +
Moreover, as it is often not enough to see just 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]] [http://source.apidesign.org/hg/apidesign/ repository]:
 +
 
 +
<source lang="bash">
 +
$ hg clone http://source.apidesign.org/hg/apidesign/
 +
</source>
=== Environment ===
=== Environment ===
In order to use the sample sources you may need:
In order to use the sample sources you may need:
-
* [[JDK]] 1.6.0 - necessary for compilation and execution
+
* At least [[JDK]] 1.6.0 - necessary for compilation and execution
-
* [[Ant]] 1.8.1 - allows simple compilation and execution from command line
+
* At least [[Ant]] 1.8.1 - allows simple compilation and execution from command line
-
* [[NetBeans]] IDE 6.9 - all projects are configured to smoothly open in [[NetBeans]] IDE
+
* 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.
=== Download ===
=== Download ===
-
The sources for sample examples are processed, verified and published daily on API Design [http://hudson.apidesign.org/job/samples continuous build server]. Download the latest version of apidesign-XYZ.zip, unzip it on your local computer. Start [[NetBeans]] IDE and open individual projects as needed. History of all the modifications can be found in our [[Mercurial]] [http://source.apidesign.org/hg/apidesign/ repository]. To obtain them use:
+
Those that prefer [[ZIP]] over [[Mercurial]] (which [[I]] don't understand) can download the latest published build from our
 +
[http://hudson.apidesign.org/job/samples continuous build server]. Download the latest version of apidesign-XYZ.zip, unzip it on your local computer. Start [[NetBeans]] IDE and open individual projects as needed.
-
<source lang="bash">
 
-
hg clone http://source.apidesign.org/hg/apidesign/
 
-
</source>
 
=== Usage ===
=== Usage ===
-
You need to run <tt>build.xml</tt> before opening the projects in the IDE. Otherwise the projects have unsolvable broken references.
+
You need to run <tt>build.xml</tt> before opening the projects in the IDE. Otherwise the projects have unsolvable broken references (due to missing [[libraries]] that need to be downloaded).
-
 
+
-
The build fails on JDK 1.5 because of <tt>ServiceLoader</tt> usages. This needs to be mentioned somewhere, and <tt>build.xml</tt> should perhaps skip that example when building on 1.5.
+

Revision as of 11:26, 6 August 2014

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, as it is often not enough to see just 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 http://source.apidesign.org/hg/apidesign/

Environment

In order to use the sample sources you may need:

  • At least JDK 1.6.0 - 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.

Download

Those that prefer ZIP over Mercurial (which I don't understand) can download the latest published build from our continuous build server. Download the latest version of apidesign-XYZ.zip, unzip it on your local computer. Start NetBeans IDE and open individual projects as needed.


Usage

You need to run build.xml before opening the projects in the IDE. Otherwise the projects have unsolvable broken references (due to missing libraries that need to be downloaded).

Personal tools
buy