The Trick Of The Mind - Little Languages Arithmetic |

Written by Mike James | ||||

Monday, 07 March 2022 | ||||

Page 1 of 3 This introductory chapter of my new book on the nature of programming is aimed at programmers and non-programmers alike. In this extract we look at one of the "little" languages - not a full programming language but interesting. ## The Trick Of The Mind - Programming & ComputationalThoughtBuy Now From Amazon Chapter List -
Little Languages Extract: Little Languages Arithmetic -
The Strange Incident of The Goto Considered Harmful Extract: The Goto Considered Harmful -
The Loop Zoo Extract The Loop Zoo Extract Advanced Loops -
Modules, Subroutines, Procedures and Functions Extract Modular Programming -
Algorithms Extract: Binary Search Extract: Recursion ***NEW!! -
The Object Of It All Extract Why Objects
<ASIN:1871962722> <ASIN:B09MDL5J1S> Once you have the essential idea that a set of static texts can actually be something dynamic when read as a set of imperative commands then you have the main idea of programming – the rest is practice and familiarity. Of course, the few commands that we have introduced are not enough to do everything we could possibly want, but it is a start. There are some key concepts that we need to tackle to get to the full capabilities of a programming language. In fact, because the programming language that we have met so far is so restrictive and simple it is often referred to as a "little language" or, in more recent jargon, a Domain Specific Language, DSL. Most full programming languages have a number of little languages within them. For example, the drawing language that we have introduced is often part of a bigger language, most notably Logo, but also Python and others. Little languages are interesting because they show what an essential component of algorithmic thought is all about, but this isn’t the whole story. Almost as important is the fact that little languages turn up in contexts that have, seemingly, nothing to do with programming at all. Arithmetic is one such example and many of the problems that are encountered with learning to do it properly are because it is rarely acknowledged that it is a little language. ## Arithmetic as a Little LanguageOne of the most commonly encountered little languages is arithmetic, or more accurately arithmetic expressions. When you write 2+3*4 (most programming languages use * for the multiplication sign) you have written a program that tells someone how to perform some arithmetic, i.e. multiply 3 by 4 and add 2, to arrive at the answer 14. Notice that in this case the order in which you have to do things isn't the order in which the instructions have been written. This makes arithmetic a slightly more sophisticated language than Turtle Graphics. If you thought that the instruction was to add 3 to 2 and then multiply by 4, i.e. answer 20, you have identified the reason you have been finding arithmetic difficult. It is this out-of-order nature that make it so difficult for children to get to grips with arithmetic at first. It is also the initial connection between the field of mathematics and programming and why an ability in mathematics is often associated with programming. Arithmetic notation is a special little language and the first formalized little language that we generally meet in the real world. How well you take to understanding arithmetic, and later and more importantly algebra which is just arithmetic with symbols, is a good indicator of how easy you will find programming. Sometimes, however, it works the other way. Only after understanding? the fact that arithmetic and algebra are just other little languages do some people suddenly see the light and are able to "do math" – a spin-off advantage of learning to program. Of course, they can’t suddenly do math as arithmetic is a small part of the whole, but it is a big step in the right direction. To be clear, mathematical thinking doesn't stop at arithmetic, but it does start with arithmetic notation. That is, you might not be able to do the additions and the multiplications, but if you can read and understand the little language that is arithmetic/algebra you are on the way to being a mathematician.
In this sense arithmetic is also the first programming language, albeit limited, that most people meet. Arithmetic is so important to programming that it is worth going into more detail about how it works. |
||||

Last Updated ( Monday, 07 March 2022 ) |