YouTube
Why OOP
On this page
- Why OOP?
- Procedural code works, **until it doesn't**
- What goes wrong at scale
- The problem is not writing code. It's **organising** code as it grows.
- Things that have **data** and can do actions
- Class vs **Object**
- A class is the **blueprint** of a house; objects are the houses built from it.
- Four practical problems, **solved**
- OOP in the **real world**
- Changing Code Is **Most** Of The Job
Notes
Before we learn classes and objects, we need to feel the pain OOP was invented to fix.
That pain shows up the moment a program grows.
Notes
String student1Name = "Aman"; int student1Marks = 82; ... Kabir's marks = -40; nothing stops invalid data.
static void printReport(String name, int marks) and updateMarks(String name, int marks) sit far from the data they touch.
This is the shape of procedural code: data here, logic there, no connection enforced.
Notes
10,000 students means 20,000 loose variables or messy parallel arrays.
Invalid data (negative marks) slips in because nothing guards it.
Changing one field means hunting through every function that touches it.
Ten developers working on this code will step on each other.
Notes
Key idea: the problem is not writing code. It's organising code as it grows.
Notes
Look around you: a car, a bank account, a student — each bundles data with actions.
OOP says: put the data and the actions together, in one unit.
class Student { String name; int marks; void printReport() {...} } — aman.printReport();
Notes
Class: the blueprint. Written once.
Object: a real thing built from the blueprint. Created as many times as you need.
Notes
Key idea: a class is the blueprint of a house; objects are the houses built from it.
Notes
OOP is not about fancy syntax. It solves four very practical problems every real project faces.
Notes
Teams: one developer owns Payment, another owns Order. Clear boundaries.
Maintenance: most of a product's life is spent changing code, not writing it fresh.
Testing: small objects with clear jobs are easy to test.
Interviews: OOP questions show up in almost every Java interview.
Notes
Key idea: OOP makes code easier to change, and changing code is most of the job.





