Non-programmers may not be familiar with the term syntax as it applies to programming. What is it and why is it important in the discussion of kids programming? Syntax is the set of programming language rules for how the computer interprets your code. Every programming language is different. For example, here is the same function defined in Java (on the left) and Python (right):
~code~
The result of the computer’s interpretation is the same, but one is simpler. The Java syntax requires far more semi-colons; curly braces {} and parenthesis (). It also includes some keywords that are not immediately obvious – public and void in this example. But Java is far from the most difficult language for syntax. Here is a simple function in Lisp:
~code~
Look at all of those parenthesis – that’s why Lisp isn’t a language for first time programmers!
Why is syntax important for a beginning programmer, especially kids? It is a barrier to entry. At the same time the student is learning programming concepts and logic, they must remember the syntax requirements to make the computer understand their code. The more brain power devoted to remembering syntax rules and convention, the less for programming logic. The more keystrokes devoted to unnecessary keywords, semi-colons, parenthesis, and braces, the longer it takes to make a program for these beginning students.
Syntax errors are extremely frustrating to a first time programmer. If one of the parenthesis is left out at the end of the above Lisp example, the program would crash with an error. Usually these errors aren’t very descriptive and can be very confusing to an inexperienced programmer. A Washington University professor said it best, “If you forget a comma in your English essay, your teacher doesn’t hand it back and say, ‘I can’t understand any of this.’” Yet that’s exactly what happens in programming!
Breakout Mentors recommends avoiding the burden of syntax early in a student’s programming education. Scratch programming is drag-and-drop, which requires no syntax at all. Python is great for middle school students with little prior programming experience. Java has its advantages (language of most high school courses, Android), but the barrier to entry is slightly greater than Python. Contact us to discuss the right choice for your student.