Coding Basics 3-Part Series: What is a Computer Program?
By Tech Elevator Instructor Walt Impellicceiri
[PART 1] In this 3-part series, I’m breaking down the foundation of computer programs. We will focus on what they are and how they are made.
A computer program is a set of instructions that a computer executes to perform a task. The key part of that definition is, “to perform a task.” We’re constantly using our computers to perform tasks. Think about all of the things you use your computers for over the course of a day. Tasks may be simple, like a calculator adding two numbers. They may be complex, like voice recognition and transcription.
Programs may execute once and then stop altogether, or they may be running on an ongoing basis. Let me break that down with a couple of examples. When I use voice to text, a program starts, I talk, it transcribes, and then it stops. This is a one-time execution. On the other hand, my Alexa is running on an ongoing basis, constantly listening for a key phrase that will trigger her next move. Interestingly, her next move is often to run yet another computer program that executes the task I requested.
Computer programs are often referred to by different names, like software, or applications (apps). Many of us have hundreds of programs stored on our laptop, tablet, smartphone, and/or smartwatch. While you’re reading this, there are probably dozens of programs executing on your device. Personally, I’m constantly using Chrome and Safari for web browsing, and lately I’ve been using Slack and Zoom for chatting with students and coworkers. Have you ever wondered how those programs were created?
Well, computer programs are written by software developers. In truth, however, what is written by developers is typically different from what the computer executes. When a developer is writing a program, they are writing in a form of code. This code is called source code. Frequently that code is transformed into machine code (code that your device understands) by something called a compiler. Funny enough, the compiler is also a computer program that was written by software developers. See below for a view into this workflow.
Once a program is generated, it can be shared with the world via any number of mediums – publishing it to the Cloud or to an App Store for download, putting it onto physical media like a CD or USB flash drive, etc.
What I left out earlier when discussing a program is that it usually has inputs and outputs. In the case of an adding calculator, the inputs are two numbers. The output is one number, the sum of the two inputs. Recall that there are a set of instructions that the input is passed through in order to determine the output.
Let’s consider a case where I want to write a program that will produce a pizza. This pizza program would have inputs of pizza dough, sauce, toppings, a heated oven, and time. The output would, of course, be a pizza.
The instructions that would take our inputs and generate the output would be:
- Stretch the dough
- Apply the sauce
- Apply toppings
- Put the uncooked pizza into the heated oven for the specified amount of time.
- Remove from the oven, slice, and enjoy!
Recall that instructions for a program are written in source code. The instructions above aren’t written in source code, but in theory they could be. We could build a robot that constructs pizzas. So, you may be wondering what source code is and how you go about writing it. Check out part 2 of this series to learn more about source code.
Good luck on your coding journey. If I can help with anything along the way, feel free to drop a comment below.
Walt graduated from the University of Pittsburgh with a degree in Computer Engineering. He has spent the last 10+ years developing applications for companies in the healthcare, retail and education industries. He leads instruction at Tech Elevator Pittsburgh.