George Boole

What are Propositions, Compound Propositions, and Boolean Logic?

George Boole

“It is not of the essence of Mathematics to be conversant with the ideas of number and quantity.” — George Boole, 1854

A Brief History of Boolean Logic

George Boole was best known for his work on Boolean algebra — a branch of the subject that defines variables with true or false values, denoted usually with 1 or 0.

His work was pre-dated primarily by Gottfried Willhelm Leibniz’s algebra of concepts, where Leibniz enunciated the concepts we now call conjunction, disjunction, negation, identity, set inclusion, and the empty set.

Much of Leibniz’s concepts were not published in his lifetime, however, it is argued that his work may have had an influence on Boole and modern logicians.

For a more thorough account of the influence of Leibniz on Boole, please see this article published on the Stanford University website.

Boole was one of the first to point out an analogy between algebraic symbols and those that can represent logical forms and syllogisms (logical inferences drawn from two propositions presumed to be true).

“Boole’s original and remarkable general symbolic method of logical inference, fully stated in Laws of Thought (1854), enables one, given any propositions involving any number of terms, to draw conclusions that are logically contained in the premises.”(1) — Britannica

What is a proposition?

A proposition is simply a statement, whereas propositional logic studies these statements and how they can interact with each other.

Propositional logic does not care about the content of the statements, only if they be inferred to have some true or false value.

In computing, we are dealing with systems that process data in binary states. Either the processor has a charge or it does not have a charge, denoted with binary values.

We could simplistically compare computer processing to the state of a cup being full or empty. It is one or the other, but never anything in between. Likewise, with propositional logic — we can denote a statement as being true or false. It is one or the other, and nothing in-between.

There is no gray area.

This is how we must first perceive propositions before interpreting them for any form of true or false logic. It is not adequate or helpful for you to consider propositional logic from the standpoint that there can be multiple answers to a ‘true’ or ‘false’ statement.

Examples of Propositions

The following are several examples of propositions, each on their own line, with an explanation beneath each:

The temperature is above 22 Celsius.

This is a proposition because the statement is either true or false. It is either above 22 celsius (true) or it is below (false). This is not a question asking for more information or instruction, it is a statement of validity — true or false.

Paris is the capital of France.

Again this is a proposition because Paris is either the capital of France or it is not. It holds either a true or false value. In this case, the proposition evaluates to be true. However, if it said “Berlin is the capital of France” it would evaluate as false.

New York City is the Capital of New York State.

This is another proposition in which it can evaluate as either true or false, but nothing in-between. Albany is the capital of New York State, so in this case — this proposition evaluates to false.

My name is Adam.

This is another proposition and of course, depends on who wrote or said the proposition. It is either true or false — the person’s name is either Adam or it isn’t.

1 + 1 = 2

This is a proposition that 1 + 1 = 2. It either holds the value true or false based on the statement itself. We know the answer is 2, so it evaluates to true.

2 + 2 = 5

This is another proposition that has either a true or false value. 2 + 2 does not equal 5, so it evaluates to false.

What is not a proposition?

These could be summarised as statements that are either questions or commands/orders/instructions.


Is it raining?
This is a question rather than a proposition and does not hold a true or false value, it is asking for more information. If the statement was “It is raining” rather than “Is it raining” — it would be a proposition with a true or false value. In this case, it is not.

Is x = 5?
Again, this is a question rather than a proposition — it does not hold a true or false value. If the statement was “x = 5” we could then evaluate it as either true or false, but in this case, it is phrased as a question and therefore does not have a true or false value.


Get back
This is a command, order, or instruction which holds no true or false value.

Get me a glass of water
Another command, order, or instruction with no true or false value.

If the temperature is above 22 celsius, then turn off the heating
This is an instruction that cannot be evaluated as either true or false, however, if you extracted “the temperature is above 22 celsius” from it — that could be interpreted as a proposition holding a true or false value.

Form of Propositions

We can write a proposition and denote it as a letter in the alphabet, these are known as Boolean variables.

Convention has it that we pair propositions starting with the letter ‘P’ followed by ‘=’ and then the proposition itself.

We can define propositions as p,q,r,s, and so on.

We can say: P = ‘I am in my room’

We can also say that ‘Q’ is another proposition and use boolean operators to determine if the statements evaluate to true or false.

We can say: Q = ‘The light is on’

What is a Compound Proposition?

Propositions that are represented by single boolean values on their own are called atomic propositions.

p = ‘I am in my room’
q = ‘I am awake’

We can use these atomic propositions to create more sophisticated propositions. For example, we can create a proposition that is true only if p = true and q = true.

In shorthand, as above, we can write p = t (for true) and q = t (for true). Likewise, for false values, we can use the letter f.

compound proposition is one where there is more than one proposition and we use boolean operators to determine the true or false value of the entire statement.

Boolean Operators

These are symbols that denote how the propositions should be interpreted to evaluate the entire statement to a true or false value. AND, OR and NOT are the most basic and common of these operators.

AND ^ (Conjunction)

In an AND statement, both propositions must evaluate to be true for the statement to evaluate to true. We replace the word and with ^.

Take the following example, noting that T = True, and F = False:

And Truth Table

The third column p ^ q evaluates the statement in its entirety. Only in the case that “I am in my room” AND “I am awake” is true, does the statement evaluate to true.

In all other cases, the statements evaluate as false.

Why is this? Think of the two propositions using the English language, replacing ^ with AND, considering that the full statement can only be true if you are both in your room and awake.

“I am in my room AND I am awake” can only be true if both statements are true.

OR ∨ (Disjunction)

In an OR statement, one or more of the conditions has to be true for the whole statement to evaluate to be true.

Consider that if we were to use the same statement but with p or q, as above, we would write out our truth table as follows:

Note that if both conditions are true, the whole statements evaluate to be true.

It only matters in this case that one or more of the propositions is true for the whole statement to evaluate to be true.


Where we state that a proposition is NOT or ¬ we are simply stating that it is the reverse value to the one it already holds.

If we said that ‘p = I am in my room’ is NOT true, we flip the value to its alternative which is that the value is now false.

Exclusive OR ⊕

When we compare two propositions with an exclusive or  operator we are stating that either statement has to be true for it to evaluate to true, but not both.

We are simply stating that either statement has to be true but not both of them. It is exclusively p OR q is true, but not both of them can hold a true value for the whole statement to evaluate to true.

Memorize the above simply by recalling that either statement has to be true, but both of them cannot be.

Conditional →

This is perhaps one of the more tricky boolean operators, given that it doesn’t translate as simply into the English language as the above operators we have already discussed.

It translates as closely into English as “if P (is true) → (then) Q (is true)”.

Consider that it does not matter what the contents of these propositions are, only that they either hold a true or false value and we do the correct evaluation using the boolean operator in question.

If I am in my room, then I am awake can be evaluated as follows:


To memorize this truth table, simply recall that all statements evaluate to true except in the case that P = T, and Q = F.

If the first statement is true (P = T) then the second statement must also be true (Q = T) for it to evaluate to be true.

However, this condition is true by implication.

P being true implies Q is true — this is a one-way relationship. Q does not imply P is true.

You should focus on the second condition and work backwards. If Q is true, then it does not matter what P is, as the statement is one way and can be evaluated as true in this manner.

Where both P = F, and Q = F there is not enough evidence to deduce if P → Q so we simply evaluate to true in this instance, as there is a possibility it could be true.

Watch the above video for a thorough explanation of the P → Q conditional.


The biconditional can be interpreted as “if and only if”.

It is understood as meaning that both p and q must be true or both p and q must be false for the statement to evaluate to be true.


All other conditions evaluate as false.

Again, as with the conditional operator — in the biconditional, where both statements are false, we don’t have enough evidence to evaluate as false, so that circumstance evaluates to true.


In tautology, all statements evaluate to true — it is the equivalent of writing the following:

P ∨ ~P

For example, where P is true or P is not true, the statement will always evaluate as true.


This is the opposite of tautology, where all statements evaluate as false as opposed to true.

Summary Truth Tables for All the Boolean Operators

You should memorize the truth tables for all the Boolean operators, however, it is just as important to understand why they evaluate their given values.

I hope you have found this article useful in understanding propositions, compound propositions, and boolean logic in general. It is important you understand these concepts for a variety of domains, not exclusively Computing or programming.

In the next article, I will be writing on the topic of complex compound propositions, the boolean operators order of precedence, and how to evaluate such statements by writing truth tables yourself.

Hexadecimal to Binary

How to convert Octal and Hexadecimal to Binary?

Hexadecimal to Binary

Octal to Binary, Hexadecimal to Binary and Binary to Octal and Hexadeimal

In a previous article, I wrote on the subject of converting binary to decimal and decimal to binary, covering initially what place value and the number bases refer to, giving you a solid base to understand how to compute these conversions.

If you do not yet understand those number bases (Base 2 and Base 10), please refer back to that article first.

In this article, I will be covering the Octal (Base 8) and Hexadecimal (Base 16) number systems.

I will discuss what the Octal and Hexadecimal Bases are and then move on to how to convert both of them to Binary and then discuss in each case, how to convert Binary to Octal and Binary to Hexadecimal.

What is the Octal Base System (Base 8)?

Instead of counting with 10 digits (as in Base 10) or two digits (as in Base 2), in the Octal system we use 8 digits. Again the subscript is used to denote the number bases used, in this case, we use subscript 8.

The first 8 digits (0 to 7) in Octal are the same in decimal, so we can easily memorize the conversions from octal to decimal to binary, as below:

How do we convert Octal to Binary?

We know how to convert single-digit numbers from Octal to Binary, simply refer to the above and consider that 0–7 are the same in Octal as they are in Decimal, then convert from Decimal to Binary.

What if the Octal number has more than one digit?

Simply split the digits from right to left into octal to binary conversions, writing the answer right to left.

Each digit, in this example going right to left, 0 then 7 should correspond to 3 binary digits each.

0₈ = 000
7₈ = 111

Combine these two groups of three binary digits as below to produce your final binary representation:

Refer to the following table and memorize it:

Octal to Binary Conversions

Recall that binary numbers from right to left increase in place value.

Special Rule: If the group of three binary digits farthest to the left you end up with after the conversion have leading 0s e.g. 001 001 — simply omit them.

So, if you end up with 001 001₂

This should be written as 1 001₂

One more example — 321₈ in binary

Start from right to left and write 1 in Octal (which is the same in Decimal) with three digits in binary.

1₈ = 001₂

Then move on to 2, the next digit going right to left.

2₈ = 010₂

Finally, move on to 3 and write that, omitting any leading 0s.

3₈ = 11₂ (note that we do not write a 0 in the 4’s place)

Your final binary representation of 321₈ is the above three steps combined from right to left:

321₈ = 11 010 001₂

How to convert a Binary number to an Octal number?

Let’s start with an example and a short explanation of how to convert a binary number into an Octal number. We will use the following binary number as an example:


Starting from right to left and splitting the digits into groups of three, I will use a dash to separate them for ease of viewing:


Note the last group of binary digits farthest to the left is not a group of three digits, because the leading 0 has been omitted. Simply add it again, now you should have something like this:


Now simply convert from right to left, those three-digit binary groups into Octal (which is the same as converting 3 digit binary numbers into decimal).

111₂ = 7₈
110₂ = 6₈
101₂ = 5₈
011₂ = 3₈

Write the answer to these conversions from right to left, starting with the first conversion you did (111₂ = 7₈) and finishing with the final conversion (011₂ = 3₈).

Your final answer is: 11101110111₂ = 3567₈

How to convert a Hexadecimal number to a Binary number?

In hexadecimal, also known as Base 16 — we count with 16 digits as opposed to 2 in binary, 8 in octal, and 10 in decimal. Hexadecimal is increasingly used throughout Computing, for example in the Internet Protocol v6 system within computer networking.

The digits used for counting include letters this time:

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E ,F

Refer to the following chart to note the similarities between Hexadecimal and Decimal and then their conversions to Binary.

Hex to Decimal and Binary

An easy way to memorize the above is that all Hexadecimal numbers from 0–9 are the same as they are in Decimal, then it is straightforward enough to convert to binary.

In the case that you are dealing with 0–9 numbers, simply convert to binary but use a 4 digit representation in binary.

After 9 comes A, B, C, D, E, and F. These correspond to their incremental values in decimal e.g. A = 10, B = 11, C = 12, and so on.

Let us convert the Hexadecimal number ACE₁₆ to binary.

Starting from right to left again, as we did with Octal — begin with the letter E₁₆ but convert this into four groups of binary digits, including leading 0s in all groups of digits bar the final group of digits farthest to the left.

E₁₆ = 1110₂
C₁₆ = 1100₂
A₁₆ = 1010₂

Now write the above binary representation starting from right to left. In the special case that you have leading 0s at the end of your binary conversion in the farthest to left places, omit them.

ACE₁₆ = 1010 1100 1110₂

Now let’s try another example: 3AF₁₆

Starting from right to left, convert each of the Hexadecimal digits into four groups of binary digits — with leading 0s in all places taking up the 4 digit values where required, bar the farthest to the left group of 4 digits — where you omit the leading 0s.

F₁₆ = 1111₂
A₁₆ = 1010₂
3₁₆ = 11₂ 
(note that we have omitted the leading 0s from the final group of ‘4’ digit binary numbers in our Hexadecimal to Binary conversion)

The final representation is 3AF₁₆ = 11 1010 1111₂

How to convert a Binary number to Hexadecimal?

This is a similar process to the one that we covered for Binary to Octal conversions, except you are using four-digit binary representations instead of 3.

Let’s use another example — this time starting with a Binary number and converting to Hexadecimal.


Split the above binary number from right to left into groups of four binary digits, if there are not enough digits in the final group farthest to the left, add leading 0s.

Then convert these groups into decimal and use the decimal number to figure out whether you are dealing with 0–9 or A — F.

Recall that the numbers 0–9 in Hexadecimal are the same as they are in Decimal and the letters that follow, A — F, correspond to:

A = 10
B = 11
C = 12
D = 13
E = 14
F = 15


Add leading 0s if you do not have solid groups of 4 binary digits.

Then start from right to left with your groups of 4 digits, converting them from Binary to Decimal to Hexadecimal. Note, you can convert straight from Binary to Hexadecimal if you have memorized the chart given above in this article.

1011₂ = B₁₆ — this is the same as the number 11 in Decimal, recall that after 0–9 digits we increment by 1 corresponding to the starting letters of the alphabet (e.g A = 10, B = 11).

1101₂ = D₁₆ — this is the same as the number 13 in decimal, consult the list above if you are not sure.

0111₂ = 7₁₆ — this is the same as the number 7 in decimal, which is the same in Hexadecimal.

Now write the Hexadecimal conversions above, starting from right to left.

Your final answer will look like this: 11111011011₂ = 7DB₁₆

How do we convert Octal & Hexadecimal to Decimal and vice-versa?

There is no shortcut to do this and in my experience, I have found the simplest route is to convert Octal / Hexadecimal to Binary then to Decimal.

If you need to convert a Decimal number to Octal or Hexadecimal — convert it first to Binary.

Always use binary as the proxy or intermediary between conversions of this type.

Further Practice

This website is extremely useful for generating a quiz of Decimal, Binary, Octal, and Hexadecimal conversion questions — please do practice with it as much as you can, until you are consistently scoring 100% in your answers:


In the Octal and Hexadecimal number systems, the numerical digits used for counting correspond to their decimal equivalents.

In Octal: the numbers 0–8 correspond to the same in Decimal.
In Hexadecimal: the numbers 0–9 correspond to the same in Decimal.

We already know how to convert Decimal to Binary and vice versa, so we can use those conversions

In the special case of Hexadecimal, we typically use the letters A — F following the number 9 to denote 10–15. I.E the numbers used for counting in Hex are:

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A(10), B(11), C(12), D(13), E(14), F(15)

We convert Octal to Binary by splitting the octal number up right to left into single-digit values which should be converted into three-digit binary representations.

In Hexadecimal, the process is similar. We can convert from Hexadecimal to Decimal and then to Binary — representing the binary number in groups of four digits.

The leading 0s in the group of binary numbers we have converted to in the farthest to the left group of binary numbers can be omitted.

I hope you enjoyed reading this article. For further information about me and my work, please view my portfolio and blog.

Binary to Decimal

Binary to Decimal and Decimal to Binary Conversions

Binary to Decimal

This article was written with an aim to help those learning about the binary and decimal number bases and common conversions between them, in particular, Binary to Decimal and Decimal to Binary conversions.

It may help those studying Discrete Mathematics modules on Computer Science degrees, budding network engineers learning subnetting, and just about anyone else with an interest in this branch of Mathematics.

I will start by outlining what the number bases are and mean, then move on to the conversion methods.

What are number bases?

The base or ‘radix’ is the number of digits that are used for counting in that number system. It is usually represented as subscript beneath the element or number in question I.E a smaller number beneath the element itself.

The following are the representations of the major number bases this article explores — we have used the number as an example of the element or number in question, the smaller number beneath denotes the number base system used — this is called subscript:

Humans typically use the decimal system in most cases — that is, counting with 10 digits. Arguably and historically, humans have used this system due to a natural predisposition to count the number of digits on both hands.

We use the numbers 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9 (10 digits in total) when counting in the decimal system, this is the number represented as the base/radix and is written as a subscript when we wish to make it obvious what number base was used.

What is place value?

Within all number bases, we apply place value to numbers based on their position, this affects the total value of the number(s) in question.

The rightmost digit in any sequence of numbers is known as the Least Significant Digit (LSD) and the digit farthest to the left is known as the Most Significant Digit (MSD).

For example, in the number 123,432 — spoken as one hundred and twenty-three thousand, four hundred and thirty-two — the LSD is 2 (in the units column) and the MSD is 1, in the hundred thousand columns. View the chart below for a rudimentary understanding of place value.

Note the full stop or period in this chart, denoting the decimal place: on its left-hand side is the ones or unit’s column, followed by tens, hundreds, thousands, and so on.

To the right-hand side of the decimal place are the fractional places: represented immediately to the right of the decimal point as tenths, hundredths, thousandths, and so on.

To represent the number used in the previous example — 123,432 we can place it in the place value chart as follows:

Sum all these values and you will return to the figure in question.

So, the place value of the digits in the decimal system, starting in the one’s column and traversing to the left, I.E then the tens, hundreds, thousands…increases the exponent by 1 in each place move.

If you have a 3 in the tens place — the tens place itself represents 10 to the power of 1 (10¹) — you multiply that by the number in question, so 3 x 10 = 30.

Below is a useful place value chart explaining the exponent values of the base 10 number system.

If you don’t understand at this point, you may refer to the following tutorial by the British Broadcasting Corporation (BBC) on the topic, as we wish to focus on base conversions and how to complete them:

It is important to consider place value when understanding the base systems and conversions between them, as the place value used differs in value between the number bases and is consistent throughout them.

What is the binary system?

The binary number system or base 2 is used throughout computation but pre-dates the invention of modern computing. It consists of counting using only 2 digits — 1 and 0. Their place value, as already explained above, is extremely important in understanding the value of a binary number.

We use binary in computing because, on a very simplistic level, computers are only able to process two states, typically represented as the presence of charge or absence of it.

Place value in the binary system

Place value in the binary system works the same on a conceptual level — where 1 or 0 is placed changes the value of the total.

Instead of using 10 as the base number with exponents increasing incrementally, as in decimal — the base is, you guessed it, 2. 

Refer to the following chart and memorize it, it is essential:

The one’s place represents 2⁰ 
The two’s place represents 2¹
The four’s place represents 2²
The eight’s place represents 2³
The sixteen’s place represents 2⁴
The thirty-two’s place represents 2⁵
The sixty-four’s place represents 2⁶
The one-hundred and twenty-eight’s place represents 2⁷

Note again that place value in the binary system increases exponentially — I.E it doubles in value on each increment.

Now let us consider the binary number 11000111 — please refer to the following chart to see how the place value lines up.

To compute this number, start at the Least Significant Digit (LSD).

We will refer to numbers where they are being taken the power of something in the following manner, with the element first then ^ representing the power, followed by an exponent.

We can see there is a 1 in this place, so multiply 1 by 2⁰ which equals 1, write down 1.

Then look at the next place to the left of the LSD, there is a 1 in the two’s place. This is represented as 1 x 2¹ which equals 2, write this down as an addition to the previous number.

Now you have 1 + 2, let’s continue…

There is a 1 in the fours place — this is represented as 1 x 2² which equals 4, write that down as the next addition.

You now have 1 + 2 + 4.

The next digit is a 0 in the eight’s place — this is represented as 0 x 2³ which equals 0.

Omit the 0 from the numbers you are summing so far and move on until you find the place value of the next 1.

In the sixty-fours place, we find the next 1 — this is represented as 1 x 2⁶ which equals 64.

Finally, in the one hundred twenty-eight’s place, we find 1 — this is represented as 1 x 2⁷ which equals 128.

Your final sum should look like this: 1 + 2 + 4 + 64 + 128 = 199

This is how we convert binary numbers to decimal.

If this is your first time learning this concept, I would strongly recommend practicing multiple operations of this with various exercises until you are comfortable with it and have memorized binary place values.

You can try the following calculator to convert binary to decimal and so on.

Try the following questions, ignoring the answers until you are ready or need them:

How do I convert decimal to binary?

We have covered how to convert a binary number into a decimal number, but you also need to know how to convert any decimal number to binary.

There are a few methods for this, I will be using a table method in this article, which I find the easiest and least prone to error.

Let us convert the decimal number 312 to a binary representation:

We draw a table to complete this, write the number to be converted to binary in the top leftmost column of your blank table with three headings for the columns from left to right — A, B, and C.

If the number you start with is an even number, write that same number under the B column. Then in the C column, write down the value of A — B. In this case, as the computation is 312–312 you are left with 0, so write that in the C column.

Now divide column B’s value by 2 and place that answer in the next cell of column A, beneath the last number in column A.

Column B (312) divided by 2 is 156. This is also an even number, so write it in the next cell of column B, and in column C write the difference between the new numbers in columns A and B, which is 156–156 = 0.

Again, divide the value in column B by 2 and continue by writing that value in the next space in column A, beneath the last number in column A (156).

Column B’s latest number is 78, which again is even. We compute the difference between column A and B (78–78), writing 0 in column C.

Then repeat this process — divide 78 by 2 and write it in the next space in column A — which is 39.

Now because the number in column A is odd the next part in this process is to deduct 1 from the number in column A (39) and put the answer in column B.

As you can see — we took 1 away from the odd number in column A, placed the answer in column B, and continued by computing the difference between A and B (39–38) which equals 1. We write this 1 in the C column.

This is essentially an algorithm that we continue, the rules are outlined at the end of this process.

We divide 38 by 2, leaving us with 19, which we write in the A column. As 19 is odd, we minus 1 from 19 to give us an even number and write the difference between column A and B in column C (19–18) which equals 1.

I have continued the process down to 2, as the process is obvious by now.

When we get to two, remember that divided 2 by 2 will give you 1. We place 1 as the final row of digits in column A.

Because 1 is an odd number, we take away 1 from 1 leaving us with 0, which is an even number that we place in column B. Then in column C we write the difference between 1 and 0, which is 1.

The final table will look like this now:

Now to get the binary number from this table, we start at the top in the C column (0) and write this down as the Least Significant Digit in our answer.


Then write down the next digit in the C column beneath the topmost digit, which is another 0.


Then write down the next digit in the C column beneath the last we looked at, which is another 0.


The next number in column C is 1, write that next.


We continue down the table until we reach the final digit, writing the numbers down right to left.

The final digit in the table is a 1 — write that down as the Most Significant Digit.


Rules for converting decimal to binary with a table method.

  1. Write the number we are converting from decimal to binary in the top left-most column — call this column A.

  2. If the number is even, write the same number next to it in column B.

  3. If the number is odd, deduct 1 from it and write the answer next to it in column B.

  4. Write the difference (A — B) value in column C, to the right of the answer you wrote in step 3.

  5. Divide column B’s value by 2 and put the answer in the next row of column A, beneath the last number you wrote in column A.

  6. Continue this process until the number in column B is 0. You have now finished the conversion.

  7. Write each of the numbers in column C (either 0 or 1) from the top of column C going down starting at the least significant digit place. This is your binary number.

To be 100% sure you have the correct answer, convert your binary number back to decimal — consult the chart we looked at earlier for binary to decimal conversion.

The following is an extremely useful quiz tool for testing Decimal/Binary conversion knowledge. I would strongly recommend attempting several quizzes and memorizing the charts provided in this article so that you will be successful in understanding how to Convert Decimal to Binary and Binary to Decimal.

I hope you enjoyed this article, please follow me on Twitter or message me if you have any questions.


What Is Object Oriented Programming?

Object Oriented Programming (OOP) is a programming paradigm which tries to emulate real world problems using the abstract concept of ‘objects’ as a data structure which can be mutated and referenced.

There is no dictionary definition of the phrase OOP, but we can refer to Wikipedia’s summary to glean a semi-‘official’ account of its use:

Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which can contain data and code: data in the form of fields (often known as attributes or properties), and code, in the form of procedures (often known as methods).

Object Oriented Programming

My Background in OOP

I have personally been programming for around 4 years as a hobbyist, student and professional developer. Academically, I hold a short-course certification in Object Oriented Programming with Java from City University, London amongst other various courses I have studied and books I have read.

The above does not make me an authority on this subject; but I feel I can certainly help those searching for an initial understanding and conceptual brief of OOP.

It’s imagined that if you are reading this article and have found it through search, you don’t yet have a mental concept of OOP nor have implemented it in practice. Let me assist you there.

How can learning OOP benefit me?

It is certainly a concept that is extremely useful for budding developers and programmers to understand, as approaching software or web development projects using OOP (as opposed to procedural approaches), cuts development time, reduces repetition and leads to an easier to produce, maintain and understand, codebase.

Not only that, but pretty much every professional developer uses objects and classes as part of their data structures.

If you don’t understand objects and the basic principles of OOP, you won’t survive very long as a professional developer, or at least you will be limited in your scope for producing more complex applications than perhaps a static simple program that computes values.

To get you to a better understanding of OOP, I will use code examples using the highly popular JavaScript ES6 language as reference to highlight concepts discussed.

I have deliberately omitted from this article, all aspects of OOP, as I feel it is important only to understand a few major concepts, before diving deeper. In this way, I’ve abstracted OOP for the beginner in a way that can be understood with perhaps a little programming background.

Approaching Programming Problems: Procedural versus OOP

To better understand OOP, you must understand programming in its infancy, before the creators of our modern languages modified popular high level programming languages to use objects to overcome the difficulties of time consuming, procedural — line by line — programming approaches.

Infancy of Computing — Pre OOP

Very simple definitions of programming often refer to giving the computer an algorithm, which we understand as a simple set of logical instructions that lead to a set outcome. A common metaphor used might be of baking a cake.

We can understand in the English language that to “bake a cake” is an abstraction of a more refined process, which we can further break down into simple instructions. E.G 1. Add flour. 2. Mix and Beat Eggs…etc etc

Computers, at their heart, are ‘simple’ machines in this respect, that can compute or process instructions at lightening speed, depending on various factors. We can give the computer these instructions procedurally — one after another, with intention that they are executed consecutively and iteratively.

Instructions at their rawest form are binary — they are read at a low level as a series of 1s and 0s e.g 10010100, interpreted via electrical signals that are on or off, high or low or even for example in the change in dimples on the surface of a CD or DVD.

Humans can’t instruct computers to do what they want (or program them) in this form due to the sheer volume of bits required to communicate simple instructions.

It just isn’t practical to write binary or machine level code these days, although it was certainly attempted by historical computer scientists — such as Ada Lovelace and Charles Babbage. They produced programs that solved basic mathematical computations; but the machines they used and the tools available at the time (often using punch cards) were very limited in their processing power and ability to execute these binary instructions.

As a result, those that developed modern computing, abstracted the low level instructions to a higher level language — one that humans can interpret and understand quickly, with a little knowledge and training.

The following is a simple snippet of a procedural code base that produces the square of a number.

let squareOf2 = 2 * 2;

This is fairly useful for its given case, which was to find the square of 2 and store it within a mutable variable called ‘squareOf2’.

However, writing code like this is fairly useless if we want to compute given cases in the future without re-writing a statement for each case.

For example, to square all the numbers from 1 to 10, you’d have to write something like this…

let squareOf1 = 1 * 1;
let squareOf2 = 2 * 2;
let squareOf3 = 3 * 3;

Functional Programming

The previous example highlighted the caveat of a procedural approach to programming. To achieve outcomes, solve problems or implement algorithms, we’d have to write the same thing over and over again top to bottom.

We’d repeat ourselves throughout the program and our final product will be one very long code file which would be hard to maintain.

To overcome these obstacles, developers of modern ‘high level’ programming languages (understood as — abstracting or summarising lower level instructions to more succinct operations) produced a functional programming approach, which allowed the developer the flexibility of encapsulating or ‘capturing’ their what would otherwise be repetitive coding behaviours, into easy to reference functions, that could be named and reused.

That is, rather than re-inventing the wheel every-time, as in the prior example, programmers can now simply call a function they write once and change the input argument (data) as they see fit.

Take the following example of a ES6 arrow-notation function below, that encapsulates the above process and solves the algorithmic challenge of squaring a given number (an argument) multiple times:

const square = (base) => {
return base * base;

If you don’t know JavaScript all that well; to highlight the above notation bit by bit, I have simply assigned to a constant (in most cases, immutable variable) called square, a function which takes ‘base’ (a parameter) which can be anything the user chooses to pass in; and then run a simple calculation on it to square whatever number the user passes in.

Therefore, the outcome of this functional process to square all the numbers from 1 to 10 could be achieved by re-using the above code in the following form (yes, it’s also not ideal — we’ll get to that!).

square(1) // Produces 1
square(2) // Produces 4
square(3) // Produces 9
square(4) // Produces 16
square(5) // Produces 25

We can further make this process even simpler for a future use case.

What if we had to square not 10, but 100 or 1000 or more numbers in a go?

Even with the function above, this would still take a little bit of repetitive writing to achieve.

To solve this problem, we could implement a flexible algorithm into a function which allows the user to pass in a single integer as an argument that determines the number of square numbers to compute and when called, executes that calculation as many times as specified.

As below, here is my example of a function that would achieve such an outcome using a conditional operator (a while loop):

// This function squares all numbers consecutively from 1 to and 
inclusive of the passed in limit e.g. 1 to 10
const square = (limit) => {
x = 1;
while(x <= limit) {
return(x * x);
square(10); // Output is below

See the difference in a functional approach?

We are moving away from the procedural — statement by statement programming, to a more modular, repeatable and encapsulated form.

The end result is that we can write functions that solve specific, broken down algorithms, or parts of yet an even larger algorithm, and use these throughout the program with much more ease than repeating or re-inventing the wheel on each occasion. This also reduces the scope for human typing errors.

That’s great, but what about Object Oriented Programming — you haven’t got to the point yet? What is an Object?

So we understand now, having read the previous summaries, that a functional approach to programming leads to less repetition and abstraction of real world problems into a form of language that we can reuse and refer to throughout the program.

I turned the repetitive process of ‘squaring’ any number into something I could reference in the future simply using the word square().

I no longer had to re-write everything that was encapsulated within that square function, every time I wanted to square a set of numbers.

Objects are yet another form of data structure within many programming languages, often referred to as Object Oriented languages. I use JavaScript throughout this article — but perhaps the best known example of an OOP is the Java language (which has some similarities to JavaScript, but is certainly not a parent or predecessor / relative of it).

If you’ve been programming a little in the past but don’t yet understand Objects or OOP, you might understand simple data structures at this stage.

Objects are a data structure that model real world ‘objects’. They behave like a little more advanced version of an array — but are extremely flexible and easily manipulated.

You may know and have very likely encountered variables (one simple and fundamental way to play with data).

Variables reference a location in memory within the computer and can either be immutable or mutable — that is they can be static / unchangeable or changeable, which we reference in the JavaScript ES6 notation as either let, var or const.

The following code uses mutable variables (using the let keyword to denote a variable is being declared) to hold data:

let variableOne = 1;
let name = 'Adam Turner';

This is great — we can assign bits of primitive data, such as strings of text, numbers or boolean values to a space in memory which we can later reference or manipulate.

variableOne += 2;
// Prints 3

You may be aware of arrays, for example, checkout the following ‘array’ (or in English — consecutive grouping of things stored in memory) and understand that it is just yet another way we structure data:

let arrayOfColours = ['Red', 'Orange', 'Pink', 'Blue'];

This is useful, as we can store information in this human understandable form, iterate over it in various ways or manipulate it.

It represents a kind of logical list of things we want to store, rather than a variable, which is just a singular value (not a list of values).

I understand variables, arrays and so on, but what is an object?

Objects take the idea of data structures one step further with the goal of giving the programmer flexibility in modelling within them, real world objects I.E things we encounter within the world outside of computers, such cars, tables, music albums etc.

Pretty much anything you can dream up of, could be in someway represented computationally as an object.

As long as the real world ‘object’ we are trying to capture or abstract into the computer has some form of logic to it (i.e. we cannot model a jumbled set of nothing), we can turn it into a very flexible data structure, called an object.

The following is an example of how to declare a mutable object ‘literal’ in JavaScript ES6:

let car = {};

It is that simple to declare an object, but what sets objects apart from other primitive data structures?

Objects have the following attributes to them in their most basic form:

  1. PROPERTIES : these are typically expressed as key value pairs which look like the following ‘key : value’, where the key is the property, and the value is the value. When we write the properties of an object (for example as above we chose a ‘car’ object) we want to try and capture the relevant properties and their values specific to that object. This might mean, with a car, a key of ‘age’ and a value denoting the date the car was manufactured (x or in the following example 10).
  2. BEHAVIOUR: I have used this term, instead of methods or other references the object can ‘do’, because there are more behaviours than just methods. To break down behaviour we can define within an object the following possible behaviours:

    – Method / Function: This could be a simple function which returns a value, for example, a method called ‘recommended sale date’ could take the age value (defined in the properties above) and add 10 to it, returning the year that one should sell the car by.

    – Getters / Setter: These are specific behaviours that get for the user / programmer, values from the property / value pairs within the object or change (mutate) those values.

Let’s take a look at an object in practice using JavaScript again:

let volvo = {
model: 'Volvo 2',
age: 10,
findSaleDate() {
return age + 10;
get age() {return age};



console.log(volvo.age) // displays 10
console.log(volvo.findSaleDate()); // displays 20
console.log(volvo[model]); // displays ‘Volvo 2’


The above is great for a single use case of a ‘Volvo 2′ car.

As above, we defined the volvo object, gave it some properties (model, age) and behaviour (a method called findSaleDate() that when called returns the age of the volvo plus 10.

This would be helpful in a program specific to volvo cars only.

However, what if we wanted to go a step further and really implement objects for a large code base with the aim of reducing repetition and abstracting these real world objects to reusable, modular entities?

Objects Summarised

As above, you have seen that objects are just another data structure, which we can manipulate and are a little more flexible than variables and arrays, for example, as the programmer can define the properties of the object as they wish and subsequently, how it behaves.

You saw that we defined an object literal in a similar way to how we define a variable, but using { } after the equality operator.

We then enclosed within that block, properties and behaviour in the form of key value pairs for the properties, and what are very similar to functions, as the methods, getters, setters, which make up the overall ‘behaviour’ or ‘doing’ capabilities of the object.

I have omitted from this article, the subtleties of privacy that many programmers implement in objects, for example, by denoting properties the programmer does NOT want to be changed directly as beginning the key with an underscore. E.G _name : volvo.

To understand how to build objects properly within JavaScript or your given object oriented language, you really need to understand data structures and then work on the syntax for objects, which is out of the scope of this article, that has been written with aim at developing a beginner’s understanding of OOP on a high level.

Going One Step Further — Objects and Classes

In this final and advanced stage of understanding OOP on a high level, you have so far encountered objects as a data structure which allows the programmer a great deal of flexibility in defining the objects makeup and behaviour.

Classes act as a blueprint for building objects. We could think carefully about the prior scenario, and create a blueprint for building cars (a Car class) which itself produces car objects, which can be defined by the developer or user.

There could also be sub-classes to the car class, for example, a convertible class, or a sports class or whatever is required for the use case of the program.

This is where inheritance comes into play.

There are several main concepts to OOP which I will summarise at the end of this article, but of the most important (bar encapsulation — which you will have understood in the functional programming explanations) is perhaps inheritance.

Inheritance — Parent and Child Classes

As in nature, or simple biology, children inherit features of their parents, within the animal and plant kingdoms. This rings true with the programming paradigm of OOP too.

Let us structure a ‘car factory’ program which has a very high level purpose of producing different cars of different types including sports cars, convertibles and 4×4 jeeps.

We could create a super (parent) class which holds all of the common features (attributes or behaviour) of the objects it is supposed to be a blueprint for.

We could then write further sub or child classes, which inherit from this parent class, those common features, but have specific or custom features that relate only to that child class also. In plain English, we could refer to this child classes as ‘custom classes’ (although this terminology is not used professionally) — as they customise further the blueprint denoted by the parent.

Child classes inherit all of the properties and behaviour of their parent class — in programming lingo, they ‘extend’ the superclass.

These properties and behaviours do not need to be re-written in majority case.

Take the following example of a parent class to catch all cars features where possible (ignore the constructor for now):

class Car {
constructor(model, colour) {

model = model;

age = 0;

colour = colour;

printCarSummary() {
return `Model: ${model}. Colour: ${colour}. Age: ${age}`

The above defines a ‘Car’ class, which has a constructor (a method that initialises or ‘constructs’ the object).

The constructor defines that, that particular object which is being constructed will have a model property that holds the specific value passed in the parenthesis (model, colour). The same action is taken for colour.

Then under behaviour, there is a printCarSummary() method, which simply returns a string summarising the values of the object (model, colour and age).

We can produce a ‘new’ object instance of Car using the Car class as a blueprint utilising the following syntax.

We can then access that object’s specifically defined state and behaviours however we wish.

let myRedVolvo = new Car('Volvo', 'Red');
// Displays red
// Prints "Model: Volvo. Colour: Red. Age: 0"

The prior parent ‘Car’ object isn’t useful for specific use cases — what if we wanted to quickly define convertibles and jeeps?

Let’s just use a convertible as an example and define a convertible class that inherits all of the car classes properties and behaviour, but has own properties that are unique to that convertible class, such as ‘isHardTop’ — a boolean value denoting whether the convertible is a hard top or not.

class Convertible extends Car {
constructor(model, isHardTop, colour) {

super(model, colour);
_isHardTop = isHardTop;
fastCarNoise() {

return 'Zooooom!';

Now we have a child Convertible class, which inherits from its parent Car class, all of those features, but adds or extends its own features within the new class.

For example, we don’t have to re-write the printCarSummary() method because it is inherited from the parent Car class AND we can now access the fastCarNoise(), which is specific to the Convertible class.

let bugatti = new Convertible('Bugatti Veyron', true, 'Blue');
console.log(bugatti.fastCarNoise()); // Prints 'Zooooom!'
console.log(bugatti.model); // prints 'Bugatti Veyron'

You can see now that it is much easier to encapsulate general or common attributes of objects in parent classes, and then where there is a specific use case, create child classes that can be used to create even more granular objects.

I have deliberately omitted certain programming practises in ES6 for sake of brevity, for example, explaining how the .this method works. Please if you are interested and want to learn how to implement OOP in your JavaScript programs, I would recommend studying a formal course on the subject.

Summary — What is Object Oriented Programming?

OOP is a way of thinking and a form of tools within programming that implements syntax enabling us to go beyond the old style procedural programming paradigm of trying to solve problems iteratively top to bottom in a slow and logical fashion that ultimately leads to repetition and time consumption.

We can think of objects now in a multidimensional fashion, as another data structure, which is highly flexible, reusable and great for abstracting a problem in a way humans can more easily understand.

Objects are summarised as having properties and behaviour.

Seeing a program, for example, a car factory system, as one which denotes classes (blueprints for objects) in a parent > child fashion — allows us to be very modular in how we produce objects for later manipulation or access.

In totality, objects allow us to understand programming in a more real world fashion, beyond top to bottom instructions for a simple machine, pushing conceptually closer to human ways of processing information i.e. understanding the world in programs as physical objects that have a state (properties and values) and do things or act. OOP in short, makes life a lot easier.

Further Reading — OOP All Concepts

I have only included in this article the main concepts I think you need to understand for you to achieve at least a first grip of OOP on a high level.

I strongly recommend, however, that you explore and read about all of the concepts within OOP to get a deeper understanding.

I discussed abstraction, in the form of looking at how we take a complex task and ‘abstract’ or reduce it to a smaller or more modular task when writing functions.

Encapsulation could also be understood throughout this article in some form through looking at how certain features of objects (or even functions) could be ‘captured’ or ‘encapsulated’ within their own environments.

The major topic of inheritance was discussed using examples of parent (super) classes and sub or child classes.

The following graphical representation highlights the major components of OOP in the Java programming language, which may be relevant depending on your use case:

Key Concepts Discussed in this Article

1. Procedural versus Object Oriented Programming
 — OOP enables greater flexibility and is closer to producing real world implementations of real world problems, than the simple algorithm implementations we first looked at in the form of baking a cake, following instructions top to bottom.

2. Functional Programming — this is a modern approach to writing programs, in the form of using functions (modular bits of code that we can re-use). OOP takes this concept and advances it.

3. Objects are another data structure — at their rawest form, objects are an advanced data structure which allows the programmer the ability to define properties and behaviour of those objects.

4. Classes — are blueprints for making objects, they are used to specify the makeup of objects. Super (or parent) classes pass all features down to further sub-classes or child classes, which themselves can have specific features. We use the classes to make new objects, typically using the ‘new’ keyword.

I hope you found this article useful. Please feel free to reach out to me directly if you notice any major discrepancies or you feel there is an error somewhere.

To find out more about me, feel free to follow me on Twitter:

Happy Coding!