Live data from Hacker News

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

news.ycombinator.com

31–40 of 76 posts

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

#31
Procedural programming concerns itself with actions acted upon the data, whereas object oriented concerns itself with data upon which actions can be applied. Think of code as verbs, and data as nouns, and procedural languages are verb oriented, object oriented are noun oriented (I talk about it at http://boston.conman.org/2004/10/19.1).

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

#33

What is Object Oriented programming? I wrestled with this one in school for a while, because the name is so screwy. What is an object? It's a blob of code. It's a walled off place in your computer's RAM that has variables and functions. It's just a bit of reusable code. Why is that special? If you've spent your programming life copying and pasting code in a text editor, it's probably not going to be readily apparent.…

So, you mean, "no". ;)

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

#34
post #25
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…

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...

Good definition. Smalltalk is the only appropriate starter language to learn objects well. Sure there is the difference between class based and prototype based languages, but this hardly matters compared to "getting" objects right in your head in the first place.

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

#35
Software development is an exercise in managing complexity. Being able to isolate the functionality and verify the correctness is valued. OO is one attempt to make this practical in the large[1].

Smalltalk is a great start. If you want to read more, this poorly named book is by far the best I've read on the topic: http://www.amazon.com/Software-Development-Principles-Patter...

[1] http://en.wikipedia.org/wiki/Programming_in_the_large

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

#38
What can you do with a car? Move it forward, backwards, stop, turn. Those are the methods. What features does a car have? Doors, color, age, stereo, etc. Those are the properties.

What can you do with a string? Set it, save it, match it. What properties does it have? Length, value, encoding, language, etc.

Object Oriented software is built with methods and properties.

(Do I get extra credit for using 64 words exactly?)

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

#39
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?

How else would you write software with modular and re-usable components?

Hah! However you want!

The first few chapters of Paul Graham's `On Lisp' does a great job covering closures, which can provide elegant encapsulation. But even in Java or C++, objects aren't the only modular or reusable components - consider packages or name spaces, for example. Data types such as streams, arrays, and trees don't have to be classes, either - take a look at Haskell's data types.

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

#40
The best thing about OO in app development is that it lets you abstract the main routines of your program into what is effectively business logic. For example," $customer = new cp_customer(); $customer->add($customer_form_data); /* Customer_Info => Customer_Storefront*/ $customer->link_to_storefront($SID);"

Earlier this was a garbled mess, full of functions like custID = addCustomer(form_info) updateAddress(custID, "Billing", some_args) and so on ...

On the flip side, OOP is trickier (b/c of encapsulation) to debug esp when object model gets complicated. In terms of programming the only way to do it better (and this is frankly v debatable, esp when you consider management of DB connections and API administration etc) is "LISP style", where you effectively concoct a DSL for your specific app.

Post reply on HN