The Supreme Court of the United States has issued a decision for the Oracle vs Google copyright case. While they did not address whether an API could be copyrighted, they held that Google’s use of the Java API was nonetheless protected under fair use.
Ars Technica explains the decision in greater detail but I’d like to focus on the difference between declaration versus implementation code, and what this decision means for everyday developers.
In the following example we create a function called add that accepts two numbers, adds them together and returns the sum.
This part of the function is its Application Programming Interface (API), which declares the functions name, parameter(s) and (if applicable) return type.
This part of the function is its body, where we add the functions logic.
Regardless of the implementation code in the functions body, it’s common for products to copy a functions declaration (API), making it easier for developers to adopt.
Had the Supreme Court decided in Oracle’s favor, all declaration code would need to be unique to avoid potential litigation. Personally, I don’t want a future where my projects look like this.