What is Programming?
Teaching Computers to Think
Open interactive version (quiz + challenge)Real-world analogy
Programming is like writing a recipe for a robot chef. The robot can cook anything, but it needs EXACT step-by-step instructions. If you write 'add some salt,' it panics! You must say 'add 1 teaspoon of salt.' Code is just very precise instructions for a computer.
What is it?
Programming is the art of writing instructions (code) that a computer can understand and execute. You write code in a programming language like Dart, and the computer follows your instructions exactly. Every app, game, and website you use was built by someone writing code.
Real-world relevance
Everything digital runs on code. When you open Instagram, play a mobile game, or ask Siri a question, code is running behind the scenes. Learning to program means you can CREATE these things, not just use them. It is one of the most valuable skills in the world.
Key points
- Code is Instructions — A program is a list of instructions that tells a computer exactly what to do, step by step. Computers are incredibly fast but incredibly dumb -- they can only follow instructions you give them. They cannot guess what you mean.
- Computers Think in Steps — A computer reads your code from top to bottom, one line at a time, like reading a book. It does exactly what each line says, then moves to the next. If line 1 says 'add 2 + 3' and line 2 says 'show the result,' it does them in order.
- Programming Languages — Humans speak English, Bengali, Spanish. Computers speak in binary (0s and 1s). Programming languages like Dart, Python, and JavaScript are the translator between human ideas and computer instructions. Each language has its own grammar (syntax).
- What is a Bug? — A bug is a mistake in your code. Maybe you spelled something wrong, or put the steps in the wrong order. The word 'bug' came from 1947 when a real moth got stuck in a computer! Debugging means finding and fixing these mistakes.
- Input, Process, Output — Every program follows the same pattern: take INPUT (data from user), PROCESS it (do something with it), and produce OUTPUT (show the result). A calculator takes numbers (input), adds them (process), and shows the answer (output).
- Why Learn Programming? — Programming lets you create apps, games, websites, and robots. It teaches you to think logically and solve problems. Every app on your phone -- Instagram, YouTube, games -- was built by programmers writing code just like you are about to learn!
- Algorithms - Step-by-Step Plans — An algorithm is just a step-by-step plan to solve a problem. You use algorithms every day! Making a sandwich is an algorithm: get bread, add filling, close bread. In programming, we write algorithms as code so the computer can follow them.
- Syntax - The Grammar of Code — Just like English has grammar rules (capital letters, periods), code has syntax rules. In Dart, every statement ends with a semicolon (;), strings go in quotes, and curly braces {} group code together. Break a syntax rule and the computer complains!
- Comments - Notes for Humans — Comments are notes you write for yourself and other programmers. The computer ignores them completely. In Dart, use // for a single line comment or /* */ for multiple lines. Good comments explain WHY you did something, not WHAT you did.
Code example
// Your very first Dart program!
// Every Dart app starts with a main() function
void main() {
// Step 1: Store some data
var myName = 'Flutter Learner';
var myAge = 10;
// Step 2: Process it
var greeting = 'Hello, I am ' + myName;
// Step 3: Output the result
print(greeting);
print('I am ' + myAge.toString() + ' years old');
print('I am learning to code!');
}Line-by-line walkthrough
- 1. A comment explaining this is your first Dart program
- 2. A comment explaining that every Dart app needs a main() function
- 3.
- 4. The main() function -- this is where your program starts running
- 5. Opening curly brace starts the function body
- 6. A comment for Step 1
- 7. Creating a variable called myName and storing the text 'Flutter Learner'
- 8. Creating a variable called myAge and storing the number 10
- 9.
- 10. A comment for Step 2
- 11. Creating a greeting by joining 'Hello, I am ' with the myName variable
- 12.
- 13. A comment for Step 3
- 14. Printing the greeting to the screen
- 15. Printing age -- we use .toString() to convert the number to text for joining
- 16. Printing an encouraging message
- 17. Closing curly brace ends the main function
Spot the bug
void main() {
var name = 'Dart'
print('Hello, ' + name)
}Need a hint?
Dart requires something at the end of every statement...
Show answer
Missing semicolons! Every statement in Dart must end with a semicolon (;). Fix: var name = 'Dart'; and print('Hello, ' + name);
Explain like I'm 5
Imagine you have a super-fast robot friend who can do anything, but it only understands very specific instructions. If you say 'make me food,' it just stares at you. But if you say 'open the fridge, take out bread, put peanut butter on it, close the bread,' it makes you a perfect sandwich! Programming is writing those exact instructions for your computer robot friend.
Fun fact
The first computer programmer in history was Ada Lovelace, a woman who wrote programs in the 1840s -- almost 100 years before modern computers existed! The Dart language was created by Google in 2011.
Hands-on challenge
Open any text editor and type: print('Hello, my name is [YOUR NAME]!'); -- replace [YOUR NAME] with your actual name. Congratulations, you just wrote your first line of code!
More resources
- Dart Language Tour (Dart Official)
- What is Programming? (Codecademy)
- DartPad - Try Dart Online (Dart Official)