Teaching Programming: What’s the Best Language for Beginners?

By Chris Ward
We teamed up with SiteGround
To bring you up to 65% off web hosting, plus free access to the entire SitePoint Premium library (worth $99). Get SiteGround + SitePoint Premium Now

teaching programming

Like many of my age and generation, I started learning to program with BASIC. These were the days when you bought magazines full of pages and pages of code for games or basic applications. You spent hours with your friends painstakingly typing these programs into a computer to find there was a typo, or the game didn’t work, and then giving up. It was more about hanging out with your friends, whilst your parents felt like you were learning something.

BASIC had flaws, but one thing I liked about it was that the code was clear and verbose. This is why programs took pages to do anything. There is little chance of any language released now having such “wonderful” syntax as (including mandatory line numbers):

5 LET S = 0
10 MAT INPUT V
20 LET N = NUM
30 IF N = 0 THEN 99
40 FOR I = 1 TO N
45 LET S = S + V(I)
50 NEXT I
60 PRINT S/N
70 GO TO 5
99 END

(Thanks to Wikipedia)

But you must admit that, for a beginner, it’s clear what’s happening.

Years later, I learned “modern” programming via a series of languages including PHP, Lingo, C++, Visual Basic and Java. I’m sure we covered Object Oriented programming, but mostly I remember it being procedural. This wasn’t helped by my years working with Drupal, which didn’t have solid OOP concepts until version 8.

Fast forward to the present and some of my motivations for this post. For the past months I’ve been teaching programming to recent Syrian refugees in Berlin, and our language of choice has been Ruby (and Rails).

Is Ruby the Right Language to Teach to Beginners?

Laying aside a recent growing exodus of programmers from using Ruby (that’s a whole other story), we (the teachers) are unsure if it was a good choice. The Ruby community is amazingly supportive and welcoming, and that makes many students succeed in learning to program through sheer perseverance and the support of the community.

However, we’ve noticed that some of the characteristics of Ruby that attracted experienced programmers are actually obfuscating and confusing. I don’t want to turn this post into a “Ruby Bash”, because that’s not what it’s supposed to be. I like Ruby, and it’s not the only language that has these problems. My recent experience teaching it to absolute beginners has meant that I have practical examples to illustrate my point(s). I also acknowledge that some of these learnings might be due to teaching the wrong topics in the wrong order, or unlearning some of the common tasks experienced programmers undertake, at least in the short term.

Shortcut Tools

Programmers are a little bit lazy — or, to be more accurate, we like to find ways to reduce repeatedly typing the same boilerplate and instead focus on the important and unique parts of a project. With Rails, scaffolding does just this; with a handful of commands you can have the underpinnings of an MVC application.

But these tools can completely confuse beginners. They don’t understand what was just created, and why, where or how it fits together.

Shortcut Syntax

To an experienced programmer, writing this …

(0..100).each {
  print i
}

… instead of this …

var i;
for (i=0;i<100;i++) {
  print i;
}

… is an amazing and sensical shortcut. In fact, it’s efficient: there’s no need to initialize a variable or write all that horrible semi-colon separated syntax. But think about it from a beginner’s perspective. In the Ruby example, the only words that really make sense are each and print. What are the rest actually doing? It’s not to say that a student can’t learn these concepts, but in some respects, whilst learning, the second example is clearer and actually shows a student what’s happening.

“Do what you like” languages

At one time, there was a trend towards languages that let you write casually — not having to worry about variable types and so forth. This popularity seems to be waning — or at least, is increasingly being supplemented by much stricter languages. These have advantages of speed and efficiency, but I do wonder if it’s also a case of changing trends. Languages that force you to make certain linguistic steps may take longer to learn, but there’s less “grey area” around what is and isn’t possible.

The Real World of Work and “Take Homes”

Often, we’re keen to get students onto the most useful and “real word” concepts and practices as quickly as possible. Many contemporary “learn to code” programs are strongly focused on getting participants “work ready” and placed in jobs. I could (and may do) write an entire post about some of the issues with these programs, but in short, they can introduce students to concepts they may not be ready for. Based on my recent experience, some of the more notable ones are as follows below.

Object-Oriented Programming (OOP)

OOP is a fundamental concept for many modern programming languages, but often is taught straight after learning complete basics like variables, logic and loops. Students have barely come to grips with what a program even looks like and then are thrown a massive curveball.

OOP is one of those concepts that makes far more sense in advanced applications. When writing basic programs, it seems an unnecessary and extraneous complication. Teachers can throw around terms and examples built on solid comparisons — such as animals and vehicles — but the practical need and application are still hard to grasp.

Version Control

Version control is similar. If you’re working with a team on a large project with regularly moving and changing parts, then it makes perfect sense. When you’re working alone or in a small team, it can feel like an over-complication. Git is wonderful, but remembering its workflow is a pain — where missing one step can throw things into disarray, and merging for the first dozen times is a confusing process.

Great, Chris, but What Do You Suggest We Do about It?

Good question. It’s easy to criticize, and who’s to say I’m even correct? First, I want mention a tip or two that I’ve found useful in teaching coding, and then try to get some crowd-sourced feedback on what languages people feel are good for beginners and why.

Assume nothing

You’ve heard this before, I’m sure, but I want you to try taking it a stage further. Here’s a little soundbite for you:

If you assume nothing, there is nothing to lose.

Well, you may lose some time, but not that much. In practice, this means you shouldn’t assume anyone has heard of your favorite build system / language / IDE / editor, or assume that anyone has any of the same experiences as you. Just because you think they should have, doesn’t mean they have. Of course, if you ask first, then go ahead — but do check.

People are generally OK with a little repetition if it’s needed. If they understand something already and have to listen to it explained again, they probably won’t mind, and may even catch something they didn’t know previously.

Context

This is a big one for me. Coders are often great at explaining that something is cool, but not so good at explaining why. When educating people, don’t just mention what it can do faster, better and bigger than before, but also why that is good for them or for you. They’ll listen, learn and remember far better.

Community

At the risk of sounding contradictory, some languages (especially Ruby and Python) have amazing communities that try hard to nurture beginners. These communities may not make the languages any easier to understand, but for those who stick it out, they will find it easier to expand and sustain their knowledge. Most importantly, more supportive communities help reduce exposure to noxious influences who may put of a beginner.

The Best Programming Languages to Learn

This is where you come in, dear reader! I’d like to hear from you what languages you think are the easiest to learn and understand. I also want to hear why you have that opinion. And if you have any experience of teaching them, what have you found?

In a couple of weeks, I’ll gather these stories and write a follow-up article, providing a balanced examination (with beginner assistance) of the true accessibility of these languages and how best to teach them.

I’m sure you also have opinions on some of what I’ve written here, and that’s great. Please, when sharing your views, try to be constructive and see things from a beginner’s perspective. Thanks!


If you enjoyed this article, you may also like What’s the Best Programming Language to Learn in 2016?

We teamed up with SiteGround
To bring you up to 65% off web hosting, plus free access to the entire SitePoint Premium library (worth $99). Get SiteGround + SitePoint Premium Now
Login or Create Account to Comment
Login Create Account