Yesterday we found the objects in a system. Today we turned them into classes.
1. The Cookie Cutter
- A class is the cookie cutter — the mould. It defines the shape and structure.
- An object is the cookie — the real thing made from that mould.
Classes exist at design time. Objects exist in reality, because they occupy memory. You can’t eat the cutter.
(Pedantically, in Python a class is itself an object at runtime. The blueprint framing is still the one to hold on to.)
2. What Goes Inside
| In plain English | The real term |
|---|---|
| Contents — the data an object carries | Attributes |
| Capabilities — what it can do | Methods |
A student attendance system, worked through:
- Attributes: unique ID, standard, section, name, school, branch, city
- Methods: mark present or absent for a given date
That’s the whole exercise — decide what it holds, decide what it does.
3. The Same Idea in Three Languages
| Language | Defining | Creating an object |
|---|---|---|
| Python | class Student: | s = Student() |
| Java | class Student { | Student s = new Student(); |
| C# | class Student { | Student s = new Student(); |
Java and C# both require new; Python doesn’t. Both draw on the C and C++ lineage, which is why they look so similar to each other.
Naming matters: Python convention is CapWords for class names — Student, SavingsBankAccount. A lowercase name reads like a function, and that confusion compounds.
Don’t memorise the syntax. The concept transfers; the punctuation is a lookup.
4. You’ve Been Using This All Along
Every library you’ve touched is built this way:
Meta’s WhatsApp SDK — a WhatsAppBusinessAccount class gives you an object, and you call get_messages() or send_whatsapp_template_message() on it.
An SSH connection — instantiate a client, call connect(), do the work, close it.
Banking — a SavingsBankAccount class defines transfer(), so one account object can move ₹5,000 to another.
Spot the pattern: create an object, then call its methods. That’s what reading library documentation is really teaching you.
5. CLI vs Web Server
Same code, different trigger:
- Command line — you run the script yourself, no browser involved.
- Web server — the code is deployed as an API, and an HTTP request runs it.
Nothing about the class changes. Only what starts it.
✅ Action Items
- Open code you’ve already written or used and identify where an object is created from a class. It’s there — you just weren’t naming it.
- Try a practical example — send a WhatsApp message or a Gmail email from Python — and watch the object-oriented pattern in the library’s API.
- Keep refining yesterday’s designs: attendance system and spend analyzer.
⏭️ Next up: writing these classes properly — constructors and self.
