Computer Programming’s Updates
What is Programming? How Programming is equivalent to Real-life Activities
In my Programming Language post, I have explained Programming Language is a way we use to communicate with computers. In this post, I will show you how we actually communicate with computers and how equivalent it is with Real-life activities.
“Programming is problem-solving” — Prof. David J. Malan
𝗔 𝗯𝗿𝗶𝗲𝗳 𝗼𝘃𝗲𝗿𝘃𝗶𝗲𝘄
Every day in our life consists of many problems that need to be solved. They might be how to solve a difficult math exercise, or even a simple problem such as how to cook a delicious meal for your family, etc. These examples have one thing in common. We have to prepare everything needed and go through a sequence of steps in a specific context with a specific set of tools to accomplish the goal, to solve a problem per se. Programming which needs a fresh mind, and a laptop to go through a sequence of steps trying to make computers do what we asked it to do using a programming language to solve a problem is not an exception. How we solve a problem by following a sequence of steps to accomplish the goal which is called Algorithm
𝗔 𝗱𝗲𝗲𝗽𝗲𝗿 𝗹𝗼𝗼𝗸
𝗖𝗼𝗼𝗸𝗶𝗻𝗴 𝗲𝘅𝗮𝗺𝗽𝗹𝗲
Let’s take a real-life example like the cook-fried-chicken example and go through every single step. Firstly, we need to buy chicken, flour, and breadcrumbs. Next, in the kitchen (we cannot cook in the bedroom, which is why the kitchen is our context here), we follow the recipe in a logical sequence
- Use a big knife not a small knife because it is hard enough to chop chicken
- Marinate the chicken, and impregnate the chicken with flour and breadcrumbs
- Fry the chopped marinated impregnated chicken
Finally, we have a delicious fried chicken. The fry-a-chicken problem is solved
𝗣𝗿𝗼𝗴𝗿𝗮𝗺𝗺𝗶𝗻𝗴 𝗲𝘅𝗮𝗺𝗽𝗹𝗲
Now, let’s take a programming example and also go through every single step. We want to create an application that tells the computer to multiply two numbers for us. First, as I said, we need a fresh mind and a laptop. Then, we define the context of this application by asking ourselves some questions such as “What is the type of this application (i.e. web-based or just simply console-based)?”, “If it is a console-based app, which programming language should I use?”, etc. In this example, the application is web-based, which uses HTML and CSS to prompt us to provide two numbers and display the result, meanwhile, JavaScript is used to do calculations. After the context is defined, we could now dive into a sequence of steps (Algorithm) to create the application or solving a problem per se
- Write code to display two input fields
- Write code to take those input and multiply them
- Write code to display the computed result
Finally, the result is displayed on the monitor. The multiplication problem is solved
Conclusion
At the first look, we might see that programming is that a man sits in front of the laptop doing some magical colorful texting but the essence of it is problem-solving. Even that do-some-magical-colorful-texting guy is trying to solve his problem. Therefore, as Steve Jobs said, everyone should learn how to program because it teaches them how to think.