What is Coding? When we code, we inject our human wisdom into the machine via written instructions in order to automate the steps and tasks required to solve a problem.

Coding is about addressing a problem in three phases.

  1. We think about the steps to solve the problem.
  2. We convert these steps into a language that the computer can understand.
  3. The computer interprets the code to perform the steps.

We can think of the ‘program’ as a ‘recipe’.

Let’s take a real-world problem – frying eggs.

We’ve bought have a uh.. egg frying machine that we want to teach to fry eggs. To do so, we need to code in the steps.

We jot down a quick recipe.

Ingredients

  • 2 Tbsp. oil
  • 1 egg
  • Pinch of salt

Process:

  1. Add oil to the frying pan
  2. Wait until the oil is heated
  3. Break the egg and add to pan
  4. Add salt to taste
  5. Making sure egg does stick
  6. Remove egg from pan

Now, I want you to look at this recipe as a "program", rather a program for humans in a language we understand.

Executing this program is the equivalent of us following the recipe.

Coding is basically rewriting a sequential set of steps in a way a computer is able understand.

There is however a key different between humans: Computers are unable to freely interpret ambiguous steps. For example, we will need a definite temperature input in order to know once the oil is heated and ready for our egg.

In pseudo-code (a way to describe a program in plain English.), this would look something like this:

If Oil is Less Than 185 Celsius Break Egg Then Add Yoke

In addition, some of these steps have a duration such as when we move the egg to make sure it doesn’t stick.

Again, in pseudo-code, this might look like this:

While Egg Not Cooked Stir Egg

It is also up to the coder to ensure the program is able to handle failures at various stages of the recipe.

If Egg is Added and Oil is Not Heated increase Temperature

If Egg is Burnt Decrease Temperature Then Remove Egg

In my opinion, the beautiful aspect of coding is being able to solve everyday problems.

Much of what drives technological advancement is the speeding up or streamlining of activities that form our daily human experiences. Electronic mail and instant messaging have replaced handwritten mail in many situations and our homes are filled with countless appliances to make life easier.

I want to emphasize this aspect of coding in relation to problem-solving.

The skill in coding lies in how best to accurately describe a solution to a problem into series of sequential steps.

Most human activities can be abstracted into "flow charts", which is a great way to start visualizing and thinking like a coder.

Taking something as mundane as waking up in the morning and turning it into a sequential series of steps might look something like this:

data/admin/2020/11/LifeActivitiesAsAFlowChart2.png

We now have a clearer idea of the actions and conditions that make up this.. unfortunate daily exercise. I'm just going to circle those.

data/admin/2020/11/LifeActivitiesAsAFlowChart_annotated2.png

  • The various 'actions' are indicated by an A and roughly correspond to something called a Function in coding. Functions are blocks of code that perform a single action.

  • We also have conditionals, conditionals are expressions that evaluate to either TRUE or FALSE. They are used to determine the flow of the program.

  • Variables in coding are used to store information required for the program to work - variables, as the name suggests, can be modified. We can see, for example, that we have a variable containing a time value of 5 minutes.

That's almost it as a very basic level.

Coding is making sense of the sequential flow that leads from a starting point to a finishing point. Within that flow, you need to accommodate for unusual or unexpected situations using conditionals.

Are Programming Languages like Human Languages?

Like the English, French, and Spanish we use every day, a coding language does have a sort of syntax, a set of standard rules that are comparable to linguistic grammar.

However, how are we defining language? Our human languages are very much alive, and we use them to socialize with friends, buy train tickets, make appointments. Coding, on the other hand, is principally used to build software that does stuff and do not, currently, evolve organically.

Is Coding an Art or Science?

From a pure scientific point of view, coding as I describe above is a logical thinking operation. You can almost apply the same fixed logic to all programming languages, what changes is the syntax.

The subject of Computer Science mostly falls under the scientific departments at universities.

Art could refer to the design of the program, such as the ease and attractiveness of it's User Interface but software design is it's own discipline. Designers and coders are often two separate roles at companies.

But referring back to code itself, you'll be surprised to know that there is actually a sort of artistic expression to found within the lines of code.

Like any language, there are multiple ways to express the program and code can be made more or less efficient depending on the skill of the programmer. Code itself can be arranged into more beautiful patterns and no two developers with code in the same fashion.

Final Thoughts

So the essence of coding comes down thinking logically.

Question: Is learning to program suitable for my children?

Ans: Absolutely! The Extraordinary Benefits of Teaching Young Children (under 5) to Code