C-SHARP - 2.1 What is programming?

Programming is, at its core, a sequence of instructions — or tasks — that we hand to a machine so it produces a specific result. In an earlier video we asked the computer to print something in the output window: we clicked Play, the code ran, and the result appeared. A machine executes the instructions it is given, but it does not reason on its own. Every detail has to be spelled out.

To make this concrete, think of a chocolate cake recipe. Preheat the oven to 180°C. Melt two bars of chocolate and 250 g of butter. Mix. Add three eggs and beat. If the oven has reached 180°C, put the batter in the oven. After baking, you get the cake. This sequence is called an algorithm: a series of steps that produce a result. The recipe is the code, the machine (here a Thermomix) executes it. If the code is correctly written, the machine produces the cake. If the recipe has errors, you get a flawed result — undercooked, too sweet, whatever.

The three phases of programming

  • Algorithm design: list the steps, the data, the conditions to obtain the expected result.
  • Coding: translate the algorithm into the chosen programming language — the famous lines of code.
  • Compilation: convert that code into machine language (binary, the only thing a CPU truly understands), then run it.

Look closer at the recipe and you spot programming concepts in disguise. Numerical values like 180°C and 250 g are variables. The "if the oven has reached 180°C" check is a condition. Across the next videos we will formalise all of these: variables, conditions, loops, functions, collections — with plenty of theory but mostly practice so that they become second nature. The next lesson kicks things off with variables.

Summary

Programming is a sequence of instructions given to a machine to accomplish a specific result. The lesson uses a chocolate cake recipe as an analogy to explain that machines execute instructions literally but cannot think independently—every step must be explicitly defined. Programming involves three main phases: algorithm design (defining instructions and conditions), code writing (translating the algorithm into a chosen language), and compilation (converting code to binary/machine language). Key programming concepts like variables, conditions, loops, functions, and collections will be explored in subsequent lessons.

Key points

  • Programming is a series of detailed instructions (an algorithm) given to a machine to produce a desired result.
  • Machines execute instructions exactly as written but lack independent thinking—developers must specify every step in meticulous detail.
  • An algorithm is a step-by-step process with conditions and tasks that guide the machine toward a final outcome (analogy: a recipe for chocolate cake).
  • Programming follows three steps: algorithm design, code writing in a chosen language, and compilation to binary/machine language.
  • Correct code execution depends on error-free instructions; mistakes result in failed execution or undesired outcomes.
  • Fundamental programming concepts include variables (numeric values), conditions (if statements), loops, functions, and collections.

FAQ

What is programming in simple terms?

Programming is providing a sequence of detailed instructions to a machine so it performs specific tasks. Like a recipe, you must specify every step clearly because machines cannot think independently—they only execute what you tell them.

Why is the chocolate cake recipe used as an example?

The recipe demonstrates an algorithm—a step-by-step process with conditions (like 'if the oven is at 180°') that produces a specific result, just like code executed by a computer.

What happens if there are errors in the code?

If the code contains mistakes, the machine will either fail to execute it properly or produce an incorrect result, just as a recipe with wrong instructions produces a substandard cake.