You’ve heard a lot about coding recently. Your children have mentioned it often. And you don’t want to admit, certainly not to your children, that you’re not *really* sure what it is. How about programming? You’ve heard of that too, somewhere.
Computer coding is a form of communication. (Although there is a subtle difference, for most purposes programming and coding are exactly the same thing*.) In the same way that languages are used to communicate with one another, programming languages are used to communicate with computers. We want to get computers to do stuff for us, anything we desire (almost).
Most users of computers (which includes smartphones etc…) only interact with software — computer programs that were written by programmers to allow the user to perform certain tasks. Under the hood, unseen by the user of the software, each button that is pressed or menu item that is clicked runs several lines of computer code that get the computer to perform the task that the programmer meant to happen when you press that particular button. For many computer users, using software that is available on their computer / tablet / phone, or ones they can buy or download for free, is sufficient to meet their daily needs.
But for many more, it is not. Hence learning to write computer code enables you to get the computer to perform tasks that are specific to your needs, tasks that no software that you can buy can do. As a research scientist I have written computer code to analyse data I have obtained from my experiments — no software could do that for me as what I was doing was novel. As a business owner I have also written my own program to manage my client list: allocating each client as either a 1-1 student, a course attendee or a school; performing specific tasks depending on which type of client they are; logging lessons held and what topics were covered in each lesson; and more. By writing my own software I could get the program to do exactly what I need for my specific business requirements.
There are many similarities between spoken languages and programming languages, but also many differences. Let’s look at some of these:
Both have words that have certain meaning, and a grammar that is required to put these words together into meaningful ‘phrases’. In coding the grammar is called syntax and the phrases are lines of code.
Coding is very strict with its syntax (grammar) — miss out a single punctuation mark and the computer will complain. However this is not as annoying as it seems — there are tools to help us with this when we code.
Knowing the meaning of words and the grammar is not enough to communicate effectively in both types of languages. When trying to explain a difficult concept to an audience, structuring your thoughts appropriately is important before choosing the right words and grammar. The same is true with computer programming. In fact a common pitfall is to think that learning to code is about learning a programming language. It isn’t. Programming is about learning how to structure your ideas in a way that a computer can understand; learning to think like a computer.
And finally, for a key difference: computers are very powerful but dumb. We need to explain everything carefully, making sure we don’t miss any steps. When humans communicate with each other, we take many things for granted based on experiences we have gained throughout our lifetime. We cannot take anything for granted when communicating with a computer. A frequently used exercise often used to illustrate this point is the sandwich making one (read this blog post if you’re interested in trying this out: http://bit.ly/28L0h8k)
To finish off, here’s what a very short computer program looks like (in Python, one of many programming languages). Copy and paste it here: https://repl.it/languages/python3 and press run to try it out.
day = input("What day of the week is it? ")
if day == "Friday":
print("Hurray, the weekend is starting")
print("Back to work now!")
*OK, so you’re curious what that subtle difference I mentioned between coding and programming is. Here’s the brief version: coding is the ability to write the correct words and grammar in a specific programming language; programming is the ability to structure your thoughts and think like a computer.
This post was originally published here: https://laurelleafnetworking.com/2016/06/23/coding-stephen-gruppetta-codetoday-co-uk/