The 9 lines of code of Google
sonic0002 Date : 2014-08-15 20:29:52
Are you still remembering the then hot debated news about Oracle suing Google allegedly copying a small portion of codes from Oracle’s Java in 2010. At that time, Oracle experts estimated that Google owes Oracle between $1.4 billion and $6 billion in damages if liable. But the court thought Oracle was eligible only for statutory damages for that copying, which were not expected to exceed a few hundred thousand dollars. At last, Oracle agreed the zero damage result.
Are you curious about which portion of codes Oracle claimed were stolen? Actually, it’s only a really small portion of it, around 9 lines of codes. These codes are for range check, it’s really a common implementation which a general programmer can write.
Joshua Bloch is the developer who wrote this piece of code. Joshua Bloch was a Sun developer(then acquired by Oracle) for the development of Java APIs. Later he joined Google in 2004 and worked on Android in 2008. While working for Google, he still contributed to the OpenJDK One of the things he contributed was a much faster implementation for sorting arrays, based on the algorithm TimSort used in Python. Both the old and new algorithm had the rangeCheck method in common, so he just copied it from the old implementation, as “a temporary measure”. But later somehow this temporary measure ended up in Android.
Below are the 9 lines of codes copied:
Easy enough so that most programmers can write in just a few minutes or less. But the thing is not about the codes, it’s about the attitude and incentive. Nowadays many API developers are not allowed to read other companies’ similar APIs before implementing their own because the management fears that the developers may be interfered by the source codes they read and write the same without noticing it. They would be able to refer to the source code after they complete implementing their own API however.
Be careful when you are using open source codes especially when you are working for a company which gains its profit by selling commercial software.