(First published in 2013. Modifications done later)
๐ก Introduction to Computer Programming
Unlocking the Power Behind the Screen
What’s the most fascinating thing about computers?
No, not just gaming. Not streaming music either. Browsing the internet? That’s exciting—but there’s something even more empowering: programming.
Programming is where the real magic happens. When you learn to program, you’re not just using a computer—you’re commanding it. You can build your own games instead of just playing them. Design a custom music player. Even create a full-fledged e-commerce platform like Bikroy.com.
Have a Facebook account? With programming skills, you can develop your own Facebook applications and share them with friends. Ever dreamed of building apps for Android phones? Programming is your gateway.
These are just a few examples. In reality, the possibilities are nearly endless. What you can do with a computer is limited only by your imagination—and your programming skills.
๐ง The Limits and Challenges of Programming
Of course, not everything is straightforward. Some tasks require connecting external devices to the computer. Others are so complex that solving them efficiently becomes a challenge. In computer science, we call this computational complexity—some problems take so much time and resources that we must find alternative approaches or approximations.
But even with these challenges, programming remains incredibly rewarding.
⚡ The Joy of Instant Feedback
One of the most exciting aspects of programming is instant feedback. You write a program, run it, and immediately see the results. Unlike building electronic circuits—which can take hours or days to test—programming lets you experiment, learn, and iterate in real time. It’s fast, interactive, and deeply satisfying.
๐ฃ️ How Does Programming Work?
Great question!
Think of programming like giving instructions to a helper. If you want someone to complete a task, you explain what to do—and they follow your instructions. Programming works the same way. You want the computer to perform a task, so you write a set of instructions for it to follow.
These instructions are called a program—a sequence of steps designed to accomplish a specific goal.
๐ But Wait—Do Computers Understand Human Language?
Unfortunately, no. Computers don’t understand Bengali, English, or any natural language. If they did, we could just speak to them and get things done instantly!
Instead, computers understand formal languages—structured systems that follow strict rules. These languages aren’t quite like human languages, but they’re close enough for us to learn. In computer science, we call these context-free languages—they’re designed to be precise, logical, and unambiguous.
๐งฎ A Simple Example: The Calculator
Think about how you use a calculator. You input numbers and choose an operation—like addition or multiplication. The calculator processes your input and gives you the result.
Now imagine if you could create your own operations. One to calculate the average of a list of numbers. Another to generate a series of prime numbers. The possibilities are endless!
In programming, that’s exactly what you do. You create operators—custom instructions that process data. The user provides input, selects the operator, and receives the output.
๐ง Understanding Computer Programming Through Abstraction
How Instructions, Abstractions, and Languages Make Programming Powerful and Practical
Let’s take a simple example. Microsoft created Microsoft Word so we can write documents. We input characters, apply formatting options like bold or italic, and Word instantly shows the results on the screen. Behind the scenes, Word is following a set of instructions—written by programmers—to perform these tasks.
So what exactly is programming?
At its core, programming means giving instructions to a computer in a language it understands. These instructions tell the computer what to do, step by step.
๐งฎ What Do These Instructions Look Like?
Let’s think practically. Suppose you want to calculate the average of a few numbers. What would the instructions be?
Just like a flowchart breaks down a process into steps, a computer needs instructions written in its own language. But does that mean you have to write a huge program even for a simple task?
Not necessarily.
๐งฉ The Power of Abstraction
Computer scientists have developed ways to make programming easier and more efficient. One of the most powerful tools is abstraction.
Let’s say you’re giving someone directions to travel from Dhaka to Chattogram. If you had to describe every single movement—“lift your right foot, then your left foot, walk ten steps, turn right…”—you’d end up giving millions of instructions.
Instead, you simplify the process by breaking it into named tasks:
- “Take a rickshaw to the bus stand.”
- “Take the bus to Chattogram.”
- “Take a rickshaw to your home.”
Each of these tasks is an abstraction—a named set of detailed instructions. You don’t need to explain the inner workings every time. You just refer to the task by name.
๐ง Abstraction in Programming
Programming works the same way. Instead of writing out every step to calculate an average, you can use or create an abstraction called "average"
. You send a list of numbers to this abstraction, and it returns the result.
This makes your program shorter, cleaner, and easier to understand.
Abstraction isn’t limited to tasks—it also applies to how data is organized, how operations are performed, and how systems interact. It’s one of the key reasons modern programming is so powerful.
๐ป Writing Instructions as Programs
Now that we understand instructions and abstraction, how do we actually write a program?
We use programming languages—structured systems that follow specific rules. There are many languages: Python, JavaScript, C++, and more. As you grow as a programmer, you might even create your own language!
How is that possible?
Just like a calculator performs addition and subtraction using electronic circuits, a computer can perform complex tasks using its hardware. When you write a program in a high-level language, a compiler or interpreter translates it into machine language—a form the computer’s electronic components can understand and execute.
⚙️ From Code to Execution
Here’s the process:
- You write a program using a programming language.
- The compiler/interpreter converts it into machine instructions.
- The computer’s hardware follows those instructions to perform the task.
This is how your ideas—written as code—become real actions on a computer.
๐ง How Programming Languages Work: From Sentences to Structure
Understanding Compilers, Interpreters, and the Grammar of Code
If you ever dream of creating your own programming language, you’ll need to build something that can understand and execute the instructions written in that language. That “something” is called a compiler or an interpreter.
Think of it like a real-world interpreter. Imagine you’re in China and you only speak Bengali. You need someone who can translate your Bengali into Mandarin so others can understand you. Similarly, a compiler or interpreter translates your custom programming language into something the computer’s hardware can understand.
๐งพ What Is a Programming Language?
A programming language is a system of rules for writing instructions. These instructions tell the computer what to do, how to do it, and when to do it.
Every programming language defines:
- How to write individual instructions (syntax)
- How to organize instructions so they execute in order (structure)
- How to create abstractions to simplify complex tasks
Let’s break these down.
✍️ Writing Instructions: Programming as Grammar
Think of each instruction like a sentence in a language. Just as natural languages have grammar, programming languages have syntax.
Let’s define a simple grammar:
Sentence → Noun Phrase + Verb Phrase
Noun Phrase → Noun
Noun → Tahsin | Nishat
Verb Phrase → Adjective + Verb Phrase | Verb
Adjective → Dashpa | Samana
Verb → Aegubae
Using this grammar, we can construct a sentence like:
Tahsin Dashpa Samana Aegubae
Here’s how it breaks down:
Tahsin
is the Noun
Dashpa Samana
are Adjectives
Aegubae
is the Verb
This is how programming languages work: they define rules for how valid “sentences” (instructions) are formed. The compiler or interpreter then:
- Parses the sentence to understand its structure.
- Translates it into machine-level instructions the computer can execute.
Just like a human interpreter, it figures out what you meant and conveys it in a language the computer understands.
๐งญ Structuring Instructions: The Flow of Logic
Once we know how to write individual instructions, the next step is to organize them so they execute in the correct order.
In Structured Programming, instructions are arranged using three fundamental patterns:
1. ๐งฑ Sequential Execution
Instructions are executed one after another:
Do Task A
Then do Task B
Then Task C
2. ๐ Branching (Decision-Making)
Instructions change based on conditions:
If A happens, do B
Else if C happens, do D
3. ๐ Looping (Repetition)
Instructions repeat while a condition holds:
While A is true, do B
These three patterns—Sequence, Branching, and Looping—form the backbone of structured programming. They allow us to build logic that responds to different situations and repeats tasks efficiently.
๐งฉ Abstraction: Simplifying Complexity
Programming languages also support abstraction, which helps simplify complex operations by hiding details behind named tasks.
There are different types of abstraction:
- Functional Abstraction: Grouping instructions into named tasks (like functions or procedures)
- Data Abstraction: Organizing and hiding the complexity of data structures
- Control Abstraction: Structures like loops and conditionals that manage flow
For example, a loop is a control abstraction—it lets you repeat a task without writing the same instruction over and over.
Abstraction is what makes programming scalable. Instead of writing millions of low-level instructions, you define high-level tasks and reuse them.
๐ Ready to Code?
So now you know:
- How programming languages are structured
- How compilers and interpreters translate your code
- How instructions are written, organized, and abstracted
What are you waiting for?
Start writing your own programs. Build your own game. Create your own language. The tools are in your hands—and the possibilities are endless.