Skip to content

Intro to programming fundamentals

Posted on:February 12, 2022

In my journey to become a self-taught web developer, I have always wondered what I missed out on by not doing a CS degree? After some conversations with my fellow co-workers and other CS students, I realised what it was I missed out on. Language Agnostic programming fundamentals, what that means is to learn and understand the fundamentals of Computer Science(programming languages) out of the context of a specific language like JavaScript, C#, C++, Python etc.

Why learn like this? mistakes a lot of self-taught developers make is to learn a very specific set of skills, like HTML, CSS and JavaScript to solve a very specific set of problems like web development. While there is nothing wrong with this, it does pose some problems in the future. What if you need to switch your language? Will you be able to adapt quickly despite never having studied the new programming language? So to solve this it is very important to understand and learn these fundamentals.

So I am going to try my best to come up with a simple and quick overview of the programming fundamentals that you can refer to anytime.

What is programming

The technical definition of programming is a few instructions used to illustrate the basic output rules of a programming language. A programming language is a set of keywords, symbols, identifiers, and rules by which programmers can communicate instructions to the computer. They follow a set of rules called syntax. Each programming language follows specific syntax rules, although some share the same rules.

How do we write programs

So to give a computer a set of instructions we need to write it down somewhere, We can’t just use plain alphanumeric words either. So what we need is something called an IDE (Integrated Development Environment), an IDE gives us tools to write, debug, and convert code into machine code so the computer can understand it. Now each language has its own rules or syntax and if these rules are broken it will result in an error, similar to learning a spoken language like French or English, we need to follow the rules of the language for other people to understand us. There are some IDE’s that are built for specific languages, there are some that can be used with any language and offer built-in support or extensions to help you write code.


Variables are the building blocks of programs since every single program ever will use variables it is important to understand how they work. A simple explanation is to think of variables as a box, this box can hold anything you want it to hold, but it can’t mix different things each box must hold only one unique thing. But what if I have 20 boxes how will I know what is inside each box? What we can do is give each box a unique identifier (name) so we can refer back to that box.

So how does this look practically?

Well, let’s go ahead and create a new variable.

myName = 'Dylan'

So how does this look practically? Well, let’s go ahead and create a new variable. myName = ‘Dylan’ So as you can see we now have a new variable. The value of This variable is ‘Dylan’ but we can’t refer to this box i.e. variable by its value, so we gave it a name i.e. a unique identifier. So if someone says they want the value that’s inside the ‘myName’ box I can quickly find this box open it and see the value is ‘Dylan’.

So how does a computer do this? Well a computer has memory and this memory has spaces to store information, each space has a unique number predefined when the hardware was built. So when you declare a new variable the computer assigns this variable to a specific point in memory now it’s not efficient for us to memorise our computers memory locations so we assign it a name that we (humans) can refer to and the computer can use to know where to look for the value.

What type of information can variables store?

The first types we will learn about is primitive types, note that each programming language has its own unique primitive data types and some language share similar ones, here are common ones found in most languages:

Conditional Statements

Let’s say you want to write a program to do something only if a certain condition is met, how would you do that?

Well with conditional statements of course.

if myName equals 'Dylan' then doSomething()

The above example is a conditional statement, we want to doSomething but for that to happen variable myName must equal ‘Dylan’.

So what are the types on conditional statements and how do we use them ?

Conditional statements are useful to create the control flow in your application through the use of conditionals. Conditional statements can get quite complex so here I created a visual representation for you to get an idea about how and why I might use it.

programming work flow

In the above example, we created a function that checks if Variable A equals a certain colour and then handle it depending on whether it passes our checks. We can pass almost anything into the conditional weathers is a statement, a function or a comparison as long as it equates to true or false.


Think of arrays as a big rack to stack boxes, remember the box analogy for variables? An array can hold multiple or no boxes at a time and each box can contain a variable, but there are some rules to this rack.

  1. Each box can’t have a have a unique identifier.
  2. The rack has to be filled from top to bottom
  3. there are unlimited space on this rack (or as much as your computer’s memory allows it to have)

If each box has no name or identifier, how can we know what each box has or refer to a specific box? Well, it uses a number index so remember the rule you have to fill each array from top to bottom, that is because each space in this array has an index number to identify the spot of the box. So, for example, I can say get me box 25 and all we do is go straight to box twenty-five to retrieve its value.

Here is the catch, arrays start from an index of 0 not 1, so position 1 has an index of 0 and position 2 has an index of 1 and so forth. This is called zero-based indexing


So here we have an array of numbers from 1 to 8. How do we find number 5? we have to go to box 4.

myArray = [1,2,3,4,5,6,7,8];

How do we do that? we use Zero Based indexing.

//get number 5

Using this method we use brackets and pass a number to get the index of passed n value.

Types of arrays

Element identifier and addressing formulas

So in the above example, we access arrays using the zero-based indexing  although that is not the only way to access arrays:

Using zero based indexing is the design choice of many influential programming languages, including CJava and Lisp. This leads to simpler implementation where the subscript refers to an offset from the starting position of an array, so the first element has an offset of zero.


Loops are what the name implies, a task that gets repeated several times or until a condition is met.

For example:

Say I want to print the number 1 to 1000, now writing 1000 lines of code is inefficient, so we use a loop instead to save time.

Type of loops

Loops can serve many functions, besides just repeating tasks, loops are the main function we use to manipulate, create or do something with arrays

For Example:

Say I have a array of numbers like so:

myArray = [1,2,3]

Now I want to add 2 to each number, ok we can do this.

myArray[0] = myArray[0] + 2
myArray[1] = myArray[1] + 2

Now see the problem here? what if we have an array with the length of 10 000? Well this is where loops come in.

//lets loop over each item in the array and add 2 in pseudocode
	item = item + 2

In the above example, we use a for each loop to go over each item in the array and change that item to its current value + 2. Note the above example is very basic and each programming language will have its own method of handling loops with arrays.


So errors are a part of any programmers life and you can expect a lot of them once you start writing code. Now there is no need to be scared of errors and don’t worry the chance of you breaking stuff is very unlikely.

Types of errors


Functions are organized blocks of code that we can reuse in our program without having to rewrite the same thing over and over again. This is called modularity. Depending on the programming language, a function may be called a subroutine, a procedure, a routine, a method, or a subprogram. Using functions can allow you to be able to keep your code clean and organized, making it easy to read, and allowing the debugging process to be easier.

A function can manipulate an existing variable or value or create a new value and return that value.

Look at an example, Say we want to get the number of characters in someone’s name..

We can do something like this:

myName = 'dylan'

newArray = myName.split() //we assume split is a built in function to split a strings characters into and array.
//newArray = ['d','y','l','a','n]

//get the length of the array
charLength = newArray.length() //we assume .length() is a built in function to get the length of an array
//result = 5

Ok so this works but now image if I have to retype the above code 29 times, that’s inefficient and can cause debugging headaches. Instead let’s create a function.

function getStringLength(value)
	array = value.split()
	return array.length()

charLength = getStringLength('Dylan')
//result = 5

o in the above example, we create a reusable block of code using the function keyword, passed it a value, used that value to create an array to get the desired result. Then used the return keyword to give us back the length of the array. Now we can call this function whenever we feel like and wherever we feel like without having to rewrite the logic.

Side note: each programming language has its own rules for writing functions the above code is just an example and not language-specific.


Objects or **Object-oriented programming** (OOP) is probably the most powerful tool programmers have. Beginners can sometimes struggle to get their head around OOP concepts but once it clicks it can make you a very powerful programmer.

Objects can contain data and code, data in the form of key and value properties and code in the form of functions that sit within the object known as methods.

We won’t dive too deep into object methods but let’s get a good look at how the key and value properties work of objects.


myObject: {
	name: 'Dylan',
	surname: 'Britz',
	favourite_foods: ['meat','fish','vegetables']

So above we have a simple object, there are a few things I want you to note, the key properties: name, surname and favourite_foods and the corresponding values. So think of this object similar to the array rack analogy, except this rack has no shelves only a frame, to add something to this rack we need to add a shelf(key) with a unique name so we can refer to it later on and add a value that sits on the shelf. Now, these values can be any primitive data type, even a function(refer to as a method).


Thanks for taking the time to read, I hope this broad overview helped you getting a fundamental understanding of the building blocks of programming, and if you want to receive more articles like this make sure to subscribe.