1%
OnePercentDev
LearnRoadmapsCommunityPodcastConsult
Log inJoin OnePercentDev
1%
OnePercentDev

Build. Debug. Ship. AI-ready.
Disciplined daily learning for the AI era.

Navigation

  • Learn
  • Roadmaps
  • Community
  • Podcast
  • Consult

Platform

  • Python for AI
  • Create Account
  • Dashboard

Stay Updated

Get notified about new courses and content drops.

© 2026 OnePercentDev. All rights reserved.

Python for AI
Part 42
Lesson 44
15:56

Why Production Code Needs OOP Thinking | Functions ಸಕಗಲ್ವಾ ? | OOP Master Flow | Part-42

Subscribe on YouTube

Up Next

44 / 58
  • 36:29

    Production-ನಲ್ಲಿ Class Use ಮಾಡೋ Moment ಯಾವುದು? | OOP Master Flow | Part-43

    Part 43

  • 17:16

    Encapsulation Truth No One Taught You | OOP Master Flow | Part-44

    Part 44

View all 58 lessons
View on GitHub

Part 42 — OOP Intro (1): Two Ways to Organize Code (the Restaurant Picture)

This is the first of two intro videos. Here we build the big picture — how code is organized — using one running analogy: a restaurant. Part 43 dives into the details.


Where You Are in the Journey

You have finished four stages of this series — all procedural:

  • Foundations (1–16): writing code, data types, conditions, loops
  • Data Structures (17–23): list, tuple, set, dict
  • Functions = Procedural (24–28): organizing code as reusable actions
  • Project Skills (29–41): modules, errors, files, debugging, logging

Now we begin the fifth stage: Object-Oriented Programming (OOP).


Big Code Needs Order → Two Roads

When a program grows big, Python gives you two ways to organize it:

  • Road 1 — Functions (Procedural): reusable actions. (Done — Parts 24–28.)
  • Road 2 — Classes (OOP): model real things, each with its own data and actions.

Why the Word "Procedural"?

A procedure = step-by-step actions, like a recipe. Procedural code is built around actions; data just travels into functions.

Exam note: Python is multi-paradigm — it supports procedural, object-oriented, and functional styles. "Procedural" is a style, not the whole language.


So What Exactly Is a Class?

class is not a Python invention — it is a Computer Science word from Simula (1967), meaning "a kind / a category of thing." A class lets you build your own kind of thing that keeps its data, its actions, and its rules together under one name.


The Restaurant Picture

Think about cooking and serving food.

  • A small tea shop — one person doing everything. He chops, boils, pours, serves, and takes the money — all by himself, following a recipe in his head. This is procedural: you alone with a recipe, organizing around tasks.
  • A big restaurant — organized by roles. You cannot run it alone. You need job roles (waiter, chef, cashier) and hired staff who each own their own work. This is OOP: a staffed restaurant, organizing around things (objects).
RestaurantCodeWhat it is
The job role — "Waiter" (holds an order-pad; can take orders & serve)Classa type: defines data + abilities
Ravi and Anil, two actual hired waitersObjectsreal things made from that role
You alone with a recipeProceduralorganize around tasks
A staffed restaurantOOPorganize around things (objects)

A class is a job role. An object is an employee in that role. Procedural = doing everything yourself with a recipe; OOP = running a staffed restaurant where each worker owns their own data and actions.

class Waiter:                    # the ROLE (class) — defines data + actions
    def __init__(self, name):
        self.name = name         # each waiter's own data
    def take_order(self, dish):  # what every waiter can DO
        return f"{self.name} is serving {dish}"

ravi = Waiter("Ravi")            # an OBJECT — a real waiter hired into the role
anil = Waiter("Anil")            # another object, same role, own data

Class = a Tool · OOP = a Management Skill

Here is the key idea to hold onto:

  • A class is a tool. It defines one role — one kind of thing.
  • OOP is a management skill. To run a huge restaurant well, roles alone are not enough — you need the skills to organize all those roles and staff so the place scales without chaos.

Those skills are the 4 pillars — and they are just good restaurant management, not rules that limit what restaurant you can open:

PillarIn the restaurant
EncapsulationThe kitchen is walled off — customers can't walk in and cook. You go through the waiter (the door / method).
AbstractionYou order "Paneer Butter Masala" off the menu — you don't know or care how the chef makes it.
Inheritance"Head Chef" is built on "Chef" — all the chef's skills, plus extra. Reuse the role, don't recreate it.
PolymorphismTell any staff "introduce yourself" — the chef, waiter, cashier each do it their own way. Same instruction, different result.

(We open each pillar in detail in later parts. Here they are only a preview — the management skills that come after you have the tool.)


The Ending Note: A Class Is Your Own Data Type

You will hear "a class is a blueprint" or "a template." Those are hints, not the answer. The real, provable truth:

A class lets you create your own data type — one Python treats exactly like int, str, or list.

That is the promise. In Part 43 we prove it — and answer the deeper question: why do we even need this new kind of thing?


Where This Applies in Real Work

  • Django / FastAPI models: each table or request body is a class (a "role"); each record is an object.
  • AI agents: an agent is a class with state + behavior; each running agent is an object.
  • Games: every player, enemy, and item is an object built from a class.

The common thread: real systems are staffed restaurants, not one-person tea shops.


Practice Assignment

  1. Write a Waiter class with a name and a take_order(dish) method.
  2. "Hire" three waiters (three objects) and have each take a different order.
  3. In one comment, map each piece back to the restaurant: which part is the role (class), and which are the employees (objects)?

Save as src/restaurant_intro.py.


Next: Part 43 — Why We Need Classes → What is OOP. We prove a class is your own data type, look under the hood at what class really does, and finally define OOP.

Logging, Grafana, Prometheus and Sentry | Production Logging Every Developer Must Know | Part-41Production-ನಲ್ಲಿ Class Use ಮಾಡೋ Moment ಯಾವುದು? | OOP Master Flow | Part-43

Up Next

44 / 58
  • 36:29

    Production-ನಲ್ಲಿ Class Use ಮಾಡೋ Moment ಯಾವುದು? | OOP Master Flow | Part-43

    Part 43

  • 17:16

    Encapsulation Truth No One Taught You | OOP Master Flow | Part-44

    Part 44

View all 58 lessons

GitHub Notes

View Part 42 notes on GitHub
GitHub Notes
View Part 42 notes on GitHub
PrevNext
19:43
19:43

Best Developers ಎಲ್ಲಾ Lazy?🔥 Python Inheritance in Kannada | OOP Master Flow | Part-45

Part 45

Best Developers ಎಲ್ಲಾ Lazy?🔥 Python Inheritance in Kannada | OOP Master Flow | Part-45

Part 45

  • 14:19

    Production Codeನಲ್ಲಿ Polymorphism ಯಾಕೆ Powerful ? OOP Master Flow | Part-46

    Part 46

  • 14:19

    Production Codeನಲ್ಲಿ Polymorphism ಯಾಕೆ Powerful ? OOP Master Flow | Part-46

    Part 46

  • 19:38

    Understand Abstraction Like a Senior Developer | OOP Master Flow | Part-47

    Part 47

  • 19:38

    Understand Abstraction Like a Senior Developer | OOP Master Flow | Part-47

    Part 47

  • 18:19

    SOLID Principles: Production Codeಗೆ OOP ಮಾತ್ರ ಸಾಕಾಗುತ್ತಾ? | OOP Master Flow | Part 48

    Part 48

  • 18:19

    SOLID Principles: Production Codeಗೆ OOP ಮಾತ್ರ ಸಾಕಾಗುತ್ತಾ? | OOP Master Flow | Part 48

    Part 48

  • 18:36

    Dunder Methods in Python : The Secret AI Uses to Code | Python in kannada | Part-49

    Part 49

  • 18:36

    Dunder Methods in Python : The Secret AI Uses to Code | Python in kannada | Part-49

    Part 49

  • 19:29

    Generators & Iterators: AI Streaming Under the Hood ಹೇಗೆ Work ಆಗುತ್ತೆ? | Python in Kannada | Part-50

    Part 50

  • 19:29

    Generators & Iterators: AI Streaming Under the Hood ಹೇಗೆ Work ಆಗುತ್ತೆ? | Python in Kannada | Part-50

    Part 50