Programming and Computers

Programming and Computers

·

6 min read

Welcome to the world of programming🎉🎉. This is the first article of my ✨INTRO TO PROGRAMMING✨series where I'll be taking you from newbie to comfortable in programming. It's going to be a crazy amazing journey and I'm hoping you stick around till the very end of the series.

I am assuming you are new to programming, or at least you just developed an interest in it and you're looking to know more about it. Well, let's get straight into it😊.

What Is Programming?

Some people say it is a science, well because it comes from Computer Science. Others think of it as an art because of the creativity that is involved. Well I say

Programming is all about using code to solve problems in the world

Now, what does that mean? Can programming solve the hunger you feel rumbling in your stomach right now?😂. Probably not directly. However, with programming( or coding, I prefer saying coding), you can make programs and applications that generate income which provides that means for you to buy food and then solve your hunger problem.😉

That's just a funny example. The real problem-solving aspect of programming lies in the statement "making applications that generate income". The only way an app generates income is if it solves someone's problem so much so that they are willing to pay for it in some form. It could be providing entertainment, or saving time, or making life generally easier. People pay huge money for stuff like that and as programmers, it is our duty to find more efficient ways to make people happier!😁

Problem-Solving in Programming

Programming problems usually follow a specific flow.

Input -> Processing -> Output

This is not just the flow of how to solve a problem in programming only but also life in general. Usually, you see a problem and you propose a solution. The solution is the desired Output. Next, you begin to figure what you need to solve the problem. The items you need are the Input and putting those items together to get the solution is the Processing phase.

The difference in programming is how these inputs are represented. If the problem involves words, numbers, colors, images, videos, how are these represented on a computer? For those a little familiar with computers, what language do computers understand? That's right, Binary. Binary is a mathematical counting system that uses just two digits, 0 and 1 to represent all numbers. The normal human counting system uses ten digits, 0-9 instead. How do videos relate to 0s and 1s then? Well to answer that, let's look at something else first.

Why Do Computers Use Binary Though?

Computers use binary because of how they are built, the power source that makes them come "alive". We all know computers use electricity to function meaning when there's electricity flowing, the computer is on, when there's no electricity flowing, the computer is off. Computer Scientists decided to use these two states to represent data in the computer. The presence of electricity means 1 and the absence means 0. Computers, therefore, have processors which contain billions of tiny electrical components called transistors, which are used to store electricity and represent all the data we use in a computer, whether it is text, emojis, images, etc. You can check out this quick YouTube Video to know more about the Binary Number System.

How Some Data Entities are represented in a Computer

Computers use transistors to represent data. Each transistor represents one BIT( Binary DigIT). 1bit can contain either a 1 or a 0. 8bits represent 1byte(e.g 00001111. is a value that occupies 1byte of memory). 1000bytes represent a kilobyte, 1,000,000bytes represent a Gigabyte, and so on.

  • Numbers: Numbers are the easiest data to represent in a computer. This is because Binary used by computers is also a counting system and so numbers just need to be converted from human Decimal form(0-9) to binary form.

  • Text: Text data is a little bit less straightforward to represent therefore computer scientists had to create a system that mapped characters and symbols to numbers. One such system is called ASCII(American Standard Code For Information Interchange). ASCII uses 1byte to represent each and every character on the regular English keyboard we use today. However, this system fell short in representing characters in other languages as well as special symbols like emojis. This gave rise to UNICODE, another system that uses more bytes allowing us to represent many more characters on a computer.

  • Colors: Colors are represented using the RGB(Red, Green, Blue) system. This system relies on the principle that all colors in nature exist as a combination of red, green, and blue in different proportions. The computer uses 1byte to represent the amount of each color. This means we can get a minimum value of 0 and a maximum of 255 for each primary color. A computer, therefore, has the ability to represent about 16,777,216 different colors using RGB combinations. The computer then reads these RGB values and renders the corresponding color to the screen.

  • Images and Videos: If you've ever zoomed into an image far deep before, chances are you start to see the image as a collection of square dots. We say the image begins to pixelate. This shows us that images are made up of many square dots of different shades of color. Videos are also just multiple images the are quickly shown on the screen to give an illusion of motion. This is why we talk of videos in frames per second(fps). The faster the images flash on the screen, the better the video quality. So videos are just images, and images are just a collection of color, which are just a combination of RGB number values that can then be stored in the computer in binary form. You can imagine the huge amount of data present in a video. This is why videos tend to have large file sizes.

Now, a good question you can ask yourself is, How does the computer then know that these series of 1s and 0s represent a number or text or color? Good question. Well, this is where file extensions come in eg .docx for word documents, .xsl for Excel files. Computers use these files extensions to determine the context in which data is stored and what it means. In a text file, it knows to represent data as text. In an excel file, for example, it knows to represent numbers as numbers so calculations can be performed on them.

Conclusion

Programming is all about solving real-world problems using code. These problems usually take the form of Input -> Processing -> Output. Computers use 0s and 1s to represent all the data it uses from simple numbers to videos. This possibility of representing various forms of data in a computer is the basis of why the computer is so useful in the world today. Programming, therefore, is about manipulating these different forms of data to produce the desired output, whether it be a chat app like Whatsapp or a video streaming service like YouTube, or a photo-sharing app like Instagram, Snapchat.

In this first article, we have mainly looked at the input part of solving problems in programming. In the next article, we'll dive into the Processing aspect which is the meat of Programming. Hope you'll stick around for that one.😎