Live data from Hacker News

Ask HN: can you summarize OO for me in 64 words or less?

news.ycombinator.com

61–70 of 76 posts

Re: Ask HN: can you summarize OO for me in 64 words or less?

#61

"In all other languages we've considered [Fortran, Algol60, Lisp, APL, Cobol, Pascal], a program consists of passive data-objects on the one hand and the executable program that manipulates these passive objects on the other. Object-oriented programs replace this bipartite structure with a homogeneous one: they consist of a set of data systems, each of which is capable of operating on itself." - David Gelernter and S…

Yes, but the writing is poor. 'bipartite' and 'homogeneous'? Would you speak to your non-academic friends that way? If not, it's not going to successfully convey the message to a wide audience.

Re: Ask HN: can you summarize OO for me in 64 words or less?

#62
post #44

I remember my first class. It was a Stopwatch. It had start, stop, reset, and read methods. It maintained an internal counter by calling time(2) or something like that. A lot of objects have no real-world equivalent (they are not "objective", I kill myself), but that doesn't make them useless. Objects are an odd mash of concepts: inheritance, interfaces, global data with limited access, encapsulation, memory manageme…

Bonus points for leading with a practical example.

Re: Ask HN: can you summarize OO for me in 64 words or less?

#63
post #2

(I'm not trying to sound condescending, so bear with me) How else would you write software with modular and re-usable components?

I've got 8 minutes til I need to catch the bus. The answer to your question hinges mainly on how you define components. In the Erlang language for example: It is completely functional but threads actually become somewhat stateful and ultimately end up recreating some similar scenarios for OOP programmers. On top of that, functions themselves showcase an even higher amount of reusability at times especially in functio…

> Having said that no one tool is a golden hammer.

Clearly you're inexperienced with golden hammer methodology, which provides both a mightier paradigm and a pleasantly horned helmet.

Re: Ask HN: can you summarize OO for me in 64 words or less?

#64
post #25

Earlier quoted context omitted.

The smalltalk object system is a nice simple example: A Smalltalk object can do exactly three things: Hold state (references to other objects). Receive a message from itself or another object. In the course of processing a message, send messages to itself or another object. http://en.wikipedia.org/wiki/Smalltalk#Object-oriented_progr...

The language that fits this description best is Erlang, I would say ... (what, in this definition, is specific to objects compared to processes?)

In smalltalk everything is an object. In Erlang, many things aren't. Processes and messages are a bit higher up in Erlang's world.

Re: Ask HN: can you summarize OO for me in 64 words or less?

#65
post #10

Think of it less as "Object-Oriented" and more as "Message-Oriented" and things become clear. Every object has a vocabulary of messages it can respond to. The only contract you have with the object is what it can do, not how it does it; therefore, the supplier of the object is free to implement algorithms as he sees fit. (60 words) Bonus analogy: The web itself is object-oriented. You ask a server to return a resourc…

Message-Oriented coding is also why commenting is so important. You don't need to know what's going on inside the method, but you do need to know what the method does, which is best accomplished through documentation.

O.O is useful to you because it makes it easier to understand your code, especially if your code base becomes very large. You can look at your code object by object rather than line by line.

O.O is useful for group projects because each member can code an object and the algorithms behind its methods individually. It also makes it easier to swap different functionality in and out.

Finally, O.O also promotes good coding practices, like reusing existing code and writing documentation. It also makes you think about your code's structure, which is crucial to keeping your code maintainable, upgradeable, readable, and reusable.

For me, writing good O.O code is a something that I learned after writing a lot of bad O.O code. So there's no reason to delay - write it and you'll see.

Re: Ask HN: can you summarize OO for me in 64 words or less?

#66
Just think about it as a change in structure - all your implementation stays the same, but where the code resides gets moved around a bit. This moving around eventually ends up making your code read like a short hand walkthrough of some task, which is better than reading the code directly.

Re: Ask HN: can you summarize OO for me in 64 words or less?

#67

This is probably the wrong community to mention this, but this discussion is an excellent example of why I am largely procedural in my programming and don't focus too much on OO. I need to tackle real world business problems. Likening objects to things like refrigerators and toasters is where I get lost. Perhaps those examples work well in the classroom to help kids wrap their heads around the concept of OO, but I ju…

Likening objects to things like refrigerators and toasters is where I get lost. Perhaps those examples work well in the classroom to help kids wrap their heads around the concept of OO ... I have sometimes thought the same thing. There are ample explanations of the use of OOP put in terms of stuff like, poodle inherits from dog, which inherits from mammal etc. or a car could be represented as a series of objects inte…

Think about it from OO's creator's perspective. For instance, this is what the creator of inheritance probably thought:

"All of these objects do very similar things. I don't want to have to write these functions over an over again if they're so similar..." and inheritance was born.

Most OO concepts are about writing and seeing less code. I think the best way to grasp OO is to ban ctrl+c for anything longer than 2 lines. It really forces you to think about structure and code reusability, which is what OO is all about.

Re: Ask HN: can you summarize OO for me in 64 words or less?

#68
post #61

"In all other languages we've considered [Fortran, Algol60, Lisp, APL, Cobol, Pascal], a program consists of passive data-objects on the one hand and the executable program that manipulates these passive objects on the other. Object-oriented programs replace this bipartite structure with a homogeneous one: they consist of a set of data systems, each of which is capable of operating on itself." - David Gelernter and S…

Yes, but the writing is poor. 'bipartite' and 'homogeneous'? Would you speak to your non-academic friends that way? If not, it's not going to successfully convey the message to a wide audience.

"two part structure" & "single structure?" Ups the word count to 62

Re: Ask HN: can you summarize OO for me in 64 words or less?

#69

This is probably the wrong community to mention this, but this discussion is an excellent example of why I am largely procedural in my programming and don't focus too much on OO. I need to tackle real world business problems. Likening objects to things like refrigerators and toasters is where I get lost. Perhaps those examples work well in the classroom to help kids wrap their heads around the concept of OO, but I ju…

Likening objects to things like refrigerators and toasters is where I get lost. Perhaps those examples work well in the classroom to help kids wrap their heads around the concept of OO ... I have sometimes thought the same thing. There are ample explanations of the use of OOP put in terms of stuff like, poodle inherits from dog, which inherits from mammal etc. or a car could be represented as a series of objects inte…

I mainly use it b/c it helps to easily swap out different implementations of a generic object. Useful if I'm coding a large framework that'll be used for different problems.

Re: Ask HN: can you summarize OO for me in 64 words or less?

#70
post #68
post #61

Earlier quoted context omitted.

Yes, but the writing is poor. 'bipartite' and 'homogeneous'? Would you speak to your non-academic friends that way? If not, it's not going to successfully convey the message to a wide audience.

"two part structure" & "single structure?" Ups the word count to 62

You could convey the concept of OO better in simple terms and easily stay within the wordcount. Eg.

"Programming by making things that can be interacted with in different ways"

Post reply on HN