Learning to Code… but first; what is programming?

The terms programming and coding are often used interchangeably. Programming is the more formal way of expressing the term, but what exactly does it mean? Wikipedia defines a programming language as…

an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms.

Wikipedia then goes on to delve into the depths of what programming languages are, how they emerged prior to the invention of computers and then evolved into what they are today. I say ‘they’ because there are thousands of programming languages, with more being added every year. Lets examine what the definition means;

  • Firstly a computer language is an artificial language. It’s not a spoken language so don’t expect to pick up a copy of The Wall Street Journal written in Java or Scratch any time soon.
  • Secondly the language must be able to communicate a set of instructions to a machine. Computers are good at following instructions, that is what they do best, but there needs to be some set of rules by which humans and computers agree upon.
  • Another point that I would add is that, upon completion of whatever processing a computer undertakes to perform the instructions, the programming language must enable it to give feedback, such as the answer to a question posed.

kidcode

 

What’s the difference between a program and a programming language?

When you use a program on your computer, like Internet Explorer, you communicate with it by typing in the web address you’d like to see, and the program then provides feedback to you by displaying the web page. The program in this case is Internet Explorer, which was created by programmers at Microsoft using some programming language. The programming language defines the rules for how the program communicates with the computer. This communication is a translation process, taking a request of something that the user wants, and translating that request into a set of instructions that a computer can understand.

A computer can’t yet think for itself. It can perform instructions very fast, but only if those instructions are written in numeric terms. To be specific, those numeric terms need to be binary terms (ones and zeros are the only two numbers that can be used). At a high level, any computer program works by taking user requests and translating those to a predefined set of instructions that are then further translated into smaller and smaller atomic pieces until finally there is a string of bits (binary digits).

Going back to the Internet Explorer example; there is a chain of communication and interaction that needs to happen to turn your request to view a web page into the ones and zeros that a computer understands. When you type a web address in your browser, the browser can figure out what it needs to do because the browser program has been given a set of instructions for what to do, which the computer can understand because the computer ‘speaks’ the programming language that the browser program’s instructions were written in. This notion of separating the request from the details of how the request is performed is called abstraction. This is a core concept of all learning, not just for computers. Learning ‘how to learn’ is a great skill to pick up, and abstraction facilitates that.

How about a real world example?

Lets disregard the whole concept of computers for a moment and consider a shopping trip. What are the set of instructions that need to be understood and then performed in order to accomplish the desired result? Perhaps there is a shopping list of things that are needed, perhaps there are some items which have constraints, such as a particular brand or maximum price. A typical shopping trip for me might be written something like this:

  1. Drive car to shop
  2. Drive car home to get wallet
  3. Drive car to shop again
  4. Park car, enter shop and acquire a shopping trolley
  5. Push trolley around the shop and select the items on shopping list, putting each one in the trolley
  6. Take all items out of the trolley to be scanned and payed for
  7. Put all the items back into the trolley
  8. Push trolley to car and transfer all items to car boot
  9. Return the trolley to the trolley bay
  10. Drive home and unload the car

This list sounds a bit over the top, having 10 steps when what would really be written down is just a shopping list (as used in step 5 of the instructions above). If I really wanted to expand the list so that nothing is left to chance and everything is explained with specific instructions then I would include sections on how to drive the car, or how to use a credit card to pay or how to decide which brand of each item is the best choice for selection. My point here is that we all use some level of abstraction every day – there is an implied understanding that if I ask you to do something then you understand how to perform all the ancillary activities associated with the task. The rules of understanding how to perform the task I have asked of you is essentially what constitutes a programming language. The task itself is the program.

What is the best programming language?

The answer to this is that it depends on the task at hand. The question of “best programming language” was best explained by Dan Grossman in his Programming Languages course on Coursera. He put it like this; there is no “best car” only the best car for a given purpose. If you need to go off-road then a Porsche is a pretty bad choice, but if you want something flashy and fast then maybe that Land Cruiser isn’t going to cut it. In the same way there is no best programming language, just the best fitting programming language to suit the task at hand.

 

binarydigitdivider

 

So Far on ‘Kids that Code’

Share This

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.