The Package concept was introduced by the Java programming language. While too recent to be recognized as an OO concept in most current textbooks, packages nonetheless are an important addition to OO as they:
Packages are used to modify the names of classes such that class names become unique across the Internet. This is done in a manner analogous to the way people are named using two (or more) names, such as 'John Horatio Smith' rather than simply 'John'. In the case of class names, the name of the package acts as the surname, and the name of the class as the first name. Furthermore, the name of the class, by convention, must
For example, consider a Ship class used in a shipping simulation application. If this class were placed on the Internet at the ldj.net website, it might be placed in a package named 'net.ldj.simulation'. This package name would then be used to modify the name of the Ship class by prepending the package name to the class name, resulting in the "fully-qualified" class name 'net.ldj.simulation.Ship'. Because a domain name such as ldj.net is guaranteed to be unique across the Internet, any fully-qualified class name such as 'net.ldj.simulation.Ship' is guaranteed to be unique from Ship classes that might be fielded by other entities, such as 'mil.navy.simulation.Ship'. By use of package-based fully-qualified class names, the two Ship classes (which likely would be very different) can never be confused with one another. Unambiguous identification is clearly essential to software reusability on a global scale and, for this reason, packages enhance reusability.