views:

167

answers:

3

There are quite some interesting definitions of what an object in OO is? Please post your favorite definitions and quotes!

One of my favorites comes from Trygve Reenskaug:

"The object has three properties which makes it a simple, yet powerful module building block: It has state so it can model memory. It has behaviour, so it can model dynamic processes. And it is encapsulated, so that it can hide complexity"

+1  A: 

See my answer here. It's the second one down (sorted by votes).

Esteban Araya
A: 

This is one of those things that really only sinks in after a few examples.

Say I want to model a rabbit in my code. The rabbit has attributes like the color of its fur, it's gender, and it's age which might be significant. It also has behavior like hopping, munching, and sniffing that may change the state of itself or other nearby objects. The fact that it is-a rabbit is probably significant, as is the fact that it is-a mammal.

The Reenskaug definition is good except for one major nit I have to pick. Objects do not "model memory," they (hopefully) model real things or at least some sort of noun having to do with your project. How an object is stored in memory is an implementation detail that has nothing to do with its design

Ryan
A: 

@Ryan i fully agree with you, and iam not a native english speaker, but did he mean physical memory in this quote. I always thoughtof fields that model the state in sense of information holders...

I take it as it models the fact that it has memory and not how it's implemented.
bruceatk