No history yet

Introduction to Programming

What Is Programming?

At its heart, programming is simply the act of giving instructions to a computer. Think about how you'd tell a friend to make a peanut butter and jelly sandwich. You'd break it down into small, specific steps: get two slices of bread, open the peanut butter jar, spread it on one slice, and so on.

A computer needs the same kind of detailed guidance. The big difference is that a computer can't guess what you mean. It follows your instructions exactly, whether they're right or wrong. Programming is how we write those instructions in a way a computer can understand and execute.

Programming is the process of creating a set of instructions that tell a computer how to perform a task.

Programming Languages

We can't write instructions for a computer in English or any other human language. We need a special language that's designed to be precise and unambiguous. These are called programming languages.

Just like human languages, each programming language has its own vocabulary (keywords) and grammar (syntax). Some popular languages include Python, known for its readability, JavaScript, which powers most of the interactive web, and C++, a powerful language used for game development and high-performance applications. The core ideas behind them are all very similar.

No matter which language you use, the goal is the same: to translate a human idea into a logical sequence of steps that a computer can follow.

From Code to Action

So how do you actually get a computer to run your instructions? The process generally involves three steps:

  1. Writing: You type your instructions, or source code, into a text file. This is often done using a special program called an Integrated Development Environment (IDE), which provides helpful tools for programmers.
  2. Translating: The source code is translated into machine code, a low-level language of 1s and 0s that the computer's processor can directly understand. This is done by a program called a compiler (which translates everything at once) or an interpreter (which translates line by line).
  3. Running: The computer executes the machine code, and your program runs!

A classic first program for any new programmer is called "Hello, World!" Its only job is to display the text "Hello, World!" on the screen. In the Python programming language, it's just one simple line.

print("Hello, World!")

When the computer runs this code, it knows the print command means "show something on the screen." It then displays whatever is inside the parentheses and quotation marks.

Lesson image

It might not seem like much, but this simple program demonstrates the fundamental cycle of programming: writing instructions and having the computer execute them. Every complex application, from your web browser to your favorite video game, is built from these same basic building blocks.

Now, let's check your understanding of these core ideas.

Quiz Questions 1/5

What is the primary purpose of a programming language?

Quiz Questions 2/5

The process of translating source code into machine code all at once before the program is run is handled by a(n) __________.

That's the big picture of programming. It's a way to communicate with computers to solve problems and create new things.