What is an object in programming
A key and value was one label with one value (Lesson 11). But one person can't be captured with a single name. There's a name, an age, a hometown... Bundling these several labels into one box gives you an object.
Several labels in one box
In Lesson 11, a key and value was a single pair, like "apple → fruit."
But to describe one person, you need several pairs: name, age, where they live.
Collecting these into one box gives you an object.
Add the labels one at a time, and the pairs come together into one "person" box.
Each label is still just a key and a value.
What's changed is that the scattered pairs are now bundled into one box called "person."
So what does this whole box become?
The box becomes one "thing"
Carrying name, age, and hometown around separately gets confusing fast.
Bundle them into one box, and the box itself becomes one person: Mina.
Now you can hand a whole person over in one go.
Compare scattered pairs with a "person" bundled into one box. Once bundled, it's handled as one.
Now Mina isn't a pile of labels but a single thing with properties.
So how do you pick out just the "age" from inside this box?
Look inside with a dot
To take a value out of the box, you name the box and the label together, like "Mina's age" or "Mina's city."
It's usually written with a dot: mina.age → 12.
Point to the box, add a dot, and write the label you want.
Tap a label and "box.label" picks out just that value.
Now you can work with the whole box or with a single value inside it.
But Mina isn't the only person.
What if you want to make several people with the same shape?
Same template, different contents
Decide once which labels go into a "person" (name, age, city), and you can stamp out many people from that template.
Mina, Sora, and Tom all have the same fields, but the values inside are different.
Each time you press "make a person," another person is stamped out from the template. Same fields, different values.
Making the same shape again and again from one template is easy and cuts down on mistakes.
That's because the label names stay consistent.
This simple bundle is, in fact, nearly everything in a program.
A container for the real world, and beyond
Game characters (name, health), products (name, price), users (ID, level).
Most of what programs handle are objects like these, things from the world put into boxes.
In the next lesson, we'll look at how similar objects can inherit what they have in common.
Tap the character, product, and user tabs and you'll see all three are the same thing: "stuff in a box."
You learned pairs with keys and values (Lesson 11), and now you've bundled those pairs into a single thing.
Scattered information has become a meaningful object.
Next comes inheritance, where similar things pass their shared parts on to one another.