Python

P
PythonHub
Progress 0%

Python

  • Home
  • History of Python
  • Applications of Python
  • Introduction To Python
    • What is Python
    • Character Set
    • Tokens in Python
    • Python Execution Mode
    • Variable And Identifiers
    • Data Types in Python
    • Operators And Expressions
    • Constants in Python
    • Assignment Statement
    • Input / Output in Python
    • Simple Python Scripts
    • Namespace in Python
    • 📝 Assignments
  • Operators in Python
    • Arithmetic Operators
    • Assignment Operators
    • Shorthand Assignment Operators
    • Relational Operators
    • Logical Operators
    • Bitwise Operators
    • Special Operators
    • 📝 Assignments
  • Input Output in Python
    • Accept Input
    • Output Formatting
    • 📝 Assignments
  • Conditional Statement
    • Decision Making
    • if Statement
    • IF-ELSE STATEMENT
    • IF-ELSE LADDER
    • NESTED IF-ELSE
    • Short Hand IF-ELSE
    • 📝 Assignments
  • Loops
    • Introduction to Loops
    • While Loop
    • Nested While Loop
    • 📝 While Loop Assignments
    • For Loop
    • For Loop Examples
    • Nested For Loop
    • Nested For Loop Examples
    • Infinite While Loops
    • Infinite For Loops
    • Break, Continue and Else in Loops
    • Difference Between For and While Loop
    • For Each Loop
    • 📝 For Each Assignments
    • 📝 All Loops Assignments
  • List
    • List in Python
    • Access List Elements
    • List Functions
    • Iterate (Loop) List
    • List Comprehension
    • 📝 Assignments
  • Tuple
    • Tuple in Python
    • Access Tuple Elements
    • Tuple Functions
    • Iterate (Loop) Tuple
    • Unpack Tuple
    • Tuple Comprehension
    • 📝 Assignments
  • Set
    • Set in Python
    • Access Set Elements
    • Set Methods
    • Iterate (Loop) Set
    • Pack/Unpack Set
    • Set Comprehension
    • 📝 Assignments
  • Dictionary
    • Dictionary
    • Access Dictionary Items
    • Dictionary Methods
    • Iterate (Loop) Dictionary
    • Formatting Dictionaries
    • Nested Dictionaries
    • Dictionary Comprehension
    • 📝 Assignments
  • Diff List Tuple Set Dictionary
    • List vs Tuple
    • List vs Set
    • List vs Dictionary
    • Tuple vs Set
    • Tuple vs Dictionary
    • Dictionary vs Set
    • 📝 Assignments
  • Exception
    • Error vs Exception
    • Types of Exception
    • Exception Handling
    • User Defined Exception
    • Logging Exception
    • 📝 Assignments
  • Functions
    • Introduction to Functions
    • Modular Programming
    • Types of Functions
    • Inbuilt Functions
    • Need For User-Defined Function
    • Elements of User Defined Function
    • Function Arguments
    • Nesting of Functions
    • Recursion
    • Global Local and Non Local
    • Python Lambda Functions
    • 📝 Assignments
  • Python Module
    • Introduction to Module
    • Inbuilt Modules in Python
    • User Defined Module
    • 📝 Assignments
  • File Handling
    • Introduction to Files
    • Create File
    • Read Files
    • Write to File
    • Rename File
    • Copy File
    • Move File
    • List Files in Directory
    • Binary Files
    • Zipping and Unzipping Files
    • 📝 Assignments
  • Strings
    • Basics of Strings
    • String Special Operators
    • String Formatting Operators
    • String Methods
    • 📝 Assignments
  • Regular Expressions
  • Python OOPS
    • Basics of Object Oriented
    • What are Classes and Objects?
    • Creating Class and Object
    • OOP vs Procedural Programming
    • Difference Between Classes and Objects
    • Constructors
    • Destructor
    • Built Class Methods and Attributes
    • Class and Instance Variables
    • Inheritance in Python
    • Single Inheritance
    • Multiple Inheritance
    • Multilevel Inheritance
    • Hierarchical Inheritance
    • Hybrid Inheritance
    • Abstraction
    • Method Overriding
    • Abstract Method
    • Interfaces in Python
    • Abstract Class vs Interface
    • Public, Private and Protected
    • Overloading vs Overriding
    • Inheritance vs Composition
    • Encapsulation
    • Polymorphism
    • Inner Classes
    • 📝 Assignments
  • Advanced Python
    • Iterator in Python
    • Generator in Python
    • Decorator in Python
    • Type Hints in Python
    • Async/Await Programming
    • Dataclasses in Python
    • Context Managers in Python
    • Property Decorator in Python
    • __slots__ in Python
    • Enums in Python
    • Walrus Operator in Python
    • Match-Case in Python
    • 📝 Assignments
  • Python Standard Library
    • Collections Module
    • Itertools Module
    • Functools Module
    • Datetime Module
    • JSON Module
    • OS Module
    • Sys Module
    • Random Module
    • Math Module
    • 📝 Assignments
  • Python Testing
    • Unit Testing in Python
    • Pytest Framework
    • Mocking in Python
    • 📝 Assignments
  • Python Best Practices
    • PEP 8 Style Guide
    • Docstrings in Python
    • Logging in Python
    • Code Optimization Tips
    • Debugging Techniques
    • 📝 Assignments
  • MySQL Database in Python
    • Introduction to MySQL with Python
    • DBMS vs File System
    • Connecting to MySQL Database
    • Create Database in MySQL
    • Create Table in MySQL
    • Insert Data in MySQL
    • Insert Multiple Rows
    • Select Data from MySQL
    • WHERE Clause in MySQL
    • Update Data in MySQL
    • Delete Data from MySQL
    • Parameterized Queries
    • Transaction Management
    • Error Handling
    • Connection Pooling
    • MySQL Drivers Guide
    • Joins in MySQL
    • Aggregation Functions
    • Backup MySQL Database
    • Best Practices
    • 📝 Assignments
  • MySQL Database Operations
    • SELECT Statement
    • MySQL Operators
    • DDL Statements
    • DML Statements
    • Subqueries
    • JOIN Operations
    • Aggregation
    • Case Study
    • 📝 Assignments
  • Graphics in Python
  • Threads in Python
    • Introduction to Threads
    • Process vs Threads
    • Concurrent Programming & GIL
    • Uses of Threads
    • Creating Threads
    • Single Tasking
    • Multi Tasking
    • Thread Synchronization
    • 📝 Assignments
  • Interview Questions & Answers
  • Python Case Studies
  • Multiple Choice Questions
  • 📝 Practice Problems
Get in Touch
  • tech2dsm@gmail.com

© Sankalan Data Tech

Python Language Interactive Tutorial

Python: OOP vs Procedural Programming

Python OOP vs Procedural Programming - Complete Guide

Understand the differences between Object-Oriented and Procedural Programming to choose the right approach for your projects.

Created by Sankalan Data Tech Team Verified
Data Engineers, Analysts, Scientists & Trainers
Created by experienced Python developers, data engineers, and data scientists to make programming easy through practical examples, real-world experience, and clear explanations.
On this page:
  • Two Ways to Write Code
  • What is Procedural Programming?
  • What is Object-Oriented Programming?
  • Side-by-Side Comparison
  • When to Use OOP
  • When to Use Procedural
  • Combining Both Approaches
  • Try It Yourself
  • Quick Quiz
  • Frequently Asked Questions
Share this tutorial:
Twitter LinkedIn Facebook WhatsApp Reddit Telegram Email Copy Link
What You'll Learn Here
  • Procedural programming — what it is and how it works
  • Object-Oriented programming — what it is and how it works
  • Key differences — how the two approaches compare
  • When to use each — choosing the right approach
  • Hybrid approach — combining both styles
  • Real-world examples — seeing both in action

Two Ways to Write Code

When you write Python programs, you have a choice. You can write code in a procedural style, where you focus on functions and procedures that manipulate data. Or you can write in an object-oriented style, where you focus on objects that contain both data and behavior.

Neither approach is "better" than the other — they're just different tools for different jobs. Think of it like choosing between a hammer and a screwdriver. Both are useful, but you wouldn't use a hammer to drive a screw. The key is knowing when to use each.

In this tutorial, we'll explore both approaches side by side. You'll see how the same problem can be solved in different ways, and you'll learn how to choose the right approach for your projects.

💡 Key concept: Procedural programming focuses on "what to do" — it's about functions and steps. Object-Oriented programming focuses on "what things are" — it's about objects and their relationships.

What is Procedural Programming?

1

Understanding the Procedural Approach

Procedural programming is a programming paradigm based on the concept of procedure calls. In this style, you write programs as a sequence of instructions that tell the computer what to do step by step. The focus is on functions that perform specific tasks and data that is passed between them.

Definition: Procedural programming is a programming paradigm where programs are structured as a sequence of procedures (functions) that operate on data. The emphasis is on the steps needed to solve a problem.

# Example of Procedural Programming
# A simple bank account system written procedurally

# Data (separate from functions)
accounts = {}
next_account_number = 1

# Functions that operate on the data
def create_account(name, initial_balance=0):
    """Create a new bank account"""
    global next_account_number
    account_number = next_account_number
    next_account_number += 1
    accounts[account_number] = {
        "name": name,
        "balance": initial_balance,
        "transactions": []
    }
    return account_number

def deposit(account_number, amount):
    """Deposit money into an account"""
    if account_number in accounts:
        if amount > 0:
            accounts[account_number]["balance"] += amount
            accounts[account_number]["transactions"].append(f"Deposited: +${amount}")
            return f"Deposited ${amount}. New balance: ${accounts[account_number]['balance']}"
        else:
            return "Invalid deposit amount"
    else:
        return "Account not found"

def withdraw(account_number, amount):
    """Withdraw money from an account"""
    if account_number in accounts:
        if amount > 0 and amount <= accounts[account_number]["balance"]:
            accounts[account_number]["balance"] -= amount
            accounts[account_number]["transactions"].append(f"Withdrew: -${amount}")
            return f"Withdrew ${amount}. New balance: ${accounts[account_number]['balance']}"
        else:
            return "Insufficient funds or invalid amount"
    else:
        return "Account not found"

def get_balance(account_number):
    """Get the balance of an account"""
    if account_number in accounts:
        return f"Balance: ${accounts[account_number]['balance']}"
    else:
        return "Account not found"

def get_transactions(account_number):
    """Get the transaction history of an account"""
    if account_number in accounts:
        return accounts[account_number]["transactions"]
    else:
        return "Account not found"

# Using the procedural system
print("--- Procedural Banking System ---")

# Create accounts
acc1 = create_account("Alice", 1000)
acc2 = create_account("Bob", 500)

print(f"Alice's account number: {acc1}")
print(f"Bob's account number: {acc2}")

# Perform operations
print(deposit(acc1, 200))
print(withdraw(acc1, 150))
print(get_balance(acc1))
print(get_balance(acc2))
print(f"Transactions: {get_transactions(acc1)}")
                                

Key characteristics of procedural programming:

  • Data and functions are separate — data is passed to functions
  • Focus on steps — the program is a sequence of operations
  • Global state — data is often stored in global variables
  • Linear flow — the program follows a clear path from start to end
  • Simple and direct — good for small to medium programs
  • Less code overhead — no classes or objects to define

When procedural works well:

  • Simple scripts — quick automation tasks
  • Data processing — reading, transforming, and writing data
  • Linear problems — problems with a clear sequence of steps
  • Small projects — where complexity is low
  • Teaching basic concepts — introducing programming fundamentals

Quick Check: What is the main focus of procedural programming? (Answer: Functions and procedures that operate on data)

What is Object-Oriented Programming?

2

Understanding the Object-Oriented Approach

Object-Oriented Programming is a programming paradigm that organizes code around objects — which contain both data (attributes) and behavior (methods). The focus is on modeling real-world entities and their relationships.

Definition: Object-Oriented Programming is a programming paradigm where programs are structured as objects that contain both data and methods. The emphasis is on the objects and their interactions.

# Example of Object-Oriented Programming
# A simple bank account system written using OOP

class BankAccount:
    """A class representing a bank account"""
    
    _next_account_number = 1
    
    def __init__(self, name, initial_balance=0):
        self.account_number = BankAccount._next_account_number
        BankAccount._next_account_number += 1
        self.name = name
        self.balance = initial_balance
        self.transactions = []
    
    def deposit(self, amount):
        """Deposit money into the account"""
        if amount > 0:
            self.balance += amount
            self.transactions.append(f"Deposited: +${amount}")
            return f"Deposited ${amount}. New balance: ${self.balance}"
        else:
            return "Invalid deposit amount"
    
    def withdraw(self, amount):
        """Withdraw money from the account"""
        if amount > 0 and amount <= self.balance:
            self.balance -= amount
            self.transactions.append(f"Withdrew: -${amount}")
            return f"Withdrew ${amount}. New balance: ${self.balance}"
        else:
            return "Insufficient funds or invalid amount"
    
    def get_balance(self):
        """Get the account balance"""
        return f"Balance: ${self.balance}"
    
    def get_transactions(self):
        """Get the transaction history"""
        return self.transactions
    
    def transfer(self, target_account, amount):
        """Transfer money to another account"""
        if amount <= self.balance:
            self.withdraw(amount)
            target_account.deposit(amount)
            return f"Transferred ${amount} to {target_account.name}"
        else:
            return "Insufficient funds for transfer"

# Using the OOP system
print("--- OOP Banking System ---")

# Create accounts (objects)
alice_account = BankAccount("Alice", 1000)
bob_account = BankAccount("Bob", 500)

print(f"Alice's account number: {alice_account.account_number}")
print(f"Bob's account number: {bob_account.account_number}")

# Perform operations using methods
print(alice_account.deposit(200))
print(alice_account.withdraw(150))
print(alice_account.get_balance())
print(bob_account.get_balance())
print(f"Transactions: {alice_account.get_transactions()}")
                                

Key characteristics of Object-Oriented programming:

  • Data and functions are together — objects contain both
  • Focus on entities — the program models real-world things
  • Encapsulation — data is hidden inside objects
  • Reusability — classes can be reused across projects
  • Inheritance — classes can extend other classes
  • Polymorphism — objects can have different behaviors for the same method

When OOP works well:

  • Large projects — managing complexity is easier
  • Real-world modeling — representing things and relationships
  • Code reuse — creating reusable components
  • Team projects — clear separation of concerns
  • Maintainable code — changes are isolated to specific classes

Quick Check: What is the main focus of OOP? (Answer: Objects that contain both data and behavior)

Side-by-Side Comparison

3

Understanding the Key Differences

Now that we've seen both approaches in action, let's compare them directly. This will help you understand when to use each approach and why.

# Side-by-Side Comparison: Procedural vs OOP

# ------------------------------------------------
# 1. Data Organization
# ------------------------------------------------

# Procedural: Data is stored in separate structures
# Data is often global or passed between functions
accounts = {}
next_id = 1

# OOP: Data is stored inside objects
class Account:
    def __init__(self, name):
        self.name = name
        self.balance = 0

# ------------------------------------------------
# 2. Functions vs Methods
# ------------------------------------------------

# Procedural: Functions operate on data passed to them
def deposit(account, amount):
    account["balance"] += amount

# OOP: Methods belong to objects and operate on their data
class Account:
    def deposit(self, amount):
        self.balance += amount

# ------------------------------------------------
# 3. Code Organization
# ------------------------------------------------

# Procedural: Functions are organized by what they do
def process_account(account):
    # Many operations on a single account
    pass

def process_all_accounts(accounts):
    # Operations on multiple accounts
    pass

# OOP: Code is organized by what object it belongs to
class Account:
    # All account-related code is here
    pass

class Bank:
    # All bank-related code is here
    pass

# ------------------------------------------------
# 4. State Management
# ------------------------------------------------

# Procedural: State is often global or passed around
global_counter = 0
def increment():
    global global_counter
    global_counter += 1

# OOP: State is contained in objects
class Counter:
    def __init__(self):
        self.count = 0
    
    def increment(self):
        self.count += 1

# ------------------------------------------------
# 5. Extensibility
# ------------------------------------------------

# Procedural: Adding new features often means changing many functions
def process_new_type(data):
    # New function for new data type
    pass

# OOP: Adding new features often means creating new classes
class NewType(ExistingClass):
    # Inherit existing functionality, add new features
    pass
                                

Key differences at a glance:

Aspect Procedural OOP
Data & Functions Separate Together in objects
Focus Steps and operations Objects and relationships
State Global or passed Encapsulated in objects
Reusability Function reuse Class inheritance
Complexity Good for simple programs Good for complex programs
Learning curve Easier to start More concepts to learn

Analogy:

  • Procedural — like a recipe: follow steps in order
  • OOP — like a restaurant: different stations work together

Quick Check: What is the main difference between procedural and OOP? (Answer: Procedural separates data and functions; OOP combines them in objects)

When to Use OOP

4

Choosing Object-Oriented Programming

OOP is a powerful tool, but it's not always the right choice. Here are the situations where OOP shines, along with examples to help you recognize them.

# When to use OOP: Signs you should consider it

# 1. You're modeling real-world entities
# Example: A system that manages customers, orders, and products

class Customer:
    def __init__(self, name, email):
        self.name = name
        self.email = email
        self.orders = []
    
    def place_order(self, order):
        self.orders.append(order)
        return f"{self.name} placed order #{order.id}"

class Order:
    def __init__(self, order_id, items):
        self.id = order_id
        self.items = items
        self.total = sum(item.price for item in items)

class Product:
    def __init__(self, name, price):
        self.name = name
        self.price = price

# 2. You need to reuse code across projects
# Example: A logging system that can be used in different applications

class Logger:
    def __init__(self, name):
        self.name = name
        self.level = "INFO"
    
    def log(self, message, level="INFO"):
        if self._should_log(level):
            print(f"[{level}] {self.name}: {message}")
    
    def _should_log(self, level):
        # Complex logic to determine if log should be shown
        return True

# 3. You're working on a large project with multiple developers
# OOP helps organize code and define clear interfaces

class UserService:
    def get_user(self, user_id):
        # Complex logic to fetch user
        pass

class UserController:
    def __init__(self, user_service):
        self.user_service = user_service
    
    def display_user(self, user_id):
        user = self.user_service.get_user(user_id)
        # Display user information
        pass

# 4. You need to maintain code over time
# OOP makes it easier to add new features without breaking existing code

class PaymentProcessor:
    def process(self, amount):
        # Base implementation
        pass

class CreditCardPayment(PaymentProcessor):
    def process(self, amount):
        # Credit card specific logic
        pass

class PayPalPayment(PaymentProcessor):
    def process(self, amount):
        # PayPal specific logic
        pass
                                

When OOP is the right choice:

  • Real-world modeling — you're representing things in the real world
  • Large projects — managing complexity is important
  • Team projects — multiple developers need clear boundaries
  • Long-term maintenance — code will be extended over time
  • Reusable components — you want to reuse code across projects

Quick Check: When is OOP a good choice? (Answer: When modeling real-world entities or working on large projects)

When to Use Procedural

5

Choosing Procedural Programming

Procedural programming is simple and direct. It's often the best choice for certain types of problems. Here's when you should consider using it.

# When to use procedural: Signs you should consider it

# 1. You're writing a simple script or automation
# Example: A script to process CSV files

import csv

def process_csv_file(filename):
    """Read and process a CSV file"""
    data = []
    with open(filename, 'r') as file:
        reader = csv.reader(file)
        for row in reader:
            # Process each row
            data.append(row)
    return data

def calculate_statistics(data):
    """Calculate statistics from data"""
    total = sum(int(row[1]) for row in data[1:])
    count = len(data) - 1
    return total, count, total / count if count > 0 else 0

# Simple function calls
data = process_csv_file("data.csv")
total, count, average = calculate_statistics(data)
print(f"Total: {total}, Count: {count}, Average: {average}")

# 2. You're processing data in a pipeline
# Example: ETL (Extract, Transform, Load) process

def extract_data(source):
    # Extract data from source
    return data

def transform_data(data):
    # Transform the data
    return transformed_data

def load_data(data, destination):
    # Load data to destination
    pass

# Simple pipeline
data = extract_data("source")
data = transform_data(data)
load_data(data, "destination")

# 3. You're writing a simple tool or utility
# Example: A file renaming utility

import os

def get_files_in_directory(directory):
    return [f for f in os.listdir(directory) if os.path.isfile(os.path.join(directory, f))]

def rename_files(files, prefix):
    for file in files:
        new_name = f"{prefix}_{file}"
        os.rename(file, new_name)
        print(f"Renamed: {file} → {new_name}")

# Simple script flow
files = get_files_in_directory(".")
rename_files(files, "backup")
                                

When procedural is the right choice:

  • Simple scripts — quick automation and one-off tasks
  • Data processing — read, transform, write operations
  • Linear problems — clear sequence of steps
  • Small projects — where OOP would be overkill
  • Learning programming — starting with simpler concepts

Quick Check: When is procedural a good choice? (Answer: For simple scripts and linear data processing)

Combining Both Approaches

6

Using the Best of Both Worlds

You don't have to choose just one approach. Many Python programs use a hybrid approach — using OOP for the main structure and procedural style for helper functions. This gives you the benefits of both.

# Example of a hybrid approach

# OOP: Main structure uses classes
class Document:
    def __init__(self, title, content):
        self.title = title
        self.content = content
        self.words = content.split()
    
    def get_word_count(self):
        return len(self.words)
    
    def get_summary(self, sentence_count=2):
        # Using a procedural helper function
        return summarize_text(self.content, sentence_count)

# Procedural: Helper functions for specific tasks
def summarize_text(text, sentence_count):
    """Summarize text using simple extraction"""
    sentences = text.split('.')
    if len(sentences) <= sentence_count:
        return text
    
    # Simple summarization logic
    word_counts = {}
    for sentence in sentences:
        words = sentence.split()
        for word in words:
            word_counts[word] = word_counts.get(word, 0) + 1
    
    # Return first few sentences
    return '. '.join(sentences[:sentence_count]) + '.'

def clean_text(text):
    """Clean text by removing extra spaces"""
    return ' '.join(text.split())

def save_document(document, filename):
    """Save a document to a file"""
    with open(filename, 'w') as file:
        file.write(document.title + '\n')
        file.write('=' * len(document.title) + '\n')
        file.write(document.content)

# Using the hybrid approach
doc = Document("My Document", "This is the first sentence. This is the second sentence. This is the third sentence.")

# Using OOP methods
print(f"Word count: {doc.get_word_count()}")
print(f"Summary: {doc.get_summary(2)}")

# Using procedural helper functions
cleaned_content = clean_text(doc.content)
doc.content = cleaned_content
save_document(doc, "document.txt")
                                

Hybrid approach advantages:

  • Best of both — get benefits from both paradigms
  • Flexibility — use the right tool for each task
  • Pragmatic — focus on solving problems effectively
  • Common in Python — many libraries use this approach

Quick Check: What is a hybrid approach? (Answer: Using both OOP and procedural styles in the same program)

Try It Yourself

Experiment with both programming styles in the editor below.

Loading Pyodide... 0%
Python Code Editor
========================================
OOP VS PROCEDURAL PRACTICE
========================================

1. PROCEDURAL APPROACH
Rectangle: 5x3
Area (procedural): 15
Perimeter (procedural): 16

2. OOP APPROACH
Rectangle: 5x3
Area (OOP): 15
Perimeter (OOP): 16

3. COMPARISON
Both approaches give the same results.
Procedural: Data and functions are separate.
OOP: Data and methods are together in objects.

OOP vs Procedural practice complete!
🏆

You've Got It!

You now understand the differences between Object-Oriented and Procedural programming. You know when to use each approach and how to combine them effectively.

Quick Quiz

Test what you've learned:

1. What is the main focus of procedural programming?
2. What is the main focus of Object-Oriented programming?
3. In procedural programming, where are functions and data stored?
4. When is procedural programming a good choice?
5. What is a hybrid approach in programming?

Frequently Asked Questions

Is OOP better than procedural programming? ▼

Neither is "better" — they're different tools for different jobs. OOP is better for large, complex projects with real-world modeling. Procedural is better for simple scripts and linear data processing. Choose the approach that fits your problem.

Can I use both OOP and procedural in the same program? ▼

Yes! This is called a "hybrid" approach. Many Python programs use OOP for the main structure and procedural helper functions for specific tasks. It's a pragmatic way to get the best of both worlds.

Which approach should I learn first? ▼

Most programmers start with procedural programming because it's simpler and more straightforward. Once you understand functions and data flow, you can move on to OOP. Many Python learning paths follow this sequence.

What's a common interview question about OOP vs procedural? ▼

Common questions include: "What is the difference between procedural and object-oriented programming?" "When would you use one over the other?" and "Can you give examples of when to use each approach?"

Is Python a procedural or object-oriented language? ▼

Python is both! It's a multi-paradigm language that supports procedural, object-oriented, and functional programming styles. This flexibility is one of Python's strengths — you can use the approach that fits your problem best.

Can I write OOP code without using classes? ▼

No, OOP is defined by the use of classes and objects. If you're not using classes, you're writing procedural code (even if you're organizing it well). The class is the fundamental building block of OOP.

Where to Go From Here

Now that you understand the differences between OOP and procedural programming, check out these related topics:

Difference Between Classes and Objects

Deep dive into the differences between classes and objects.

Learn More →

Constructors

Learn more about constructors and their advanced usage.

Learn More →

Inheritance

Learn how to create class hierarchies with inheritance.

Learn More →
Interview Resources
  • Python Syntax & Variables Interview Questions
  • Top SQL Interview Questions & Answers
  • SQL Joins: Displaying Data from Multiple Tables FAQ
  • Python Lists and Dictionaries Interview Questions
  • Python OOP Interview Questions
  • SQL Set Operators Interview Questions
Previous: Creating Class and Object Next: Difference Between Classes and Objects →