Welcome to the World of Programming Languages!

Ever wondered why there are so many different programming languages? Why can’t we just use one for everything? In this guide, we are going to explore the different paradigms (styles) of programming and how computers actually understand the instructions we write. Don't worry if some of the terms sound a bit "techy" at first—we’ll break them down using simple analogies!

1. Programming Paradigms

A paradigm is simply a "way of thinking" or a style of programming. Different problems require different tools. For example, you wouldn't use a screwdriver to hammer in a nail, right?

Why do we need different paradigms?
Some languages are designed to be super fast, others are designed to be easy for humans to read, and some are built specifically for handling massive amounts of data.

Procedural Programming

This is one of the most common paradigms. It treats a program as a series of step-by-step instructions. You tell the computer exactly how to finish a task.

Key Characteristics:
• It uses sequences, selection (if-statements), and iteration (loops).
• It breaks down large tasks into smaller, manageable chunks called procedures or functions.
• Data and the code that handles that data are usually kept separate.

Analogy: Think of a recipe for baking a cake. You follow the steps in order: (1) Crack the eggs, (2) Mix the flour, (3) Bake. This is exactly how procedural code works!

Quick Review: Procedural Takeaway

Procedural programming is all about the logic and the order of instructions. It's the "to-do list" approach to coding.

2. Assembly Language & Little Man Computer (LMC)

Computers only truly understand Machine Code (1s and 0s). However, writing in binary is incredibly difficult for humans! Assembly Language is a "Low-Level" language that acts as a bridge. It uses short text codes called mnemonics to represent machine instructions.

The Little Man Computer (LMC)

To help you learn how Assembly works, OCR uses a model called the Little Man Computer. Imagine a tiny man inside a mailroom (the CPU) who moves numbered pieces of paper between mailboxes (RAM) and a calculator (the Accumulator).

Common LMC Mnemonics to Remember:
ADD: Add a value to the Accumulator.
SUB: Subtract a value from the Accumulator.
STA: Store the value in the Accumulator into a memory address.
LDA: Load a value from a memory address into the Accumulator.
INP: Take an input from the user.
OUT: Output the current value in the Accumulator.
HLT: Stop the program.

Did you know?
Assembly language is still used today for things like smartwatches or car engines because it allows programmers to control the hardware directly and make the code run incredibly fast!

3. Modes of Addressing Memory

In Assembly language, when we want to get data from memory, there are different ways to "address" or find that data. This can be tricky, so let's use the Post Office Box analogy.

1. Immediate Addressing:
The instruction contains the actual value you want to use. No need to look elsewhere!
Example: "Add 5". You just add 5.

2. Direct Addressing:
The instruction gives you a memory address. You go to that address and use the value found there.
Example: "Go to Mailbox 10, use the number inside."

3. Indirect Addressing:
The instruction gives you an address, but that address contains another address! You have to go to the first address to find out where the "real" data is stored.
Example: You open Mailbox 10, and it has a note saying "The actual data is in Mailbox 50."

4. Indexed Addressing:
You take a "base" address and add an "offset" (a number stored in an Index Register) to find the final location. This is perfect for looking through lists or arrays.
Formula: \(Final Address = Base Address + Index Register\).

Memory Aid: The "I-D-I-I" Trick

Immediate: It's right here.
Direct: Drive to the address.
Indirect: Inside is another address.
Indexed: Increment the base address.

4. Object-Oriented Programming (OOP)

OOP is a modern paradigm that focuses on Objects rather than actions. Instead of a long list of instructions, we create "objects" that represent things in the real world.

Key OOP Concepts:

Classes and Objects:
A Class is a blueprint (e.g., a drawing of a generic Car). An Object is the actual thing built from that blueprint (e.g., your neighbor's red Toyota).
Attributes: The data the object holds (e.g., color, top speed).
Methods: The things the object can do (e.g., drive(), honk()).

Encapsulation:
This means "hiding" the internal data of an object. You can only change the attributes using specific methods. It keeps the data safe from accidental changes elsewhere in the program.

Inheritance:
A "Child" class can take all the attributes and methods of a "Parent" class. For example, a "Truck" class can inherit from the "Vehicle" class but add its own features like "TowingCapacity".

Polymorphism:
This literally means "many forms." It allows a single method to behave differently depending on the object.
Example: A "makeSound()" method would make a Dog object "Bark" but make a Cat object "Meow".

Common Mistake to Avoid!

Students often confuse Classes and Objects. Just remember: You can't drive a "blueprint" of a car, you can only drive the "actual car." The Class is the plan; the Object is the result.

Summary Checklist

Before you move on, make sure you can answer these:
• Can you explain the difference between a Procedural and Object-Oriented approach?
• Do you know the 4 Addressing Modes and how they differ?
• Could you write a very simple 3-line LMC program to add two numbers?
• Do you understand how Inheritance helps programmers save time by reusing code?

Keep going! You're doing great. Programming paradigms are the foundation of how all your favorite software is built!