This is probably best explained by Steve Jobs in a 1994 interview with Rolling Stone magazine:
Jeff Goodell:
Would you explain, in simple terms, exactly what object-oriented software is?
Steve Jobs:
Objects are like people. They're living, breathing things that have knowledge inside them about how to do things and have memory inside them so they can remember things. And rather than interacting with them at a very low level, you interact with them at a very high level of abstraction, like we're doing right here.
Here's an example: If I'm your laundry object, you can give me your dirty clothes and send me a message that says, "Can you get my clothes laundered, please." I happen to know where the best laundry place in San Francisco is. And I speak English, and I have dollars in my pockets. So I go out and hail a taxicab and tell the driver to take me to this place in San Francisco. I go get your clothes laundered, I jump back in the cab, I get back here. I give you your clean clothes and say, "Here are your clean clothes."
You have no idea how I did that. You have no knowledge of the laundry place. Maybe you speak French, and you can't even hail a taxi. You can't pay for one, you don't have dollars in your pocket. Yet I knew how to do all of that. And you didn't have to know any of it. All that complexity was hidden inside of me, and we were able to interact at a very high level of abstraction. That's what objects are. They encapsulate complexity, and the interfaces to that complexity are high level.
Objects tell you what you can ask of them (their methods). There are defined questions you can ask them that relate to their role and you should assume NOTHING! For the Laundry person, you could ask "do you have enough money to do Laundry?", "how long will it take you?", or "can you do this laundry for me?". Things like "how old are you?" are not relevant and shouldn't be on the approved list of questions.
Objects hold information (data). A poorly designed person (object) will allow you to access all aspects of their life, such as their age, their salary, and their sex. Even worst is a person (object) that lets you change all of this. Why should you be allowed to change the Laundry person's age when it has nothing to do with your desire to get Laundry done ... you shouldn't! A good person (object) will hide all of this and only allow you to ask things on the approved questions list and nothing else.
Objects live and die (created or destroyed). You can create a new Laundry person or end their existence. A greater power (the runtime) knows how to create them and what to do when they die. You can ask for their creation and ask them to destroy themselves, ask the higher power, or sometimes the higher power (the runtime) manages it for you.
Objects have a definition (class). How does the creator (the runtime) know how to create a Laundry person vs. a Taxi person? This get defined along with how they do things, what information they will remember, how they answer questions, how they live & die ... etc, etc, etc. If someone doesn't say how the Laundry person will drive a car, they can't. More importantly, if you didn't define this person yourself, how else will you know what you can ask of them? Definitions are critical when you are talking to a person (object) of someone else's design.
Source: https://www.quora.com/What-is-object-oriented-programming
Jeff Goodell:
Would you explain, in simple terms, exactly what object-oriented software is?
Steve Jobs:
Objects are like people. They're living, breathing things that have knowledge inside them about how to do things and have memory inside them so they can remember things. And rather than interacting with them at a very low level, you interact with them at a very high level of abstraction, like we're doing right here.
Here's an example: If I'm your laundry object, you can give me your dirty clothes and send me a message that says, "Can you get my clothes laundered, please." I happen to know where the best laundry place in San Francisco is. And I speak English, and I have dollars in my pockets. So I go out and hail a taxicab and tell the driver to take me to this place in San Francisco. I go get your clothes laundered, I jump back in the cab, I get back here. I give you your clean clothes and say, "Here are your clean clothes."
You have no idea how I did that. You have no knowledge of the laundry place. Maybe you speak French, and you can't even hail a taxi. You can't pay for one, you don't have dollars in your pocket. Yet I knew how to do all of that. And you didn't have to know any of it. All that complexity was hidden inside of me, and we were able to interact at a very high level of abstraction. That's what objects are. They encapsulate complexity, and the interfaces to that complexity are high level.
So in other Words
Objects have characteristics of their existence (states). For a Laundry person, they are somewhere in the universe, they have items on them, they are an age, etc. Some matter to you, and some don't. The person manages their state and you just ask of that person the things that relate to their role and you expect them to do them. The Laundry person is of a certain age, has a list of things they already have to do, and may or may not already be doing Laundry for a person. Some matter, some don't. Luckily you can ask them questions or to do things.
Objects tell you what you can ask of them (their methods). There are defined questions you can ask them that relate to their role and you should assume NOTHING! For the Laundry person, you could ask "do you have enough money to do Laundry?", "how long will it take you?", or "can you do this laundry for me?". Things like "how old are you?" are not relevant and shouldn't be on the approved list of questions.
Objects hold information (data). A poorly designed person (object) will allow you to access all aspects of their life, such as their age, their salary, and their sex. Even worst is a person (object) that lets you change all of this. Why should you be allowed to change the Laundry person's age when it has nothing to do with your desire to get Laundry done ... you shouldn't! A good person (object) will hide all of this and only allow you to ask things on the approved questions list and nothing else.
Objects live and die (created or destroyed). You can create a new Laundry person or end their existence. A greater power (the runtime) knows how to create them and what to do when they die. You can ask for their creation and ask them to destroy themselves, ask the higher power, or sometimes the higher power (the runtime) manages it for you.
Objects have a definition (class). How does the creator (the runtime) know how to create a Laundry person vs. a Taxi person? This get defined along with how they do things, what information they will remember, how they answer questions, how they live & die ... etc, etc, etc. If someone doesn't say how the Laundry person will drive a car, they can't. More importantly, if you didn't define this person yourself, how else will you know what you can ask of them? Definitions are critical when you are talking to a person (object) of someone else's design.
Source: https://www.quora.com/What-is-object-oriented-programming
nice post
ReplyDeleteTHE CREATING EXPERTS is one of the leading training provider in SELENIUM here is the link
ReplyDeletehttp://thecreatingexperts.com/selenium-training-in-chennai/
contact +91-08122241286