X

APIs take center stage at Oracle-Google trial

The scene of the Oracle-Google trial Thursday was more like a computer science classroom than a courtroom as the witnesses explained the inner workings of Java and APIs.

Dan Farber
5 min read
Mark Reinhold Oracle

Last updated: 11:50 a.m. PT 

The scene of the Oracle-Google trial today was more like a computer science classroom than a courtroom as the witnesses explained the inner workings of Java and APIs.

Mark Reinhold, Oracle Java Platform Group chief architect, gave a tutorial on Java as part of his testimony. He spent nearly 14 years at Sun as principal engineer for Java SE & OpenJDK before Oracle acquired Sun.

The questioning mostly focused on the 37 Java APIs at the center of the lawsuit. Reinhold, dressed in a dark jacket and red tie as Oracle CEO Larry Ellison was for his testimony, provided the attentive jury with definitions of Java programming language, Java APIs and class libraries, but also got into the technical weeds with documentation extractors, compilers and comments that begin with a slash and two stars. 

More simply, he explained that the APIs and class libraries are not in the Java language in the same way the Oxford English dictionary doesn't contain every word in the English language.  

See also: ZDNet: Oracle lawyers attempt to stress the creative value of Java

Under direct examination by Oracle's lawyer, Michael Jacobs, Reinhold said that only a small number of classes are required for the Java language, and that the bulk of the 37 APIs that Oracle claims Google infringed upon are not required by the Java language, but there are a few APIs tightly related to the Java language that are necessary for Java development. He also was asked about copyrights and the Java specification, and said that each page of the language specification includes a copyright notice. Google maintains that the APIs are not copyrightable.

Google's counsel, Dan Purcell, followed up on the API issue with questions about the authorship and the variety of Java APIs. He tried to establish that 10 percent to 20 percent of Java API packages were written by members of the Java Community Process, not Sun or Oracle. Ten of the 37 APIs in question were created with other members of the Java Community Process, he stated, who were not paid for their work by Sun or Oracle.

Oracle

He walked with Reinhold through the dense forest of Java implementations, configurations and profiles of four Java platforms -- ME SE, EE and Card -- and different APIs for each one. The "write once, run anywhere" philosophy doesn't necessarily apply across the different Java platforms, given the different APIs across the all the platforms.

Purcell asked Reinhold more technical questions about the relationships of APIs, libraries and source code, and played snippets from his video deposition to highlight possible contradictions in his testimony. At one point, Reinhold responded to Purcell's question about accessing source code in libraries in programming speak: "I'm sorry, the question is malformed," Reinhold said.

Upon redirect, Reinhold explained his "malformed" comment, stating that "there is no source code in libraries...libraries are in object form, in zeros and ones."

Homing in on 'range check' code
Next up on the witness stand was Joshua Bloch, a former distinguished engineer at Sun and a Java guru who joined Google in 2004. Jacobs led Bloch through a tutorial of best practices for developing APIs and class libraries to help establish a creative works argument for copyrighting APIs. Bloch was quoted as stating that API design is a noble and rewarding craft and that API design is tough.

Bloch was asked whether "range check" code -- 9 lines of code -- that he wrote while he worked at Sun, was used for Android. "I don't recall," he said. Jacobs showed code for Timsort.java (Android) and Arrays.java (Sun), which both included "range check," that Bloch agreed were almost the same. Bloch admitted that he was aware that Sun copyrighted code during his work there.

According to a Google spokesman, the "range check" code is not in the latest Android version shipped by the company.

Bruce Baber, representing Google, also took Bloch through the "range check" topic. Bloch said "any competent high school programmer could write it," and that he wrote Timsort.java, porting open-source code from the Python language to Java in the middle of 2007, when he was not a part of the Android team. Timsort.java was contributed to the Open JDK by Google under the GNU General Public License version 2 in 2009.  "I really feel a personal responsibility to give back to the Java community It made my career," he said.

Baber walked Bloch through a lengthy definition of API. He defined an API as "names or words and a set of rules." When the program speaks to a library, it has speak in a very precise language, he continued. Typically the words are verbs and phrases, such as "remove the header." 

He added, through Baber's prompting, that an API is not a blueprint that tells you how or to build or implement something. Baber asked Bloch to explain naming conventions in Java APIs--packages, classes and methods.

Judge William Alsup then asked Bloch to explain how packages, classes and method apply to Java APIs. Bloch said the API would be like an address, the package the city, the class the street and the method, the house number. 

Baber asked whether APIs are needed to use the Java language as specified in The Java Language Specification, Third Edition. "Many of APIs are referenced directly in the Java specifications," he said including 60 classes directly mention consisting of more than 750 public methods and field spread across 3 classes.

In order to faithfully implement the Java language, there are also indirect dependencies, Bloch stated, including 177 classes consisting of over 2000 methods and fields spread over 10 packages.

Bloch and Reinhold both said that the Java language is mostly useless without APIs, and other object-based languages have APIs.

Baber then moved on to the topic of reimplementing or doing further work on existing APIs. To set the stage, Bloch dictated a simple API, for computing the maximum, that Baber wrote on a flipchart to demonstrate the code. Then Bloch came down from the witness stand to help with the tutorial, clarifying the package, classes and methods for an API. He wrote out a simple argument -- a parameter, the values that are passed to an API --  to show the implementation side of a computer program, separate from the AP, to the jury.

Back to reimplementing APIs, and sharing Google's view on using Java APIs, Bloch gave an example of  working with Classpath, an open-source project, to develop class libraries independently from Sun.

Jacobs returned for redirect, pursuing the notion of APIs as creative works. He asked Bloch what he meant about creativity and APIs. He said his notion of creativity and artistry as "obeying simultaneously all the rules of the craft to produce a language, API, that is easy for the programmer to use."

Oracle's slideshow alleging how Google copied Java (images)

See all photos