Slashdot Mirror


Anthropomorphism and Object Oriented Programming

An anonymous reader writes: We've all been warned about how anthropomorphizing animals and machines can lead us astray. But Edsger Dijkstra once cautioned (PDF) developers against thinking of their programs that way as well. "I think anthropomorphism is worst of all. I have now seen programs 'trying to do things,' 'wanting to do things,' 'believing things to be true,' 'knowing things' etc. Don't be so naive as to believe that this use of language is harmless. It invites the programmer to identify himself with the execution of the program and almost forces upon him the use of operational semantics." A new article fleshes out Dijkstra's statement, providing a good example of where an anthropomorphized analogy for Object Oriented Programming breaks down when you push it too far.

15 of 303 comments (clear)

  1. Strawman by Anonymous Coward · · Score: 5, Insightful

    Dijkstra spends time building an analogy, then explains how it's flawed, and uses that to argue against 'anthropomorphizing'.

    That's nice, and I certainly agree that the analogy can only go so far, but he was the one to build that analogy in the first place. This is not a valid argument against anthropomorphizing at all.
    I do agree with the conclusion that anthropomorphising is not a reason to call OOP better than procedural.
    ---
    "I don't know how many of you have ever met Dijkstra, but you probably know that arrogance in computer science is measured in nano-Dijkstras"

  2. Ya, Sure. by wisnoskij · · Score: 5, Insightful

    Ya, sure. It is so much better to use the phrase: "The program contains a variable that stores your name", instead of: "The program knows your name". English, ect. all was not designed to work that way. Unless you want to take a week to describe a single program, it really helps to anthropomorphise it.

    --
    Troll is not a replacement for I disagree.
    1. Re: Ya, Sure. by Anonymous Coward · · Score: 2, Insightful

      Atheism suffers from this too... There are so many standard phrases for swearing/exclamations that invoke some deity construct that atheists are forced to continue using them as they are too entrenched in our cultures to replace. "Damn you!" Is too perfect to replace with "my anger is so vivid that I want the universe to arrange something very bad to happen to you. Err, except I don't believe the universe is sentient of course, ummm, errrr, I think I'll shut up now"

  3. Encapsulation by mrflash818 · · Score: 4, Insightful

    For me, I prefer OO programming (c++/java) to functional programming (C-lang), just due to encapsulation. I like having an object, with methods for its attributes, public/private methods, and such. Then having the objects interact in my program. It kinda makes sense to how I think.

    However, I also think that if a team or individual programmer can release software that serves a useful purpose, and is maintainable, then those are the only things that matter. Which language, functional or object-oriented 'way' that was used to get there? Seems less important.

    --
    Uh, Linux geek since 1999.
    1. Re:Encapsulation by TheSunborn · · Score: 3, Insightful

      What the oop languages did, was to add explicit language support for all the features and idioms which software developers did anyway.

      This make development and maintenance much more easy.
       

  4. Missing the point by pushing-robot · · Score: 5, Insightful

    OO isn't about anthropomorphism, it's about isolation and providing a clear API. If this was a large scale project with fifty people working on code that could move students, I don't want them implementing fifty different versions of move_student that will break whenever the Student or Classroom model changes.

    I know it's trendy to hate on things that have been around a while, and OO indeed isn't the answer to everything, but it's still a useful way of keeping a complex program from getting out of control.

    --
    How can I believe you when you tell me what I don't want to hear?
    1. Re:Missing the point by phantomfive · · Score: 4, Insightful

      OO isn't about anthropomorphism, it's about isolation and providing a clear API.

      Believe it or not, isolation and 'providing a clear API' existed before OOP, so you can't say that's it. In general, object oriented programming means that the functions go with the data.

      --
      "First they came for the slanderers and i said nothing."
  5. The limits of Dijkstra by anchovy_chekov · · Score: 3, Insightful

    I think what this article highlights is that not everything Dijkstra said was gold. Nor does slavishly following his missives make you a better programmer.

  6. stupid by Tom · · Score: 4, Insightful

    One of the more stupid blog-level postings I've read. I use "blog-level" as an insult, btw. because blogs are generally a source of shallow thinking, because it just is too convenient to publish some thoughts. When it is more trouble, you're also forced to polish them more.

    Firstly, to understand the difference between trying to do and "trying to do", read some Dennett. If correctly understood, anthropomorphisms like the attribution of intention to a non-intentional entity can be extremely helpful.

    Secondly, not even his example is anywhere near what he's trying to explain. Yes, the analogy breaks down but it has nothing to do with the convulted reasoning he's applying. The cause for the analogy to break down is that there's no equivalent to walking to the classroom in his example. All of his code simply assigns a classroom number, without any equivalent of the walking part. As soon as you add that - magic ! - the analogy works again.

    --
    Assorted stuff I do sometimes: Lemuria.org
  7. Re:Calling poor code organization OOP is flawed by gnasher719 · · Score: 4, Insightful

    Just saying: It's not Dijkstra talking rubbish. Dijkstra is died 12 years ago. There is a handwritten article by Dijkstra which probably made sense in 1983 when it was written. In 1983 Dijkstra didn't know about C++. Stroustroup didn't know about C++ in 1983.

  8. Balance by Tablizer · · Score: 3, Insightful

    OOP is a tool, and like any tool it has places and times where it is useful, and places and times where it is not. Knowing when to use it and when not to is part of the art and craft of programming. Does OOP improve the overall organization, reading, and flexibility of a given portion of software to change? If you don't have a good answer, then consider skipping it.

    All-or-nothing zealots are usually full of squishy stuff. In the past, one was told to model all domain nouns as objects and/or classes (depending on language flavor). That doesn't always work well, especially if a database is being used. Domain nouns are often poor candidates for OO-ness. Objects seem better suited, however, for computing-domain nouns, such as GUI's, report columns, files, sockets, security profiles, etc. That's my experience.

    (However, lately GUI's seem to have outgrown OOP, as multi-factor and situational grouping and searching becomes more important for managing mass attributes and event handlers, and I'd like to see research in database-driven GUI engines, perhaps with "dynamic" relational or the like.)

  9. Do anthromorphise! by dwheeler · · Score: 3, Insightful

    Don’t anthropomorphize computers, they hate that notes that most developers do use anthropomorphic language. I think there are probably a variety of good reasons for it, too. Here's one speculation: When we communicate with a human, we must use some language that will be more-or-less understood by the other human. Over the years people have developed a variety of human languages that do this pretty well (again, more-or-less). Human languages were not particularly designed to deal with computers, but languages have been honed over long periods of time to discuss human behaviors and their mental states (thoughts, beliefs, goals, and so on). In any case, the problem isn't anthropomorphic language, it's the use of a bad analogy.

    --
    - David A. Wheeler (see my Secure Programming HOWTO)
  10. Less accurate statement by SuperKendall · · Score: 4, Insightful

    "The program doesn't know to check for" is in fact more accurate than "The program wasn't designed to check for". The second statement could mean that it wasn't designed to do something, but might do it anyway - what the program ACTUALLY does is left somewhat ambiguous (this is a technique lawyers will often use answering in court). In the first instance the statement makes it quite clear the program DOES NOT KNOW HOW to do what you are talking about.

    You can shorten something so far for clarity, but if you go to far you end up with less clarity.

    The "thinks" part at the end could go though, removing that does no harm to clarity.

    The thing is, writing clearly is just plain hard - being able to use anthropomorphic kinds of terms helps make it simpler to add clarity to description at the cost of somewhat wordier sentences... kind of like how sometimes you make a program a little more verbose so that a different programmer coming across the code later can understand it.

    --
    "There is more worth loving than we have strength to love." - Brian Jay Stanley
  11. Re:Degenerate by Anonymous Coward · · Score: 3, Insightful

    > Anthropomorphism is degenerate no matter the situation.

    a) Man is the measure of all things.

    Anthropomorphism is something we cannot really ever abandon -- be it regarding our tools and even regarding what goes around us.

    I always got upset with people who are Biology Nazis and go like "you cannot say that organism wanted to lose its teeth". Well, this is obvious! And yet (IMHO) it's a perfect valid way to state a fact -- either for youngsters who cannot grasp the way evolution really works and for adults, as a figure of speech.

    b) The discourse at the end of The Great Dictator, by Chaplin, would also be useful. If you abstract enough, a good part of morality is lost. You are not machines...

    c) OOP was never about anthropomorphism. One model entities, which might be humans or not. The article author didn't like an anthropomorphic example. Fine, do it with bacteria. Analogies now and then break. This has nothing to do with OOP as a method for problem specification and treatment.

    d) Sometimes we get fed up with things and the current trend of flat designs is an example. We got tired of anthropomorphic controls. Very nice. And it shall pass, too. And we'll be back to more human-adapted designs, futurely, and will be touted as a novelty. Hah!

    e) I've read both articles: the author has a much narrower aim at how one analogy broke; EWD says anthropomorphism fails (with what I agree) in a text written by hand (I had the pleasure to read another some months ago, he even let some text he stroke through remain. It's obvious he's not against anthropomorphism de per se, but he cautions us about the dangers of using it (like in the expression "restless waves").

    f) OOP has its place, and in some niches it may not be as useful, so procedural might be better. But then this can be said about the car and the bicycle. Where I disagree with the author is about OOP being syntactic sugar, since OOP happens at an earlier stage -- before syntax takes place. The implementation of OOP might be seen as that, but then again an implementation is not the idea itself.

    g) The author is way above my knowledge level; but then, this might be the source of his problems. I'd humbly suggest he backs away of his expertise and try a more conventional big picture view. There's a reason why OOP was invented and it will be debunked by a better knowledge model -- not by a previous one.

  12. Re:Procedural vs OO by kjots · · Score: 5, Insightful

    By the same token, now you have to implement pie.toast() and cake.toast() and lots of other useless and irrelevant methods, even though you're never ever going to use them, simply because they extend the isBakeable() interface.

    Unnecessary, since the IsBakeable interface provides a default implementation of the toast() method that throws an exception if you attempt to toast something that is not toastable.

    The real issue is why the IsBakeable interface has a toast() method in the first place...