It's been years since I thought of this, but I am training some real juniors soon and need to explain what an object is to someone who doesn't know what it is.
Based on what you use in the real world, what are the key points of objects that I should focus on explaining. For example:
Generally, we use the word 'object' to talk about the thing/person that the action is done to. Or, the one who receives the action. A direct object is a noun or pronoun that receives the action of a verb in a sentence. Usually, it answers the questions what? or whom? about the verb.
An object is a noun (or pronoun) that is acted upon by a verb or a preposition. There are three kinds of object: Direct Object (e.g., I know him.) Indirect Object (e.g., Give her the prize.) Object of a Preposition (e.g., Sit with them.)
Objects can be described in terms of the materials they are made of and their physical properties. Describe objects in terms of color, size, shape, weight, texture, flexibility, strength and the types of materials in the object.
Back when I was learning OOP, I was puzzled by all these "car / animal / whatever" metaphors. They didn't help me at all. Then someone said that a class/object is just a set of variables (class members) and functions to deal with them (methods) - which is actually true. It was that simple!
Using all these popular metaphors is just misleading people, IMHO. Cars don't have that much in common with OOP. It's easy to understand these metaphors when you already know what they mean, but trying to begin with them... no.
I like the original metaphor used by Alan Kay, who coined "object-oriented programming": Objects are like cells in a body. They are each programmed with their own behaviors and communicate by passing messages to one another, which they again respond to with their own internally defined behavior. No one cell knows what's inside another — they just know how to handle their own tasks and communicate with each other.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With