Home/Blog/Learn to Code/Absolute beginner's guide to computers and programming

Absolute beginner's guide to computers and programming

Sep 11, 2020 - 16 min read
Ryan Thelin

Software is everywhere in our world and businesses. In almost every industry, software and computer programming are essential to daily life and business success. Becoming a software developer is a dream for many across the world.

Today, we’ll take an absolute beginner’s look at how a computer works and teach you how to think like a programmer. If you have no experience in programming or any coding language, you’re in the right place!

By the end of this article, you’ll have learned the parts of a computer and how programmers plan their programs. Then, we’ll point you in the right direction to continue your learning.

Anatomy of a Computer

Computers are capable of anything from performing just basic calculations to running complex, dynamic software. All of these different things are completed using the three major parts of the computer, the CPU, Memory, and Input/Output Devices.

You have probably interacted with each of these things without even knowing it!

It’s important to have an understanding of these parts so you can predict how your programs will interact with each.


Memory is where the computer stores data. Computers have two types of memory, Primary and Secondary.

Primary memory is the default memory in each computer and can be accessed quickly. The two most common primary memory devices are Read-Only Memory (ROM) and Random Access Memory (RAM).

ROM contains non editable data and programs used for basic operations, like instructions for how to turn the computer on. New data or programs cannot be saved to ROM. ROM memory is non-volatile, so it is maintained even after the computer is turned off.

RAM is used to store data currently in use. Keeping data in RAM speeds up performance because a computer can use primary memory over the slower secondary memory. If all RAM storage is being used, the computer will store extra programs in secondary storage as a backup. RAM is volatile, meaning it is wiped whenever the computer is turned off.

Secondary memory is what most people think of when imagining a computer’s memory. Hard Drives, hard disks, and flash drives are all examples of secondary memory. This type of memory is used for mass storage and is non-volatile. Secondary memory refers to storage devices or removable storage media. Secondary memory is not accessed directly by the CPU. It is first loaded into RAM and then sent to a processor.

svg viewer
Relative Speed of Each Memory Type

Central Processing Unit (CPU)

The Central Processing Unit (CPU) is the brain of the computer that processes and executes instructions. It has three parts: Control Unit, Arithmetic Logic Unit, and Registers.

The Control Unit retrieves instructions from the RAM and determines what parts of the CPU should execute them. This is the manager of the CPU because it sees the whole instruction set and sends the instructions that each part should run.

The Arithmetic Logic Unit (ALU) performs all instructions that contain either a mathematical or logical operation. Addition is a common example of a mathematical operation. Logical operations are used to evaluate or compare data.

Registers are small volatile memory locations within the CPU like rax, rbx, or rcx. The CPU can access registers quicker than primary or secondary memory. Data is temporarily stored in registers while running a program to speed up performance. Registers are much smaller than RAM storage, so only a small amount of data can be stored here at a given time.

I/O Devices

Input/Output Devices are any device that allows the computer to interact with the outside world. This includes input devices that allow the user to control the computer, like keyboards and mice. Output devices allow the computer to display feedback to the user, like monitors and printers.

If you are reading this on a phone, laptop, or desktop, you are interacting with an I/O Device.

Hardware vs. Software

Hardware refers to tangible components of a computer that are physically connected to it. Software refers to digital components like operating systems or applications.

What is a program?

While computers are capable of amazing computations, they cannot act on their own. To use any device or computer, programmers have to write sets of instructions called programs. A program can contain just one instruction or dozens.

Think of this as a collection of instructions that perform particular tasks.

The computer reads these programs and completes each instruction in order. It’s important to remember that computers are only capable of literal interpretation and cannot think between the lines.

If a program does not behave how you expect it to, it’s likely that the computer did exactly what it was told, but the instructions were incorrect or incomplete.

Program vs. Algorithm

An algorithm is a self-contained set of operations that will solve a specific problem or a collection of problems. A computer program, on the other hand, is a sequence of instructions that we write to perform a task with a computer.

For example, imagine you are making a program to compare circles. You could use an algorithm to calculate the information for each circle like area or perimeter and only write fresh code for the comparisons of those values.

Why do we need programming languages?

The memory, CPU, and I/O Devices all process data and instructions using machine code called binary. Binary is a long string collection of 1s and 0s in a particular order. While easy to understand for computers, binary strings cannot be understood by humans.

Programming languages bridge this gap and provide a medium between human languages and binary code that is essential for writing programs. These easy to read programming languages are called high-level languages.

Programmers first write their programs in a high-level programming language, like Java, Python, or C++. The computer then takes this code and sends it to either an interpreter or compiler.

This will convert it into binary instructions. These binary instructions are then passed to the CPU to be executed.

svg viewer
Program Transformation

High-level programming languages allow programmers to communicate complex instructions to the CPU without having to write directly in machine code.

How to think like a programmer

Writing in a programming language requires a unique style of problem-solving that can be difficult for beginners to pick up because computers think so differently from a human.

Computers complete one instruction at a time. As a result, problem-solving in programming requires you to focus on breaking larger problems into incremental steps. You can then translate these steps into code instructions in your program.

This often takes time to learn. In real-life situations it’s natural to overlook the incremental steps of a problem. For example, you would probably consider the task “go to the store” as one or two steps.

However, if you were coding that behavior for a computer, you’d have to include directions in the program for every incremental step, such as “unlock the door”, “open the door”, “exit”, and so on.

It’s easy for even senior developers to overlook incremental steps when planning a program because of how differently we think in every-day life.

So, how do developers plan their programs? Next, we’ll look at two methods all levels of programmers use to plan their programming solutions.

Golden Rule: DRY

The golden rule of all programmers is “Don’t Repeat Yourself”. This means that you should try to minimize the amount of code or behavior you repeat in your programs.

Many practices in programming aim to help programmers do this, like Decision and Repetition covered below.


Pseudocode is a type of program description that outlines a program’s steps in simple, non-code terms. It’s called pseudocode because it looks similar to code but isn’t quite the same. Each line in pseudocode denotes a step, and it can be written using a mix of words and symbols.

This is often used by programmers as a prewriting step to visualize the entirety of the program before they begin coding. It’s also great for beginners because it allows you to practice breaking down problems into steps without getting bogged down by syntax.

Pseudocode planning allows you to:

  • See what step must precede and follow each step
  • Verify that the problem will be solved by the end of your steps
  • Share your plan with other programmers regardless of what language they know
  • Plan steps that you need but don’t currently know how to input in code


Syntax in programming is a set of rules and available commands unique to a programming language. If a programming language is like a standard language, then syntax is a combination of that language’s grammar and vocabulary.

How to Write Pseudocode

Each programmer’s style of pseudocode is unique. Some programmers like to write in partial code, including any syntax that they know off the top of their heads. Others prefer to keep it completely code-free and simply describe steps in plain language.

No matter how you write pseudocode, here are some best practices to keep in mind:

  1. Only include one action or step per line
  2. Write all steps in the order they should be completed
  3. Include all steps required to solve the problem

Let’s revisit our program for comparing circles and write pseudocode to find the circumference of each circle:

   Circle1 radius = 5
   Circle2 radius = 10

Calculate circumference of Circle1
Calculate circumference of Circle2

Output: Circumference Circle1 and Circle2

Above, we first input two circles with different radii in lines 2 and 3. Since our problem asks for circumference, we then have to find the circumference of each circle in lines 5 and 6. Right now, we’ve just included the plain-language “find circumference”; however, we could have included the circumference formula there.

Now, we can check if our pseudocode meets all requirements before moving on:

  1. Yes, it includes each step only includes one action
  2. Yes, all steps are in the correct order
  3. Yes, the problem is solved and there are no overlooked steps

Our “fake” program is ready to code!


Flowcharts are another planning tool used by programmers of all levels. Programmers use flowcharts to represent a program in a visual way. Like pseudocode, flowcharts walk through a program’s steps and show how each connects.

Flowcharts are effective for presenting program functions to others, understanding the path different inputs will take through the code, and finding errors.

Below is a guide to the shapes programmers use to represent different types of steps:

svg viewer

Now, let’s look at how we can use these shapes to represent the pseudocode program from the previous section:

svg viewer
Example Flowchart for Circumference Program

Decisions: How to add reactivity

Now we’ll move onto one of the more advanced behaviors in programs: decisions.

Up until now, we’ve talked about programs that always follow the same steps, regardless of circumstances. For example, our circle circumference program always performs the same steps even if we change the input.

But what if we input a square? Now our program has to decide if the shape is a circle or not.

Static programs are good as examples, but reactive programs often have to decide what step to take based on the circumstances.

This decision making is achieved through conditional statements like if, while, and else that check for a certain condition. We use these statements in almost all programming languages. They are the backbone of reactive programs.

Conditional statements, like if, allow programmers to create a single reactive program that completes different steps based on the circumstances.

For example in pseudocode, “if the shape is NOT a circle, do not calculate circumference”. Conditional statements are key to clean, compact, and useful coding solutions.

Beginner Tip

To help spot branching points, try explaining your program out loud. Then, write down every point where you hear yourself say “if” or “while”.

If statements

The most common conditional statement is the if statement. This statement first checks for a specified condition. If the condition is true, the instructions within the statement are completed. If the statement is not true, then the instructions within the statement are skipped.

We use if statements often in everyday life. For example, I might make the decision that if it’s sunny outside, I will go outside. The condition I’m checking for is if the weather is “sunny”.

If this condition is true, I complete the step “go outside”. If the condition is not true, I take no action and remain inside.

Below, you’ll see how we can use conditional statements to complete the pseudocode and flowcharts we began above.

   Circle1 radius = 5
   Circle2 radius = 10

Calculate circumference of Circle1
Calculate circumference of Circle2

if: circumference of Circle1 > circumference of Circle2
   Output: Circle1

if: circumference of Circle2 > circumference of Circle1
   Output: Circle2

Above, we’ve added lines 8-12 to decide which circle name to output. On line 8, the program will check if Circle1 has a greater circumference than Circle2. If yes, the program runs the Output: Circle1 instruction within.

If not, the program moves to the next if statement on line 11 that checks if Circle2 has a greater circumference than Circle1. If yes, the program outputs the name of Circle2 with the instruction on line 12.

Here is that same program represented in a flowchart:

svg viewer
Circumference Program with Decisions

Repetition: How to simplifying programs

Another common advanced behavior in programming is repetition. Many programs have to repeat the same step on different objects. To do this, it’s quicker and simpler to write the behavior once and set the program to run it multiple times rather than to write copies of the behavior.

Programmers achieve this using loops. Each loop has an end condition and a set of instructions.

The loop first checks to see if the end condition is met. If it is not, the program runs the set of instructions. The loop then checks the condition again to see if it has to run through another iteration. Once the end condition is reached, the loop exits and moves on to the code below the loop.

svg viewer
Stages of a Loop

Programmers use loops to reduce repeated code. They also reorient the code to be goal focused, like changing a condition, rather than focusing on how we get there. Advanced programmers are always looking for instances of repeat code that they can simplify with loops.

Beginner Tip

An easy way to find looping sections in your program is to describe the process aloud and listen for the word “until”. Any “until” phrase can be reorganized to be a while loop and can then be implemented in code.

Example: “Until all steps are complete” → “While any steps remain incomplete”

While loops

The most common loop is the while loop. The end condition in a while loop is the point when the listed condition becomes untrue.

Scalability is the main advantage of using while loops. This refers to how easily your code can be adapted to handle more input. Other loops require the programmer to set the number of iterations.

If more iterations are needed for a certain data set, the programmer must manually change how many iterations are completed. The while loop solves this by running until a condition is met, rather than a specific number of iterations.

For example, to create a while loop for cleaning, my condition would be “while: kitchen is dirty”. If that condition is true, my loop would run the instruction “clean part of the kitchen”. The condition will become false once the kitchen is fully clean, and the loop will be finished.

Let’s revisit our pseudocode example above and add a loop to simplify it:

   Circle1 radius = 5
   Circle2 radius = 10

While: any circumference is unknown
    Calculate circumference of next circle

if: circumference of Circle1 > circumference of Circle2
   Output: Circle1

if: circumference of Circle2 > circumference of Circle1
   Output: Circle2

Above, we’ve refined the two calculations of circumference to instead be a while loop on line 5. The goal of that section is to calculate the circumference of each circle until all circumferences have been found. If we reverse this logic, we can then say that we want to continue calculating the circumference of each circle “while any circumference is unknown”.

The program will first check if any circumference is unknown on line 5. If that is true, and there is at least one unknown circumference, the program will enter the loop. The program then runs the instruction within the loop on line 6 to find the circumference of the next circle, Circle1.

The loop will then check the condition again and find there is still an unknown circumference. The program then enters the loop again and calculates the circumference of Circle2.

On the third check, the program no longer has any unknown circumferences. The program then bypasses the loop and proceeds to our conditional statements below.

Here is the same program but represented with a flowchart instead of pseudocode:

svg viewer
Circumference Program with Decisions and Repetition

Notice: Scalability

Our solution here is scalable, meaning that it can solve our problem regardless of how many circles are input at the beginning. Scalability is a best practice in programming, as it allows your program to be used in multiple situations without being altered.

What to learn next

You’ve just taken your first steps into the exciting world of programming! The knowledge you’ve just gained about computers and programming will be invaluable as you continue your journey.

From here, you can take a deeper look into the topics covered today, like:

  • Syntax and semantics
  • Variables
  • Advanced computer concepts
  • Full program lifecycle
  • Solving popular programming problems

If you’re ready to dive into an online course, Educative’s courses for absolute beginners are the ideal place to start. Available in six programming languages, these courses will help you understand the logic of programming and begin writing code. Start your journey today!

Happy learning!

Continue reading about programming fundamentals


Join a community of 1.7 million readers. Enjoy a FREE, weekly newsletter rounding up Educative's most popular learning resources, coding tips, and career advice.