TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

The Power of Interoperability: Why Objects Are Inevitable (2013) [pdf]

51 pointsby brianhempelover 10 years ago

12 comments

weavejesterover 10 years ago
The author makes arguments for the functionality that OOP encompasses, but doesn&#x27;t attempt to explain why these should be grouped under one abstraction. Instead the author assumes that this should be the case, and rather naturally ends up with the answer of objects.<p>The author also has some curious opinions about FP approaches. For example, he points out that Haskell&#x27;s type system distinguishes between homogenous and heterogeneous lists, but then considers this to be a disadvantage. I get the strong impression that the paper is arguing backward; assuming that the properties of common OOP languages are the ideal, and then deriving from that assumption the answer that OOP is the best paradigm.
hyp0over 10 years ago
The author contrasts &quot;objects&quot; and &quot;ADTs&quot; (abstract data types), but uses - to my mind - an improvished definition of ADTs. I&#x27;ve always thought of <i>On the criteria to be used in decomposingsystems into modules</i> (Parnas) as the key paper for ADTs, which the author cites (at [26]) but doesn&#x27;t use for this purpose. Of course, different definitions are available.<p>The distinction the author uses is that objects can have different implementations, but ADTs can&#x27;t.<p>From this follows a streams of motherhoods of the advantages of having different implementations.<p>Curiously, from my scan, he doesn&#x27;t seem to mention evolution <i>of interfaces</i>. That is, instead of evolution being just a different implementation of an identical interface, it is much more common for something to be added: extra data, extra services, extra features. The typical approach is to leave everything the same (so that old clients still work with this new API), and strcitly only <i>add</i> new methods (and&#x2F;or types with superset values).<p>My reasonably involved studies of the evolution of Java classes in the standard packages for the purposes of serialization (which must store and recreate them), showed me that in practice, it&#x27;s pretty rare for an implementation to change <i>without the interface also changing</i>. That is, I&#x27;m claiming:<p><pre><code> Interface evolution is more common than implementation evolution alone. </code></pre> To be clear: although implemenation evolution can and <i>does</i> occur (e.g. intern aspects of String recently), it&#x27;s pretty rare to occur without the interface also changing. Not counting simple bug-fixes, which don&#x27;t substantially change the implementation, and also not taking into account interfaces that were initially designed to have multiple implementation (e.g. collections, swing&#x2F;awt, some networking classes etc), as these aren&#x27;t evolution. (Though, I suppose adding a new implementation of existing interfaces e.g. LinkedHashMap (ordered map) counts as &quot;evolution&quot;.)<p>This higher frequency of interface evolution may be a reflection that we get paid for features, not refactoring.
评论 #8412260 未加载
fslothover 10 years ago
Thank you, the term &quot;service abstraction&quot; indeed describes the - to my mind - optimal use case for the object model.<p>That is, as an easily discoverable interface between an established and supported platform and client code.<p>This is the word I had been missing when discussing the ups and downs of object model within our product&#x27;s codebase.<p>Suddenly I have a tiny bit clearer abstraction model in my head of software.<p>This is the sort of nugget of gold I come to HN for.
chipsyover 10 years ago
I agree with the idea that the abstractions provided are &quot;inevitable.&quot; I disagree with the idea that the way we&#x27;re using them is optimal.<p>I&#x27;ve just spent time in my code reducing polymorphic classes into simpler type identifier + record combinations. The rationale I am going by is that every class I introduce proliferates new symbols: the class definition, the instances, the methods, the values, the references to yet further symbols. Each time I introduce new symbols I bulk up the code and diffuse its meaning; the meaning of these symbols exists in the class, not at the call site. Thus, everything in a class definition is doing its job correctly as long as you want the class to be a true &quot;black box&quot; that hides behind the symbols it provides.<p>But in many situations, the algorithm is basically &quot;business logic&quot; and conveys the most meaning when inlined at the call site: &quot;Given this type of data, do this. Otherwise, do that.&quot; This type of algorithm assumes a schema onto the data, which is usually our true intention; having determined the schema, we can cease further indirection and begin our actual computation. And in this code, ADTs become less important, because we&#x27;ve already used those to query for the data; when we have the queries abstracted, we can stop. We don&#x27;t need to abstract the meaning any further. Relational database modelling is analogous; when the data is normalized, it&#x27;s very indirect, yet also very simple. And this pattern can be followed from within a program as well.<p>Consider the &quot;composable component-entity&quot; model that has become somewhat of a cargo cult fad. These systems generally understand the entity as a record of &quot;which components are used&#x2F;where to find them&#x2F;how they fit together&quot;. The implication is that a definite schema of &quot;types of components and their properties&quot; exists at or near the top level, and entities do not hide arbitrary blobs of data and functionality in deep recesses, as results when trying to build from class inheritance. Since the concept is poorly defined, actual implementations are all over the place, of course, but the general direction of it is towards flat&#x2F;primitive&#x2F;normalized.<p>The result I got from killing off some classes and inlining their functionality was that I found some lurking unused variables, clarified the top-level, improved the code&#x27;s flexibility, and reduced total lines of code. So at least in this instance I seem to be on the right track.
评论 #8412745 未加载
al2o3crover 10 years ago
&quot;Some of the advantages of object-oriented programming may be psychological in nature. For example, Schwill argues that “the object-oriented paradigm...is consistent with the natural way of human thinking” [28]. Such explanations may be important, but they are out of scope in this inquiry; I am instead interested in whether there might be significant technical advantages of object-oriented programming.&quot;<p>This seems to be throwing the rhetorical baby out with the bathwater - programming is not only a technical activity, but in large part a technical activity performed BY HUMANS, and generally to satisfy requirements generated by other humans.
评论 #8412681 未加载
stcredzeroover 10 years ago
<i>While there has unquestionably been some hype about objects over the years, I have too much respect for the many brilliant developers I have met in industry to believe they have been hoodwinked</i><p>A careful student of psychology and history will soon realize that almost everyone is at least partly hoodwinked about something.<p><a href="http://www.paulgraham.com/say.html" rel="nofollow">http:&#x2F;&#x2F;www.paulgraham.com&#x2F;say.html</a><p>That said, what&#x27;s popular most often has at least some merit.<p><a href="https://www.youtube.com/watch?v=qu99MegHzgE" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=qu99MegHzgE</a>
DanielBMarkhamover 10 years ago
Reading about this stuff reminds me of watching a grass fire: there&#x27;s a huge amount of smoke and activity going on, but I&#x27;m really not sure where the flames are -- or if it should concern me.<p>Working with Ocaml and F# over the past few years, in small and smallish medium-sized systems, I&#x27;ve been fortunate to have an environment where I can use any paradigm I want in a natural setting. And while I&#x27;ve gone from an OO-diehard to an FP fan during that time, I haven&#x27;t given up on objects.<p>I think systems &quot;mature into&quot; objects. I do not believe they should start with them. (Which is completely opposite of what I thought several years ago) Functionality gets created, tested in various scenarios, and then -- and only after a good amount of exercising by various other systems -- does it get grouped into ADTs, objects, or whatnot.<p>Note that I am describing how these things are created, not what they <i>are</i>. For practical purposes I could care less whether this chunk of bytes is exposing a service or providing a type. Of much more immediate concern is <i>why should it be in this shape?</i> I think if you start functionally, you are free to let the problem domain determine the shape of the mature code. Whereas if you start with some kind of preconceived notions of where you&#x27;re ending up and why, you&#x27;re making assumptions about the optimized solution that may have no justification.<p>tl;dr -- you&#x27;re asking the wrong question.
jphover 10 years ago
The author is accidentally promoting functional programming, without realizing it. He emphasizes &quot;interoperable extensions&quot; and &quot;service abstractions&quot; but what he&#x27;s really describing are functional type signatures and interfaces.<p>His writes: &quot;I now propose a candidate for the leverage provided by object-oriented service abstractions in design: The key design leverage provided by objects is the ability to define nontrivial abstractions that are modularly extensible, where instances of those extensions can interoperate in a first-class way.&quot; But he describes is not &quot;object-oriented&quot; in any sense of encapsulated data, internal state, and methods. Instead he describes the fold function, map function, and higher order functions.<p>The author touches on Alan Kay. Kay wrote this: &quot;I&#x27;m sorry that I long ago coined the term &quot;objects&quot; for this topic because it gets many people to focus on the lesser idea. The big idea is &quot;messaging&quot; ... The Japanese have a small word -- ma -- for &quot;that which is in between&quot; -- perhaps the nearest English equivalent is &quot;interstitial&quot;. The key in making great and growable systems is much more to design how its modules communicate rather than what their internal properties and behaviors should be.&quot;
评论 #8411526 未加载
评论 #8411778 未加载
jamiiover 10 years ago
From a discussion we had about this paper, in the context of the relational logic language we are working on:<p>Data abstraction is an interesting topic in a language that doesn&#x27;t really have data structures. ADTs are usually used to describe the allowable operations on either a data structure or some side-effectful system.<p>For describing data <i>models</i>, we have tables and (soon) integrity constraints. An integrity constraint is a rule which aborts the transaction if it produces any output. Simple integrity constraints like column types and foreign keys can potentially be removed when the compiler can prove that they will not be violated.<p>For derived data, rather than providing a method which returns the desired information, we define a view on the data eg instead of a getTotalSalary method we would define a rule that inserts data into the totalSalary table which is then either lazily evaluated on query or materialised and incrementally updated.<p>For modifying data we currently have no alternatives to directly working on the base data. There is some amount of work on bidirectional relational views but it seems like it adds a large amount of complexity for a problem we don&#x27;t currently have.<p>We do intend to make scalar values and functions extensible, similar to <a href="http://www.postgresql.org/docs/8.3/static/xtypes.html" rel="nofollow">http:&#x2F;&#x2F;www.postgresql.org&#x2F;docs&#x2F;8.3&#x2F;static&#x2F;xtypes.html</a><p>For side effects, we request actions by adding a row to a table that has a watcher attached. The interface is described by the set of tables available eg<p><pre><code> jobs started (id, input data...) jobs to be cancelled (id) jobs completed (id, output data...) </code></pre> <a href="http://db.cs.berkeley.edu/papers/eurosys10-boom.pdf" rel="nofollow">http:&#x2F;&#x2F;db.cs.berkeley.edu&#x2F;papers&#x2F;eurosys10-boom.pdf</a> and <a href="http://db.cs.berkeley.edu/papers/vldb14-edelweiss.pdf" rel="nofollow">http:&#x2F;&#x2F;db.cs.berkeley.edu&#x2F;papers&#x2F;vldb14-edelweiss.pdf</a> describe variations on this approach. Our current editor prototype uses the Edelweiss model, which is my preferred choice if we can make it work smoothly. The main difficulty so far is in constructing stable ids to ensure that actions are idempotent.<p>In any case, for most protocols you need to constrain not just the types of individual messages but the allowable sequences. ADTs don&#x27;t help here. Where the protocol can be described by a state machine we can simply encode that state machine in a table and have a rule that verifies message histories and provides a list of currently allowable actions.
评论 #8411606 未加载
hyp0over 10 years ago
html version <a href="http://webcache.googleusercontent.com/search?q=cache%3Ahttp%3A%2F%2Fwww.cs.cmu.edu%2F~aldrich%2Fpapers%2Fobjects-essay.pdf" rel="nofollow">http:&#x2F;&#x2F;webcache.googleusercontent.com&#x2F;search?q=cache%3Ahttp%...</a><p>I&#x27;d almost forgotten this trick, just google <i>cache:<a href="http://www.cs.cmu.edu/~aldrich/papers/objects-essay.pdf" rel="nofollow">http:&#x2F;&#x2F;www.cs.cmu.edu&#x2F;~aldrich&#x2F;papers&#x2F;objects-essay.pdf</a> </i><p>request: could HN do this automatically pls? (similar to how it used to provide a second link to scribd for pdf) I <i>always</i> prefer a html version, to assess it. If it&#x27;s interesting, and diagrams&#x2F;formulae are garbled, I can always get the pdf later.
评论 #8411585 未加载
评论 #8411398 未加载
galaxyLogicover 10 years ago
The big idea with OOP is &quot;messaging&quot;. Right. What makes messaging useful is that the &#x27;messagee&#x27; typically understands more than one different message. Because if it only understood one we couldn&#x27;t take advantage of composing the interaction with them in different ways, as needed by the client.<p>When we can do that we can also replace the messagee with an instance of some other conformant class, and thus we can reuse the client-side implementation of the interaction-protocol with many different types of recipients.<p>Using the word &quot;replace&quot; here is easily misleading. A better word is &quot;reuse&quot;. We don&#x27;t typically DELETE the original service object at all. More likely we just REUSE the same client-code with different types of &quot;service objects&quot;. The point is it can interact with many differently implemented service-objects that offer the same interface.<p>If each class defined only one message it responds to, that wouldn&#x27;t look like OOP, would it? It would look like FP where functions basically understand just one message, &quot;Tell me your value!&quot;.<p>Of course FP languages can simulate OOP and vice versa. Smalltalk for instance defines the class BlockClosure which understands the message #value: (among others). That means - &quot;Tell me your value for this argument&quot;. But BlockClosure also understands other messages, like #asString, #class etc. That is OOP.<p>We could say that OOP is a generalization of FP in this sense. Objects can do what functions do, calculate their &quot;value&quot; for a given argument. But this operation is explicitly declared as just one of the operations that object can perform. There is NO SPECIAL syntax for it, like &quot;()&quot; in FP languages.<p>JavaScript can be characterized as a functional-object -language because its functions are first-class citizens but they can also have other operations than calculating their value. We can for instance &quot;send the message&quot; .toString() to them to get their source-code.<p>You could have a &quot;messaging conversation&quot; with a JavaScript function (-object) like this:<p>Me to function: &quot;Hey tell me your source-code&quot;. The function returns it<p>Me to my Helper -object: &quot;Hey helper, does this source-code look secure?&quot;. Helper returns &quot;Yes&quot;.<p>Me to function: &quot;OK, I trust you. Tell me your value for argument 42!&quot;. Function returns it.<p>The conversation &#x2F; messaging above could be reused with some other type of object without having to modify the client-side code at all.<p>Summary: The essence of OOP is that objects can declare MULTIPLE messages they respond to, thus defining the protocol they can be interacted with. Many objects can support the same protocol of interacting with them, but provide a different implementation as to how they actually calculate some (or all) responses to the messages they get.
rurbanover 10 years ago
This was 2013 and he never heard of the CLOS arguments against traditional objects as he describes it, and he attributes Alan Kay with generics and method based OO dispatch, the functional approach?<p>All these arguments were already cleared in the early 1990&#x27;s, and people still don&#x27;t get it. CS scholar&#x27;s shouldn&#x27;t care about the popularity of certain languages, or do they wanna teach VB or PHP?<p>Objects are of course evitable, functions can do more, can do it better, and functions can represent not only scoped blocks (variable hiding), but also objects easily.<p><a href="http://www.gigamonkeys.com/book/object-reorientation-generic-functions.html" rel="nofollow">http:&#x2F;&#x2F;www.gigamonkeys.com&#x2F;book&#x2F;object-reorientation-generic...</a> talks a bit about this mindset, mentioning also Kay&#x27;s simple dynamic message passing approach.
评论 #8411766 未加载