Unit 1 home
CLASS 1 · PART A ZERO JARGON · ZERO JAVA UNIT I · UI24PC320CS
CLASS 1 · P 1/13PGDN NEXT POINT · PGUP BACK

Part A · Classes 1–2 · Why software needs organising, then the sealed-box blueprint

The problem came first.
The programming language came later.

Part A carries one spine: four flatmates — Diya, Rohit, Krish and Trish — share a Kondapur flat and a broken expense register. Class 1 shows why scattered systems fail. Class 2 reveals the blueprint that fixes them. No Java syntax lives anywhere in this class.

THIS CLASSC1 · The problem OOP was invented to solve
NEXT CLASSC2 · One sealed box — class = blueprint
STORY SPINEFlatmate register + Hyderabad-hostel scenarios
SYLLABUS LINEObject Oriented System Development · Unit I

CLASS 1 · OPENER

Why software needs organising.

The problem OOP was invented to solve — before a single line of Java.

AFTER THIS CLASS YOU CAN
  • classifySort any real system — mess bills, library registers, scoresheets — as scattered or organised, and name which flatmate-register problem it repeats.
  • explainState the need of OOP over procedural programming in exam language — the exact 2-mark question this class ends on.
  • connectMap one app you use every day to the "related facts and steps kept together" idea.
WHERE THIS SITS
TODAY, IN ORDER
  • Why programming exists at all
  • Procedural programming, in plain English
  • Where it hurts — the flatmate expense register
  • Why the industry needed organised software
  • The evolution — Simula 67, Smalltalk, C++, then Java
  • Activity — scattered vs organised, six hostel situations
  • Three everyday analogies you already trust
  • What scattered systems cost in the real world
  • Activity — name one organised app, one scattered one
  • PYQ landing — need of OOP over proceduralPYQ P1·Q1·2m
  • Why this matters for your career, specifically

CLASS 01 OF 60 · 15 CORE-TAUGHT PAGES + 0 SELF-STUDY · FEEDS LAB 0

FIRST PRINCIPLES

Why does programming exist at all?

Strip away every buzzword and one sentence is left: humans have work that is too repetitive, too fast, or too large for humans — so we write instructions a machine can follow without us standing there.

Too repetitive

Splitting the mess bill among 40 hostel students, every single day. A human gets bored by day three and starts making mistakes. A machine never gets bored.

Too fast

UPI moves your money between banks in under two seconds. No clerk with a ledger book can move at that speed. Only instructions running on a machine can.

Too large

The JEE result day: lakhs of scores computed, ranked and published in hours. No army of humans could do it — one well-organised program does.

THE FIRST ANSWER

Procedural programming, in plain English.

The oldest arrangement, and an honest one: write the instructions as a list of steps — a recipe — and keep the facts in a separate pile that any step may reach into. Step 1, step 2, step 3, done.

THE DINNER-BILL RECIPE — WRITTEN THE WAY A PROCEDURAL PROGRAMMER WRITES IT, ONE STEP AT A TIME

STEP 1 · COLLECT AMOUNTS STEP 2 · ADD THEM UP STEP 3 · DIVIDE BY FOUR STEP 4 · ANNOUNCE SHARES
THE FACTS — amounts, names, dates — SIT IN A SEPARATE OPEN PILE ANY STEP CAN TOUCH

NOW RUN THE RECIPE WITH REAL NUMBERS — LAST FRIDAY'S ACTUAL DINNER

BIRYANI ×2 · ₹560 + CURRY ₹240 + DRINKS ₹160 + DELIVERY ₹48
= ₹1,008 TOTAL ÷ 4 = ₹252 EACH

Four steps, one division — the recipe wins. No ceremony needed.

BUT — Krish already paid the ₹48 delivery from his pocket…
960 ÷ 4 = ₹240 then KRISH PAYS 240 − 48 = ₹192

One tiny real-life fact and the recipe already needs a rewrite — and this correction lives in whose notebook? Exactly. Hold that itch.

WHERE IT HURTS

Four flatmates. Four notebooks.
Zero answers.

Diya, Rohit, Krish and Trish share a flat in Kondapur. Their expense system is pure procedural thinking: separate steps, separate piles of facts, no single owner. Watch it fail.

D
DiyaKEEPS THE RENT NOTEBOOK

Writes every rent payment in her own diary. Her totals never match anyone else's.

R
RohitKEEPS THE GROCERIES LIST

Photos of bills in his gallery, amounts in his chat with himself. Finding anything takes forever.

K
KrishKEEPS THE WIFI & POWER BILLS

One spreadsheet, three versions, none current. Which file is the truth? Nobody knows.

T
TrishKEEPS THE SETTLEMENTS

Tries to settle up each month from the other three sources. Gives up every month.

PAIN 1 · The facts are scattered.

Rent lives in a diary, groceries in a photo gallery, bills in three spreadsheet versions. The same "flat expenses" idea is split across four unconnected piles.

PAIN 2 · There is no shared truth.

Ask "what did we spend this month?" and you get four different numbers. Not one of them is wrong on purpose — there is simply no single place the truth lives.

PAIN 3 · Every operation is duplicated.

"Add an expense" exists four times — Diya's way, Rohit's way, Krish's way, Trish's way. Fix a mistake in one and the other three keep the bug.

PAIN 4 · Simple questions become impossible.

"How much did I spend on groceries?" Nobody can answer. The data exists — every rupee is written down somewhere — but the arrangement makes the question unanswerable.

PUT A NUMBER ON THE PAIN — HOW MANY NOTEBOOK-PAIRS MUST AGREE?

For the month-end totals to be right, every pair of notebooks must be cross-checked against each other. Count the pairs for n notebooks — this is a series you already know:

pairs to reconcile = 1 + 2 + 3 + … + (n−1) = n(n−1) / 2
WHONOTEBOOKS nTHE ARITHMETICPAIRS TO RECONCILE
Two flatmates22 × 1 / 21 — trivial, do it over chai
Our flat44 × 3 / 26 — Trish's monthly nightmare, itemised
Hostel wing1010 × 9 / 245 — a full evening, guaranteed mistakes
Whole hostel mess4040 × 39 / 2780 — nobody even attempts it
1960s software team100100 × 99 / 24,950 — the software crisis, in one cell

Doubling the people quadruples the checking. That curve — not laziness — is why scattered systems die. One shared register makes the count n checks (everyone against ONE truth): 4, then 40, then 100 — a straight line instead of an explosion.

THE INDUSTRY'S VERSION

Now scale that flat up to a company.

By the 1960s, software teams were living the flatmate problem at industrial size — thousands of steps, millions of facts, hundreds of programmers all reaching into the same open pile. The industry even had a name for the era: the software crisis.

Change one thing, break ten

When any step can touch any fact, no change is safe. Fixing the rent total silently breaks the settlement step that was quietly depending on it.

The fix the industry chose

Keep related facts and the steps that work on them together, in one named unit, with one owner — and stop everyone else from reaching in directly.

That single sentence is OOP

Everything else in this course — classes, objects, encapsulation, inheritance — is machinery for enforcing that one sentence at industrial scale.

NOW WATCH ONE REGISTER RETIRE ALL FOUR PAINS — WITH REAL RUPEES

DIYA'S RENT DIARYmonth total: ₹21,340 ROHIT'S PHOTO GALLERYmonth total: ₹19,900 KRISH'S 3 SPREADSHEETSmonth total: ₹20,760 TRISH'S SETTLEMENT SCRAPSmonth total: ??

Four notebooks, four different answers to the SAME question. Now assemble the fix, piece by piece:

THE FLAT REGISTER

Related facts + the operations on them — kept together, in one named unit, with one owner, behind a controlled surface.

ONE SLOT IN — watch August's expenses enter, one line each, checked at the door ↓
DATEWHATWHO PAID
02 AUGRENTDiya16,000
05 AUGGROCERIESRohit1,240
09 AUGWIFIKrish799
14 AUGPOWERKrish1,101
18 AUGGROCERIESRohit860
ONE TOTAL — computed from one page, not four20,000

Not ₹21,340. Not ₹19,900. Not ₹20,760. ₹20,000 — because the register adds ONE column: 16,000 + 1,240 + 799 + 1,101 + 860.

↓ ONE WINDOW OUT — total? ₹20,000 · each share? 20,000 ÷ 4 = ₹5,000 · Rohit's groceries? 1,240 + 860 = ₹2,100
PAIN 1 ✓ FIXED
The facts were scattered.
4 piles · 3 different formats1 register · 1 format · 1 place to look
PAIN 2 ✓ FIXED
There was no shared truth.
4 totals: 21,340 / 19,900 / 20,760 / ??1 total: ₹20,000 — same for all four people
PAIN 3 ✓ FIXED
Every operation was duplicated.
"add expense" written 4 ways · a bug fixed 4 times1 slot · 1 rule · a bug fixed exactly once
PAIN 4 ✓ FIXED
Simple questions were impossible.
"Rohit's groceries?" = dig through 4 piles, give upfilter 1 column: 1,240 + 860 = ₹2,100, in seconds
BONUS · THE SERIES DIES
Month-end reconciliation, revisited.
n(n−1)/2 = 4×3/2 = 6 pair-checks, every month0 pair-checks — everyone reads the SAME page

…and the four private notebooks? Retired. Nobody reaches into an open pile again.

HOW WE GOT HERE

Four stops from 1967 to your laptop.

OOP wasn't invented in one flash. Four languages, each solving the previous one's shortfall, carried the idea to the language you'll write this semester.

1967 · NORWAY

Simula 67

Built to simulate real things — ships in a harbour, cars at a junction. Its authors realised the program should be arranged like the world it models: one unit per real thing, holding that thing's facts and behaviour together.

Gave us: the very idea of classes and objects.
1970s · XEROX PARC, USA

Smalltalk

Took Simula's idea and made it total: everything is an object, and objects talk only by sending messages. The purest version of OOP ever built — and the proof the idea could carry a whole system.

Gave us: OOP as a complete way of thinking, not a feature.
1983 · BELL LABS, USA

C++

Bolted classes onto C, the industry's workhorse. Suddenly OOP ran at full machine speed on real projects — but it kept every sharp edge of C, and large teams kept cutting themselves.

Gave us: OOP at industrial speed and industrial scale.
1995 · SUN MICROSYSTEMS

Java

Designed by James Gosling's team to keep C++'s power while filing off the sharp edges — and to run the same program on any machine. Thirty years on, it carries banks, Android and half the world's back ends.

Gave us: the language this course lives in. Its own origin story lands in Class 7.

YOUR TURN · ACTIVITY 1

Scattered or organised?

Six real situations from a Hyderabad engineering hostel. For each one: call it scattered or organised, and name which flatmate-register pain it repeats. Commit your answers in your notebook first — the solution sheet is locked below.

CLASSIFICATION ACTIVITY 6 SITUATIONSNOTEBOOK FIRST
SITUATION 1

The hostel mess bill is split by forwarding screenshots in a 40-member WhatsApp group; three people post corrections as replies.

SCATTERED?ORGANISED?WHICH PAIN?
SCATTERED

Pain 2 — no shared truth. The "current" bill is whichever screenshot you saw last; corrections live in reply threads nobody re-reads.

SITUATION 2

The same mess switches to one shared spreadsheet: one row per student, one column per day, one person allowed to edit, everyone can view.

SCATTERED?ORGANISED?WHICH PAIN?
ORGANISED

The register done right: facts in one place, one controlled way in (the single editor), every question answered from the same source.

SITUATION 3

The college library's paper register: borrowings written in whichever of three ledgers is nearest the door, by whoever is on duty.

SCATTERED?ORGANISED?WHICH PAIN?
SCATTERED

Pain 1 — scattered facts. "Is this book out?" needs a search through three ledgers. Same data, unanswerable question — the groceries problem again.

SITUATION 4

The same library's online catalogue: one record per book, and issuing happens only through the front-desk scanner.

SCATTERED?ORGANISED?WHICH PAIN?
ORGANISED

One unit per real thing (a book's record holds its facts), and one controlled operation (the scanner) instead of anyone scribbling anywhere.

SITUATION 5

A cricket-tournament scoresheet kept by four different scorers across four notebooks — one per ground — merged "later".

SCATTERED?ORGANISED?WHICH PAIN?
SCATTERED

Pain 3 — duplicated operations. "Record a wicket" exists four times, four ways. The merge fails exactly like Trish's month-end settlement.

SITUATION 6

The tournament switches to one scorer with one master sheet per match; ground volunteers phone updates in to that one scorer.

SCATTERED?ORGANISED?WHICH PAIN?
ORGANISED

One owner, one slot in. Updates flow through a single controlled channel — the "one slot, one window" register the flat needs.

Rule of the room: answers go in your notebook before the lock opens.

YOU ALREADY TRUST THIS IDEA

Three systems you never question.

"Related facts and the operations on them, kept together with one owner" isn't a programming trick — it's how every well-run system you already use works.

The library catalogue

One record per book: title, shelf, who has it, due date — together. You never hunt three ledgers. Issuing and returning are the record's own fixed operations.

The hospital patient file

Everything about one patient — history, allergies, prescriptions — travels as one unit. Only doctors write in it. Imagine your allergies scattered across four departments' notebooks.

The college ID card system

One card, one student: photo, roll number, library rights, mess plan — bundled. Update it in one office and every gate, library and mess sees the change at once.

THE STAKES

Scattered isn't just untidy.
It's expensive — and dangerous.

Two real-world shapes of the flatmate problem, still with zero jargon. These are the failures organised software exists to prevent.

The hospital with two files.

Cardiology and General Medicine each keep their own record for the same patient. An allergy noted in one file never reaches the other — and a prescription written downstairs contradicts a warning written upstairs. Scattered facts stop being an inconvenience and become a patient-safety failure.

The bank with two balances.

Two branches keep separate ledgers for one account, reconciled overnight. Withdraw at both before the sync and the "same" account pays out twice. Every modern bank rebuilt itself around one shared source of truth precisely to prevent this — Trish's settlement problem, with real money.

DO THE BANK'S MATHS — ONE ACCOUNT, TWO LEDGERS, ONE AFTERNOON

REAL BALANCE · ₹10,000 BRANCH A LEDGER SAYS ₹10,000 BRANCH B LEDGER ALSO SAYS ₹10,000
2:00 PM · WITHDRAW ₹8,000 AT BRANCH A ✓ (A now says ₹2,000) 2:20 PM · WITHDRAW ₹8,000 AT BRANCH B ✓ (B still said ₹10,000!)
= PAID OUT ₹16,000 FROM A ₹10,000 ACCOUNT — BANK LOSES ₹6,000

Now scale it: a mid-size bank clears ~2 lakh withdrawals a day. If even 0.1% hit this gap at ₹6,000 each, that is 200 × 6,000 = ₹12,00,000 lost per day — ₹43.8 crore a year. That is the price tag of "two notebooks for one truth", and why the fix was worth rebuilding every core banking system on earth.

YOUR TURN · ACTIVITY 2

Find it in your own phone.

Name one app or system you use that clearly keeps related facts and steps together — and one that still feels scattered. For the scattered one, say in a single line which flatmate-register pain it repeats. Notebook first; the solution sheet shows worked examples, not "the" answer.

REAL-WORLD CONNECTION ACTIVITY 2 PICKS + 1 LINENOTEBOOK FIRST

Prompts if you're stuck: a food-delivery order tracker · the college attendance portal · a shared hostel mess-bill sheet · your own gallery-plus-chats "system" for remembering money.

WORKED EXAMPLE · ORGANISED

A food-delivery order tracker. Everything about one order — items, price, payment, rider, live location — lives on one screen as one unit. You never ask "which app knows where my food is?" One order, one record, one place to look.

Why it qualifies: one unit per real thing (the order), facts + allowed operations (track · cancel · rate) kept together, updated through one channel.

WORKED EXAMPLE · SCATTERED

A typical group trip's money trail. Tickets on one person's card, hotel in another's UPI history, food split across three apps, "we'll settle later" in a chat. Sound familiar?

The one-liner the activity asks for: "It repeats Pain 2 — no shared truth: every question about who owes whom has four different answers."

WORKED EXAMPLE · ORGANISED

The college attendance portal. One record per student per course; only faculty can mark it; you and the exam cell read the same number. Nobody "merges notebooks" before condonation lists go out.

Why it qualifies: single source of truth with controlled write access — the mess-spreadsheet pattern at college scale.

Your own two picks first — then compare against the worked examples.

EXAM LANDING · FIRST OF 52

This exact question has been asked.

Everything this class built converges on one 2-mark past-paper question. Watch the model answer assemble point by point — each register failure on the left earns its OOP fix on the right.

PAST PAPER · PAPER 1 · QUESTION 1 2 MARKSUNIT IREVISIT: THIS WHOLE CLASS
P1 · Q1 · 2m

Q1. State the need of OOP over procedural programming. [2 M]

THE REGISTER FAILUREWHAT OOP ADDED

Four separate notebooks — the same "flat expenses" idea scattered over four piles.

One ExpenseRegister class — related data and its operations kept together in one named unit.

No shared truth — four different totals to every question.

Encapsulated state — the data lives in one protected place, changed only through its own operations.

Every operation duplicated — "add an expense" written four ways, bugs fixed in one copy only.

One method per operation — each action defined once, reused by everyone, fixed in one place.

"How much did I spend on groceries?" — unanswerable, though every rupee was recorded.

One source of truth — every roommate reads the same register, so every question has exactly one answer.

…write any two pairs in the exam — need = what OOP added, shown against what failed. ✓ 2/2

PROCEDURAL · SCATTERED notebook 1 · groceries notebook 2 · rent split notebook 3 · electricity notebook 4 · “add” ×4 ways 4 versions of ONE truth gathered into ONE unit ExpenseRegister data: all expenses · one place addExpense() · defined ONCE totalFor(“groceries”) ONE answer to every question data + operations TOGETHER = encapsulation · each operation ONCE = no duplicates
THE 2-MARK ANSWER, DRAWN · LEFT EDGE-BUNDLE = THE FAILURE · THE GREEN BOX = ALL FOUR FIXES AT ONCE

Beyond the marks: the deep version of this answer is one sentence — procedural code organises programs around actions that share loose data; OOP organises them around things that own their data. Every named need — encapsulation, one addExpense() instead of four, one source of truth — is that sentence wearing a different hat. Classes 2–11 spend the whole unit unpacking it.

MICRO-EXAMPLE 2 · THE CRICKET SCOREBOOK (procedural)

Runs noted in one friend's book, overs in another's, wickets in a third — and each scorer adds runs his own way. Mid-match question "what's the run rate?" gets three answers, and a fix to one book never reaches the other two.

The need it proves: OOP keeps the WHOLE score in ONE scoreboard unit with one addRun / one addWicket — every fact and its operations together, so one question has one answer.

MICRO-EXAMPLE 3 · THE MEDICAL SHOP (procedural)

Stock in one register, prices in a second, expiry dates in a third; every assistant writes their own "sell a strip" routine. One assistant forgets to cross off stock — the shop sells medicine it doesn't have.

The need it proves: OOP gives ONE Medicine record owning stock + price + expiry, changed only through its own sell / restock — encapsulated state, single definition of each operation.

MICRO-EXAMPLE 4 · YOU ALREADY SAW THIS ONE (Part 10!)

The two-branch bank: Branch A's notebook said ₹2,000, Branch B's still said ₹10,000 — and the bank paid out ₹16,000 from a ₹10,000 account.

The need it proves: ONE Account object as the single source of truth, with a withdraw that checks the ONE real balance — the ₹43.8-crore-a-year argument for OOP.

EXAM CRAFT · THE SAME 2/2 ANSWER IN ANY COSTUME
any 2 rows = 2m

Pick ANY example universe you remember — then write two pairs in this exact shape:

Scattered facts — four notebooks / three scorebooks / three registers for ONE real thing.

Need 1: one class per real thing — its data and operations kept together in one named unit.

Anyone scribbles anywhere — each scorer/assistant/roommate updates their own way.

Need 2: encapsulation — state changes only through the unit's own operations.

The same step written many ways — "add expense" / "add run" / "sell strip" duplicated, bug-fixed in one copy only.

Need 3: one method per operation — defined once, reused by all, fixed in one place.

Every question has several answers — three run rates, two balances, four totals.

Need 4: one source of truth — everyone reads the same record, so one question has one answer.

Four needs, any costume, any two pairs — that's a full-marks answer you can rebuild from ANY of today's four stories. ✓ 2/2

COMMON SLIP — READ THIS TWICE

The question asks for the need, not for what's wrong with procedural. Listing procedural's problems alone scores half. Name what OOP added — kept-together data and operations, encapsulated state, single definition of each operation, one source of truth — and anchor each to the failure it cures.

WHY YOU, WHY NOW

Every codebase you'll ever touch
is organised well — or badly.

This wasn't a history lesson. It's the single lens you'll use on every internship, every placement test, every job.

In interviews

"Why OOP?" is a first-round staple — and you now hold a two-column answer with a story behind it, not a memorised list.

In real codebases

Your first industry task will be reading someone else's code. After Unit 1 you'll spot within minutes whether its facts and steps live together or in four notebooks.

In your own projects

Every mini-project, hackathon and final-year build now starts with the right question: what are the real things here, and what does each one own?