The Power of Interoperability: Why Objects Are Inevitable

The Power of Interoperability: Why Objects Are Inevitable

The Power of Interoperability: Why Objects Are Inevitable Jonathan Aldrich Carnegie Mellon University Pittsburgh, PA, USA [email protected] Abstract 1. Introduction Three years ago in this venue, Cook argued that in Object-oriented programming has been highly suc- their essence, objects are what Reynolds called proce- cessful in practice, and has arguably become the dom- dural data structures. His observation raises a natural inant programming paradigm for writing applications question: if procedural data structures are the essence software in industry. This success can be documented of objects, has this contributed to the empirical success in many ways. For example, of the top ten program- of objects, and if so, how? ming languages at the LangPop.com index, six are pri- This essay attempts to answer that question. After marily object-oriented, and an additional two (PHP reviewing Cook’s definition, I propose the term ser- and Perl) have object-oriented features.1 The equiva- vice abstractions to capture the essential nature of ob- lent numbers for the top ten languages in the TIOBE in- jects. This terminology emphasizes, following Kay, that dex are six and three.2 SourceForge’s most popular lan- objects are not primarily about representing and ma- guages are Java and C++;3 GitHub’s are JavaScript and nipulating data, but are more about providing ser- Ruby.4 Furthermore, objects’ influence is not limited vices in support of higher-level goals. Using examples to object-oriented languages; Cook [8] argues that Mi- taken from object-oriented frameworks, I illustrate the crosoft’s Component Object Model (COM), which has unique design leverage that service abstractions pro- a C language interface, is “one of the most pure object- vide: the ability to define abstractions that can be ex- oriented programming models yet defined.” Academ- tended, and whose extensions are interoperable in a ically, object-oriented programming is a primary focus first-class way. The essay argues that the form of inter- of major conferences such as ECOOP and OOPSLA, operable extension supported by service abstractions and its pioneers Dahl, Nygaard, and Kay were honored is essential to modern software: many modern frame- with two Turing Awards. works and ecosystems could not have been built with- This success raises a natural question: out service abstractions. In this sense, the success of Why has object-oriented programming been success- objects was not a coincidence: it was an inevitable con- ful in practice? sequence of their service abstraction nature. To many, the reason for objects’ success is not obvi- Categories and Subject Descriptors D.1.5 [Program- ous. Indeed, objects have been strongly criticized; for ming Techniques]: Object-Oriented Programming example, in an interview Stepanov explains that his STL C++ library is not object-oriented, because he finds Keywords Object-oriented programming; frame- OO to be technically and philosophically unsound, works; interoperability; service abstractions and methodologically wrong [29]. In addition, popular object-oriented languages are often criticized for their Permission to make digital or hard copies of all or part of this work for flaws; for example, Hoare states that the null references personal or classroom use is granted without fee provided that copies are not most OO languages provide were his “billion dollar made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components 1 of this work owned by others than the author(s) must be honored. Abstracting http://www.langpop.com/ with credit is permitted. To copy otherwise, or republish, to post on servers or 2 http://www.tiobe.com/index.php/content/paperinfo/ to redistribute to lists, requires prior specific permission and/or a fee. Request tpci/index.html permissions from [email protected]. 3 http://sourceforge.net/directory/, click Advanced and Onward! 2013, October 29–31, 2013, Indianapolis, Indiana, USA. Copyright is held by the owner/author(s). Publication rights licensed to ACM. mouse over Programming Language, accessed 4/7/2013 ACM 978-1-4503-2472-4/13/10/13/10. $15.00. 4 https://github.com/languages, accessed 4/7/2013 http://dx.doi.org/10.1145/2509578.2514738 mistake”[13]. These and other criticisms have led some To support this thesis, we need a careful defini- to argue that object-orientation became popular essen- tion of interoperable extension and an analysis of how tially for marketing reasons: because “it was hyped objects provide it—by contrast, we’ll see that obvi- [and] it created a new software industry.”5 ous alternatives such as abstract data types don’t (Sec- While there has unquestionably been some hype tion 3). Alternative mechanisms can provide inter- about objects over the years, I have too much respect operable extension only by using service abstraction for the many brilliant developers I have met in indus- themselves—and thus are equivalent to what we con- try to believe they have been hoodwinked, for decades sider the essence of objects.6 Interoperable extension is now, by a fad. The question therefore arises: might essential to many modern software systems and frame- there be genuine advantages of object-oriented pro- works, in that the core architectural requirements of gramming that could explain its success? these systems cannot be fulfilled without it (Section 4). Some of the advantages of object-oriented program- The rise of objects, therefore, is not a coincidence: it ming may be psychological in nature. For example, is an inevitable response to the needs of modern soft- Schwill argues that “the object-oriented paradigm...is ware. consistent with the natural way of human think- Pieces of the story told here are known, more or less ing” [28]. Such explanations may be important, but formally, within the object-oriented and programming they are out of scope in this inquiry; I am instead in- language communities, but the larger story has not terested in whether there might be significant technical been well told. With that story in place we can begin advantages of object-oriented programming. to explain the success of objects on a purely technical The most natural place to look for such technical basis. advantages is the essential characteristics that define Along the way, we’ll connect Cook’s definition of the object-oriented paradigm. On this question there is objects with Kay’s focus on messaging as a key to some controversy, but I follow Cook’s definition: “an object-orientation; investigate a mystery in the design object is a value exporting a procedural interface to of object-oriented vs. functional module systems; and data or behavior” [8]. In other words, objects are in use the theory sketched here to make predictions both their essence procedural data structures in the sense of about the technical feasibility of statically typed, fully- Reynolds [27]. Cook’s definition essentially identifies parametric modules in object-oriented systems, and dynamic dispatch as the most important characteris- about the effect of adding first-class modules to lan- tic of objects. Each object is self-knowing (autognostic guages that do not support objects. in Cook’s terms), carrying its own behavior with it, I hope that the arguments in this essay will inspire but assuming nothing about other objects beyond their researchers to gather data and build systems that can own procedural interfaces. This autognosis property, properly validate the propositions described here. in turn, enables different implementations of an object- oriented interface to interoperate in ways that are diffi- 2. The Nature of Objects cult when using alternative constructs such as abstract A clear understanding of the nature of objects is essen- data types. tial to my argument. Cook’s definition was intended Could data structure interoperability really be so to distinguish objects from ADTs, with which objects important? It is an excellent question, but too narrow. are often confused. However, his definition extends be- As we will see, to understand the value of objects we yond data abstraction, following Alan Kay’s emphasis must consider service abstractions that go beyond data on objects providing services that support high-level structures, because it is for abstractions of components behavioral goals. As we will see, it is in its ability to ab- and services that interoperability becomes critical. This stract behavior that object-oriented programming pro- leads to the following thesis: vides its greatest benefits. 2.1 Objects and ADTs Object-oriented programming is successful in part because its key technical characteristic—dynamic Once again, Cook’s definition states that “an object dispatch—is essential to supporting independent, in- is a value exporting a procedural interface to data or teroperating extensions; and because interoperable ex- behavior” [8]. His essay uses a simple set example to tension is in turn essential to the reuse of architectural illustrate the distinction between objects and abstract code (as in frameworks), and more broadly to the de- 6 As we will see, “simulated objects” do appear in practice in systems sign of modern software ecosystems. that require interoperable extension, but are not written in object- oriented languages. These examples supports my thesis, which is about object-oriented programming in the most general sense. Of 5 Joe Armstrong, quoted at http://harmful.cat-v.org/ course, when programming with objects in practice, programming software/OO_programming/why_oo_sucks language support is convenient. data types (ADTs). For example, an object-oriented set ADTs can also be defined in Java using classes as type may be abstractly defined as follows: follows: type IntSet = { final class IntSetA { bool contains(int element); bool contains(int element) { ... } bool isSubsetOf(IntSet otherSet); bool isSubsetOf(IntSetA other) { ... } } } Note that different IntSet implementations can in- As with the abstract SetModule1.IntSet de- teroperate.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    15 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us