Intro to Programming: What is Programming?

Welcome back to our Intro to Programming article series! 

In this article we're going to talk briefly about what programming is and the various steps that it usually involves. Don't worry too much if you don't understand some of the details, as we will revisit each of these in more details throughout the article series.

In practical terms, programming is the practice of writing computer code to solve problems. It is a process that generally has several parts to it. I want to emphasize even at this early stage that computer code is almost like a living thing: it's never actually finished, it's never quite done changing and evolving. It evolves with the business or the problem it aims to solve. Similar to living things, it sometimes falls sick (catches "bugs") and requires medication ("bug fixes"). It also needs to be maintained in order to continue to function properly. As such, the steps we will outline below are often times repeated.

Problem statement

We begin with the problem statement. This is the phase where programmers will define the problem they are aiming to solve and understand the desired inputs and outputs of the program. For example, if the problem is "build a calculator", in this phase, a programmer will ask a number of clarifying questions, such as:

  • what kind of operations should the calculator handle? is it only addition and subtraction? is it also multiplication, division, taking the square root?
  • should the calculator only work with whole numbers as inputs or should it handle fractions also? how should the calculator handle wrong input? (for example, if the user asks the result of 2 + "what's for breakfast"?
  • should the calculator output only the result or should it output the mathematical notation, so something like 2 + 2 = 4?
  • how should the calculator handle unexpected errors? (trust me, these happen quite frequently and need to be addressed)

 

It is important that the scope of the problem is clearly understood by all parties, otherwise unpleasant surprises may arise.

Design

The second phase of programming is a phase of design. Here the programmers will spend time analyzing multiple possible solutions. For easier tasks, this can be done mentally, but for more complex problems, programmers will always use old-fashioned tools like pen, paper or a white board.

The purpose of this phase is to think through possible solutions for the given problem before investing a lot of time into writing code. As you'll learn, writing code is an expensive task, and the more you can do upfront to minimize code that you'll have to write or throw away, the better.

The design phase for complex problems often exposes trade-offs that can be made to achieve better performance, or lower costs, therefore this phase, like the problem statement phase often involves members of the team who are not programmers, but who are very familiar with the business.

Writing computer code

The third phase involves the actual writing of the computer code. In this article series, we will focus heavily on giving you the skills required to write computer code, however, we will also focus on design and problem statement where necessary. Writing the computer code is, perhaps surprisingly, not always the most time-consuming phase. As you gain more experience, you will start to see patterns and you will become much, much faster at it.

Sometimes, the part that takes the longest is the next phase: testing and debugging.

Testing and debugging

Testing is probably obvious: we need to make sure that the computer code we wrote meets the specifications we agreed on, that it solves the problem we clarified during the problem statement phase and handles the agreed-upon inputs and outputs.

Testing simple programs is generally a fairly easy task. Testing programs that have complex dependencies, can easily become a fairly involved task and some companies have entire teams dedicated to testing alone. Still, as a computer programmer, you'll always have to do some testing yourself, but this task should not daunt you. With more experience writing code, you will become better and faster at testing too.

Part of testing is debugging. You may have heard this term and it has an interesting historical origin.

Computers in the early days were, as you probably know, massive machines that occupied whole rooms. They also often stopped working (the modern technical term is crashed) and sometimes that happened due to literal bugs or other insects that would get lost inside the computers and mess up with the circuitry. 

The process of finding said bugs and manually removing them (and thus resuming normal operation of computers) came to be known as de-bugging. Today we (hopefully) no longer have to deal with physical bugs inside our machines, however the term still applies to the practice of identifying the cause of issues with our computer code.

So, coming back to our calculator, if we wrote the code for it and when we ask it to calculate 2+2 it outputs 5, the process of finding out why that happens is the process of debugging. We have several tools for doing this and we'll cover them throughout the article series.

Deployment

Once the computer code is written and tested, the next phase is that of deployment. The process of deployment involves packaging your code and distributing it to a remote location (a server etc.) where users can access it.

In larger companies, often times, specialized teams handle the deployment phase because programmers may not have access to critical infrastructure, for security reasons. Smaller companies are generally different in that they don't have the means to afford a dedicated deployment or infrastructure team, so programmers will usually deploy their own code.

Deployment involves knowledge of particular infrastructures which are beyond the scope of this article series. However, I want you to be familiar with the term, as you will often hear it.

The phases we discussed are often repeated several times, as new requirements are added to the initial problem, or as new bugs surface while the code is being used by other people. This is why, it is generally a very good idea to take your time and think through your solutions thoroughly: it will save you a lot of time in the long run.

In this article, we talked about what programming is and what are its various phases. Thank you for reading! In my next article we will begin our exploration of the Python programming language.

Read the next article in the series >

 

Read next

This is Why Data Scientists Make So Much

This is why Data Science salaries are so high.

How to Learn Programming Faster

In this blog post, I will share some of my tips for how to learn programming faster.

3 Reasons Why You're Not Too Old to Learn to Code

Here's why you're never too old to learn programming.