Introduction to Computer Programming

Hello there I hope you are well. It has been a long while since I last did any kind of programming. I figured that most of you have had the same struggles that I have had while trying to learn how to code.

I have a background in computer technology which is a course that I did while in college. I managed to do well and graduated with a degree in computer technology. However, the way the program was designed was such that we did so many units that were compressed in a small time frame. By small time frame I mean in 3 and 1/2 years.

While three and a half years might seem like a long time to some of you , it is not enough time to cover all the units that you are supposed to cover to successfully complete the course. I did a bit of programming back in college but it was squeezed within a unit that we had to finish up in a month. Within this time period, we had to learn a lot to do with the basic levels of programming up to the advanced levels .

I ended up disliking programming as the lecturer was teaching us the subject glossed over the basics and did not care whether you understood it or not. He just went on with the lectures as if everybody was understanding what he was teaching. 

So I really struggled with that unit and ended up hating programming and all that comes with it. However in the recent years I have come to understand that code is an integral part of technology and since I am very passionate about technological advances, I decided to renew my passion  for coding or rather rekindle my passion for coding that I never had and seeing if I have the capability of learning it and even applying it in a real life application.

Therefore I decided to look for tutorials online and during this season where everybody is indoors, there are so many colleges offering free courses online. So I decided to join a couple of them and see how far I can go with this. I know there are so many of us out there who have not had a passion in coding but somehow are still interested in learning about it, so I decided to journal my experience and I invite you to follow along and even give me suggestions on more content that I can provide.

So to start with I am going to cover introduction to computer science so that I can have a little background and foundational information to build my knowledge so that i do not get stuck when I get to the advanced levels.

So basically the way a computer understands information is in binary. The binary language is basically arranged in the form of zeros and ones. A computer does not understand information in the same way that we as human beings do. We have the luxury of using the numbers 1 to 10 to perform various calculations that we need to perform in everyday life. This is known as the unary notation.

The computers and machines that  we use do not have that same luxury  because they have to interpret complex information that we input into them and synthesize that into a bunch of zeros and ones before performing the desired commands.

As an example, if we were to write the number one hundred and twenty seven as human beings, we would write it as 173.

100 *1=100

7*10 = 70

3*1 =3

If you add them all up it equals 173. The number 3 being in one’s place, the number 7 being in tens place and the number 100 being in a hundreds place. 

In the computer world we don’t have the digits 1 to 10, we just have the digits 0 and 1.

These zeros and ones are represented in computers as bits. One byte is equivalent to 8 bits.

So you may be asking yourself how do computers represent large numbers? Well they do this by using binary language. I have attached an image below so that you can see an example of how the number 50 would be represented in binary language.

I just learnt this is how information is represented inside your computer, laptop and even your phone. Inside your device are some electrical components known as transistors that use this form of language to store information. They use electricity as a form of energy to store information as a series of 0’s and 1’s. 1 may be represented by a small charge of electricity while 0 may be the lack of any amount of charge. 

This is also how they store documents, emails, images and all sorts of information that is inside your USB drive. Your machines and any other electrical component uses the same method to store all the information you put in it.

I also learnt this is how ASCII code came about. I’m sure when you look at your keyboard on your laptop or computer, you see a certain pattern of how letters are arranged on your keyboard.

Have you ever wondered how they translate into information and how your machine understands what you have typed? 

Apparently it is just a standardization of how the electrical signals that have been generated when you press the keyboard are interpreted by the machine. There are various codes all across the world depending on the type of language you are using. 

 For the English language, there are some people who sat down a long time ago and agreed on a format of how the letters of the alphabet would be represented by the numbers that the machine understands hence the ASCII code.

It is interesting to note that colours are just a bunch of numbers that are added up all together to form different shades. So the colours you see on your electrical devices are just a combination of various codes put together in various amounts. The numerous amounts of smileys that you send are just a representation of very large numbers to the computer that represent the images you see as bits.

Videos that we watch are just a bunch of pictures that have been stitched together by optical devices that give our eyes the illusion of movement but it is just thousands and hundreds of thousands of images stitched together by video processing software so that our eyes look at it as something that is moving or in motion, however it is just a bunch of still images put together and looped over a certain time period.

This is where algorithms come from. An algorithm is just a sequence of instructions that perform a certain function. It is a set way to do something. For example there’s somebody who sat down and wrote an algorithm of how to represent images on machines. So we who come after can just use that set of instructions that the person already made to do the same action. We do not have to create our own unique method once again, unless we are making it better and faster.

Another way of looking at algorithms is by picturing yourself trying to look for a name in a phone book. For example if you are looking for the contact of a person, you would have to flip pages from the first page of the phone book until you come to the page that has the letters of the person you are looking for and then you stop to check for the specific name of the person you are looking for.

There are various methods you can go about this. You can start from the first page to the last page. You can even open up the phonebook halfway and then start looking for the letter of the name of the person you are looking for. If it is not at that page, then you decide whether you can move to the left side of the phone book or to the right side of the book.

When programming, you first start by picturing the problem you want to solve in your mind then you interpret it into common language. This is called a pseudocode. It is just a way of representing the solution to a problem in simple statements in a language that anybody who reads it can understand what you are trying to do.

I have attached a screenshot below of how a pseudocode may look like if you are trying to represent an algorithm for searching for the contact details of a person in a phone book.

Another way to practice the basics of computer programming in a visual way as we both understand the basics is by using a tool known as Scratch that was developed by MIT students some years ago. You can learn a lot more about it by watching the video below.