A New Chapter
Take cover! Preparing for the Facebook timeline switchover
Programming Should Have a High Barrier to Entry.
05 Mar 2012
Last week I was alerted to this article by my colleague Chris Marsh. The article concerns a study which revealed that a well-established programming language Perl is no more intuitive to novice programmers than one with randomly generated syntax. Ignoring for a moment the fact that the code sample used in the study to demonstrate Perl was a fairly unfriendly piece (simple but not written with much clarity – as a developer I would not be happy to see such a piece of code), I take issue with the article itself. It is clearly written by someone who doesn’t understand computer programs, and that’s fair enough as it’s on a design website. The assumption made throughout the article is that if programming languages were designed with a “nicer” syntax then more people would be able to program computers. To an extent this is true, but would they be able to program them well? Programmers are logical people who are able to think like a computer. Therefore the syntax of most programming languages reflects that. What the above study refers to as “novice programmers” almost certainly aren’t just novices, they are non-programmers. If they had any interest at all in programming then they probably would have made an attempt at it in the past. Those in the study stated that they hadn’t. However some potentially capable programmers might not have had the opportunity, but these were students who surely would have done. The difference between a programmer making their first forays and a non-programmer is important here. A person who has the logical mindset of a programmer would not struggle with the syntax and structure of mainstream programming languages in the same way as someone who has no interest in programming might. Furthermore, anyone who does have trouble with it would certainly have trouble with the concepts and mental techniques needed for good programming. A programmer has to understand both the abstract concepts behind software engineering (objects, classes, design patterns etc.) and the way the computer is actually working behind the scenes. If they don’t understand these concepts, they won’t be able to produce the robust, maintainable and efficient code that is required and their work may actually do more harm than good. So even if programmers can understand abstruse syntax and non-programmers have no hope, why not design the languages to be “easier” anyway? Well in most cases that I’ve come across, making things easier makes them harder to do quickly or efficiently. Take general examples of computer use such as editing files. Graphical interfaces and task-specific software such as word processors and spreadsheets make it easy for people to open a file, make changes and save. But what if you want to make the same change to hundreds or thousands of files? To do it through the “easy-to-use” software means opening each individual file, making the change and then saving it - a process which could take hours or even days. On the other hand, a command-line guru could tap out one or two commands which may look like gobbledegook but which achieve the entire operation in a fraction of a second. Likewise, a programming language designed to be understandable by non-programmers would actually be frustratingly inefficient for programmers to work in. Even the simple looping example given in the article comprises twice as many lines for the “understandable” version as the traditional language version. The article does acknowledge that geeks (by which I presume it means programmers) “would no doubt see [using fewer characters] as more efficient or precise”. Efficiency is one thing (the traditional one is more concise and hence quicker to write, if not execute) but to use the term precision in such a throwaway manner highlights the misconceptions here. Precision is absolutely vital to programming. Logic demands that things are either one thing or another. They can’t be vague or imprecise as natural language can often be. It just won’t work. Don’t get me wrong. I recognise that everyone needs to start somewhere. I personally took my very first tentative steps into programming using the LOGO language which allows patterns to be drawn by sending simple commands to a moving “turtle”. There is a place for programming languages which more closely mirror their natural language counterparts and that place is the classroom. Making the language less scary is fine whilst the fundamentals are being taught, but it’s far more important for programmers to understand the how and the why of what they’re doing than the syntax. What are your thoughts? Please leave them below or on Twitter -@Dan_D_Martin