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.
Dijkstra makes an argument about what he calls object oriented programming, but doesn't really use OOP. That he happens to base his argument around two styles of coding, one that is clearly procedural, and one that happens to use objects, is merely accidental. His argument is centered around poor code organization, plain and simple. He passingly slaps down some code modeling Student as an object, neglecting to mention anything about why one would do that (e.g. encapsulation), and completely fails to even mention other OOP ideas such as composition, inheritance, polymorphism, etc. In short, he bashes horrendous code organization, and calls that OOP, without addressing a single reason typically given in favor of OOP. Frankly, that article was awful.
This is why I like Python. Python allows object-oriented programming styles or procedural, or a mix. Python has a lot of warts, but it's really refreshing to me to use. Every time I look at Java, I'm turned off by the forcing of class-based object-oriented programming for everything, even when the program is really just procedural with a static main. Perhaps this tends to make programmers try to shoehorn OOP when it's not the best fit.
language that makes the computer sound like an out of control actor... describes most accurately what is really going on. You sent the slinky down the stairs but it veered sideways and hit a wall.
A program is basically a state machine, a very complex one - we start it and watch what happens, but with a complex enough state machine it is basically indistinguishable from watching a video feed of a person robbing a convenience store. You can describe later on what went wrong quite well, but at the time the result is unexpected.
To be the description of something as a "bug" is leaning more towards papering over flaws; just admit we build systems and almost never have a 100% understanding of what they will do in operation. That is far more truthful than saying there is *A* bug rather than the program is a series of statements that may do what we intend, but may not.
"There is more worth loving than we have strength to love." - Brian Jay Stanley
What gets me is this:
If you don't draw analogies (like anthropomorphism), or abstractions, how the hell do you choose your names in a way that lends itself to understandable code? The author should take his own argument one step further and realize that calling a string of bits a "student" is likewise anthropomorphising the data, and calling another memloc a "Classroom" is applying an anology to what is really going on. Then he could reduce is argument ad-absurdium to requiring that all identifiers be randomly chosenstring to avoid installing unintentional meaning into data structures and procedures/functions.
Someone had to do it.
I always got upset with people...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...
It's what Daniel Dennett calls the "intentional stance." I agree with Dijkstra, that anthropomorphizing code is frequently problematic, but the intentional stance can be quite useful in general. Most of the systems we build and encounter in our daily lives are "intentional systems", designed to achieve specific purposes in an external physical reality, and the intentional stance is really parsimonious for these cases.
.: Semper Absurda