Web
Article

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

By Chris Ward

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?

  • http://rafaelstz.github.io Rafael Corrêa Gomes ♛

    Thank’s

    • Chris Ward

      And thank you!

  • Florie Guibert

    Hi Chris. Great article.

    The language I was taught basics with is Ada. I never used it professionally, but it was great to understand programming principles. Error messages are extremely clear which is great when you don’t have experience with common syntax mistakes for example. It doesn’t give much freedom about how to write something, it’s strongly typed and I think it really helps giving young coders good practices. We moved to OOP very quickly after that with Java but I didn’t feel like it was so big of a steep, I wanted to learn more so badly. I struggled a lot with system programming but the way it was taught was pretty ridiculous in my opinion, no one could make sense of it.
    Also, I’m not sure the language is what matters most when teaching coding for the first time. We wrote a lot of algorithms on paper and even though it seemed ridiculous at the time (I wish paper would compile…), it actually forces the student to think about what the code actually does instead of being bothered by the IDE because the syntax is incorrect.
    Well that’s my personal experience and opinion, hope it helps.

    • Chris Ward

      I also learnt ‘pseudo code’ at uni and found it super useful. Adding Ada to my list to try.

      • Florie Guibert

        Yeah that’s the word I was looking for, we did that on paper a lot at the beginning just to learn principles.

  • Chris Ward

    Fantastic answer, thanks. I have tried Go, but will add it to the list again :)

  • Chris Ward

    Another great answer, thanks so much. I agree with most of what you say, lots of great feedback for a follow up :)

  • Mike Cunneen

    Scratch, or Snap BYOB, are without any doubt the best for absolute beginners. Students can discover new concepts, and “see” them in action, without having to learn or remember syntax.

    • Chris Ward

      Exactly, I am very keen to try those.

  • adaivanoff

    HTML isn’t a programming language but it’s a nice start for anybody who is new to the concept of code as a whole. When I switched to IT after a couple of years (and 2 degrees) in non-tech areas, HTML and simple Linux shell scripting were the first things I got some idea of. Later at uni I was on a special plan and I had mostly C to learn (in greater detail at that :))) but the regular students studied the basics of C++ (or C#, not quite sure) and Java mainly (C was considered too difficult and PHP was deemed as easy enough to learn on their own). Pseudo code would have been great, but nobody taught it. These is for uni students but for a group of beginners from all ages and all walks of life, the easier the language, the better.

    • Chris Ward

      We have been thinking about HTML next time, then CSS introduces some nice structural concepts and finally you can add JavaScript.

      • adaivanoff

        You got me thinking on the question of the best language for beginners and here is some more. :)

        WordPress is also a good option. The WP community is also helpful – at least this is what my impressions are. Maybe WP is even better than HTML (and CSS) alone because it includes them both plus obviously PHP. HTML, CSS, and JavaScript is also a good cocktail to start with, especially for more design-minded students.

        The first time I saw an ad for a WordPress course I wondered what the point is – if you know HTML, CSS, PHP, JavaScript why bother with a WP course? Then I realized such a course teaches all these but from a WP perspective. Such a course will also help to sort out the students who are more inclined to design than to programming – after all not everybody is born to be a coder, some are better as designers than as coders. They can continue with design-centered courses, if the facility offers them.

        You don’t mention what the purposes of the course are but I presume the goal is to teach them something in order to help them get jobs and get on their feet. In this case I think it makes more sense to concentrate on stuff with practical value than on who can write the most complex algorithm in the most difficult language.

        Also, it matters a lot not only WHAT you teach but WHO you teach. It makes a huge difference if you are teaching a group of engineers or a group of students who have no inclination to maths and tech at all.

        As a kid I used to be a teacher in English. I was teaching mostly adults (some of them had grandkids my age!) and these are very different from pre-puberty kids or from highschool kids.

        With adults discipline in class is not a problem but there are many other problems not present with kids. For instance, one of my students was joking when I gave them huge homework, I should call her family to tell them they again would be left without dinner because of me – i.e. instead of cooking dinner for them, she would be busy writing this huge homework I gave her.

        With adults the dropout rate is higher. While parents make their kids attend classes, with adults this isn’t so. Just a few absences because of business trips, held at work, family matters, sickness, or whatever, and a student has missed a lot from the course and can’t go on. In some cases more than half of the group dropped out before the two- or three- month course was over.

        I don’t know if in your case it isn’t mandatory for them to finish the course – dead or alive. If it is, this is the worst. The ones who are lagging behind drag everybody else; the ones who are doing well get nervous because of the slow ones and it gets really tense. I had a group or two when a company paid the course for its employees and they had to finish it no matter what. It was very painful for them and for me – endless repetitions, endless corrections of mistakes, such as “He no here”, “You comes”, etc., and endless joy when the course was finally over. :)

        Students’ motivation is very important. If they are learning programming because they have genuine interest in it, they can learn anything, nothing is too difficult. But if they are learning it because they need the certificate at the end of the course, for without it they will lose their refugee status, or might get fired/denied promotion (as was the case with my students), then no matter what you teach them, they won’t learn much.

        In your particular case I see two more problems – the language barrier and possibly their living conditions. If they are not fluent in English, German, or whatever natural language you are teaching them in, this is a huge hurdle to understanding even the simplest programming concepts.

        As for living conditions maybe I imagine they live in hell and maybe I’m wrong but if they live in refugee camps like the ones I see on the Net, I wouldn’t call this normal living conditions. They can’t get sleep, they have nowhere quiet to hide and do their homework, maybe they even don’t have access to a computer they can use when they need – this isn’t a normal living and learning situation.

        Only the fact they are in a foreign country is stressful enough. I lived in Germany for a couple of months (couldn’t take it more than this, I basically hated the country) and even though I got very special treatment as a very valued professional, I simply couldn’t stand it there. The reality was worse than even the worst my friends had told me before I went there. I was starving because I couldn’t eat most of German food and I was like a ghost in the office. I was very inadequate and I was making the dumbest mistakes I would never normally make. For most of my friends the beginning was also rough – aside from the food, they had nowhere to live, missed their families, etc., and they were constantly telling me it’s pretty normal to need some time to adapt and become productive. If your students are in a similar situation, this seriously hurts their learning potential.

        All these make me think in your particular case it’s even more important to go with an easier language. If there are students who do well, you can always give them personal extra assignments. This is more work for you, but they will benefit for sure.

        Alternatively, if it is a longer course, you can come with a mix of languages. My personal choices would be a little bit of HTML, PHP, and Java/C#, probably some DB – just to get a taste of them. What they learn will not be enough for a real life job. This they will do in a second course targeted at the language they chose after the initial intro course. At the end of the first course the dropouts are filtered, which drastically improves the learning experience in the next levels and allows you to focus on more complex stuff.

        I meant it to be a much shorter comment but it didn’t happen. :) Anyway, I hope these thoughts will help anybody in a similar situation.

        • Chris Ward

          I recognise some of your other points here, but I may not address them all here ;)

          The language is a very good point though, we were teaching in English because more people understand enough of it than German. But we are dealing with complex concepts that involve english words that you are unlikely to have encountered and are weighted with semantic meaning. We are also teaching a different culture, where we are used to saying we don’t understand or have a problem, other cultures don’t do this so easily.

          But I really like your WordPress point. I spent most of my first years coding Drupal. This taught me a lot of joined up concepts very quickly. It also taught be some bad practices (or unique paradigms) and meant I didn’t learn some other important concepts quick enough. But still, as long as you get some awareness of other technologies around it, I think it’s a solid starting point. WordPress added to the list!

          • adaivanoff

            Sorry I got carried away – I could write much more. :)

  • Kevin Nagurski

    I started with Turbo Pascal, but it was actually Java that really made things click for me. The good thing about Java was that it does a nice job of introducing the fundamentals of C-style languages. If you can grock Java, you can read C, C++, C#, PHP etc etc etc. The real problem with Java is that the setup, compilation etc is super unfriendly for people just picking things up. PHP is a great option for new devs to learn programming; it has pretty much all of the fundamentals, is pretty simple to setup and is very forgiving.

    BUT, it’s hard to look past Javascript, especially ES2015, for getting up and running extremely quickly. No server to install, no compilation tools required. All you need is a good modern browser and optionally a text editor. ES2015 adds classes that, although we all know are just sugar on top of the prototype, are pretty much inline with what you’d see elsewhere. Plus there’s of course the fast feedback loop… tell a noob to type in `alert(“JS is cool”);` into the dev tools in Chrome and they’ll be hooked.

    • Chris Ward

      Pascal! I forgot about that… I also learnt Java quite early on and have never found it as complex as some others do, well to get started with it anyway.

      I would also second PHP, OK it’s not the best or coolest language, but it’s clear and easy to deploy etc etc…

      Then yes, JavaScript, that immediacy is hard to beat when it comes to maintaining student attention.

      All noted for testing.

  • Donatien LORET

    I began to learn Java almost 2 years ago but soon switched to Javascript as it’s less and less confined to front end Dev and more and more full stack. It seems moreover more useful to a lonesome guy learning the stuff for tooling or small apps. Javascript can even be used with Microsoft office now. Its utility is growing (my opinion)

    • Chris Ward

      It really is, we also have to bear in mind teaching languages that will be useful to learners, for work etc.

  • Chris Emerson

    Clojure. Barely any syntax to learn!

    • Chris Ward

      Really? I guess I assumed it was aimed more at advanced users?

      • Chris Emerson

        I should say as well – I think it’s perhaps tricky to get your head around when you are used to a non-functional language, but there is nothing difficult about the concepts in it – it’s just very different. I have seen in a few places that it would be a good candidate for a first language, but didn’t have it as a first language myself so who knows? It’s something I’d love to find out though.

        • Chris Ward

          I shall investigate!

Recommended

Learn Coding Online
Learn Web Development

Start learning web development and design for free with SitePoint Premium!

Instant Website Review

Use Woorank to analyze and optimize your website to improve your website to improve your ranking!

Run a review to see how your site can improve across 70+ metrics!

Get the latest in Front-end, once a week, for free.