How to choose the first programming language (Java, Python, JavaScript, Pascal, C#, R, MatLab, Haskell) for introduction to programming code classrooms.
Articles
December 1, 2021

Which programming language should you teach first?

In 30 seconds...

Picture this: you have a classroom full of students, eager to learn and ready for their first coding course. Where do you begin? Choosing which programming language to teach is not an easy task, and the answer is complex. 

But, fear not! This article outlines some key questions to think about before picking a programming language and paradigm. Should it be Python, Java or C#? Or maybe even a functional programming language like Haskell? Find out more below.

This article is not only directed to anyone who’s designing a new introductory programming course or CS program, but also to anyone who is currently teaching a programming course, and thinking of modifying it.

Designing an introductory programming course for students is not an easy task and an important decision you’ll have to make is picking which programming language to teach. As with everything in Computer Science Education, there are many different views on this. In this article I will try to combine these and inevitably add one more view to the mix.

Before starting, let me tell you a little bit about my background. My formal education is in Computer Science, where I have also worked as a teaching assistant for a couple of years, mostly teaching programming to CS-majors. Currently, I’m CEO at CodeGrade, allowing me the pleasure and opportunity of working with coding educators globally. On a daily basis, I work with them and consult on their courses. This hopefully gives me a broader perspective of coding courses in higher education in a wide variety of settings.

In this article, I’ll try to compose four questions that you should answer when selecting the programming language for your introductory coding course, but also, importantly, the programming paradigm.

What is a programming paradigm?

A paradigm for a programming language classifies the concept, methodology and features a language has and how programs written in this language should be programmed. There are two distinct paradigms: imperative and declarative. Within the imperative paradigm you have, for instance, procedural languages where instructions are grouped into procedures (such as C) and object-oriented languages (such as Java, C++, Python). Within the declarative paradigm, where you declare the properties of a program but now how to compute it, you have the functional programming languages (such as Haskell, F#) and logical programming languages (Prolog). Many languages also support multiple paradigms.


Source: somethingofthatilk.com

1: Who am I teaching?

The first question you should ask yourself is what your target student group is. Different student groups have different learning goals and thus need different types of education.

Broadly speaking, I generally see two different target groups. CS-majors (this is specific to higher education) and non-CS-majors (this is usually still higher education, but could also apply to K-12, and hopefully more and more coding education will happen at the K-12 level).

If you teach prospective IT professionals, the choice of paradigm and programming language is perhaps of less concern. As in most Computer Science degrees, students will (and I think should) learn multiple programming languages and paradigms. Different perspectives make a better problem solver and a more dynamic programmer. To give students a deeper perspective you want to pick a strongly-typed programming language, forcing them to think about typing from the get-go.

If you teach students from non-CS majors (or K-12), the goal is generally to give them an introduction in the world of computing and they often only have one or a couple computing courses. In this case, the choice of programming language might become more important. One example is that you might want to teach students a language that will help them in their future careers. For instance, when a learner needs to automate something simple which could be easily done by writing a Python script.

Another reason could be that students study a field where coding plays a supportive role, such as in the Biomedical Sciences or Physics. In that case you’d probably want to teach the students a language that’s useful in that field. Good examples of this are (again) Python, MatLab / Octave or R.

Teaching Python, Java, JavaScript, C or any other language? CodeGrade will help you design the best course for any programming language!

2: What are the learning objectives of an introductory programming course?

Next, we want to look at the concrete learning objectives that an introductory programming course should have. For this let’s turn to research done in the field.

Du Boulay (1986) (and Vujoševic-Janicic, 2008 expands on this) mentions five domains that students should learn in an introduction to programming course and these are still relevant to this day:

  1. General orientation: learn what programs can do.
  2. The notional machine: learn the abstract model of how the computer can execute programs.
  3. Notation: learn the syntax and semantics.
  4. Structures: learn how to structure basic operations into schemas.
  5. Pragmatics: learn the development cycle; plan, develop, test, debug, document.

These skills are mostly independent of the programming language or paradigm chosen. But, different programming languages can make learning the specific domains easier or more difficult. 

One of the main reasons for this is that programming languages are, generally speaking, not designed to be easy to learn or understand. They are designed to develop software in an efficient (whether for the programmer or execution time) manner.

Of course, special “teaching languages” also exist and keep being designed. One already ancient-sounding example of this is Pascal. But, most curriculums still decide to teach “real-world” programming languages. I think that’s for good reason: a real-world language helps you in applying the knowledge you learned in your further career and is generally more future proof with its large user base. You don’t hear anyone talking about programming in Pascal anymore…

Another advantage of using popular real-world programming languages is that there are many more resources available to both teach and assess students. Which we’ll look at later on in this article.

The most popular programming languages

The most popular programming language today, according to IEEE, is Python, closely followed by Java and then by C, C++ and JavaScript.

Looking at the job market, it’s a very similar story. Python is ranked number one, followed by C, Java, JavaScript and C++, making these five programming languages good contenders to pick as the language to teach, at least from a usability and career perspective.


3: What are the challenges?

Now that we know the main objectives of teaching an introductory programming course, we can look at challenges that arise from them, particularly focused on paradigm and programming language design.

Syntax is generally the biggest hurdle. Beginners make a lot of syntactical errors and will, therefore, also spend a lot of time interacting with the compiler or interpreter (Vujoševic-Janicic, 2008). A programming language with easy-to-understand syntax is desirable. The learning results in a coding course also heavily depend on the amount of time students actually spend programming (Palumbo, 1990). In order to maximize this, don’t waste time on complex syntax and irrelevant language constructs (Grandell et. al., 2006).

Important in solving this challenge is choosing the abstraction level of the language. The higher the abstraction level, the farther away from the actual machine it is, and, generally, the easier the language is to use. There is a consideration to make here, however. If you remember objective number 2 from the first section, it is also important to teach students how the computer can execute programs, especially when teaching CS majors. The real question here is: should this be the subject of the first programming course? Not necessarily!

Another challenge that might arise is difference in prior knowledge for students. Especially in CS-majors, there’s a big difference in prior coding knowledge between students. This might lead to a plethora of issues, such as the course being too challenging for students without pre-knowledge or not challenging enough for students with prior knowledge, wrong or poor prior knowledge (think Dunning-Kruger effect), etc. In this case, consider avoiding imperative paradigms and opt for others such as functional programming, which levels the playing field as it tends to be new for all students. Examples of functional programming languages are Haskell and F#. Keep in mind the difficulty of the syntax here, as Haskell is notoriously quite difficult to grasp.


Source: xkcd.com

For non-CS majors, you probably want to stick to an imperative programming paradigm as they will typically only be taught one programming language and learning an imperative programming language is the most useful for them in their future careers.

4: How can I teach and assess my students?

Now that we’ve gone over all these considerations and we know who we are teaching, what the learning objectives are, and what the challenges are, we can look at the teaching and assessment part, before making a final decision which programming language we should pick.

In terms of teaching materials, most popular programming languages have many resources available to teach them effectively. For the content of the course, you can, for instance, choose to use a book with exercises in them, build your own content or use content you find online.

It’s important that students can also practice with the materials, especially at the start. It’s beneficial for students to have exercises and assignments available. For this, again, you can either build them yourself, or get prebuilt content from a content developer or the internet. To most effectively teach your students, as programming is a skill that is learnt by doing, it is important to give your students immediate feedback to keep them motivated. This can be achieved in classroom settings and with code learning platforms such as CodeGrade (excuse my biased opinion).


Source: xkcd.com

So, which programming language to pick?

So far, we’ve talked a lot about how the course should look like, what its objectives are and how to teach and assess students. This should give you the handles to pick a programming language for your coding course.

There are some obvious picks, though, that probably won’t hurt. For non-CS majors, Python is always a good choice. For CS-majors, you can still pick Python easily as it’s a nice teaching language, but you could also go for similar (object-oriented) languages that are strongly typed such as Java or C# (if using Windows). In case the course is more web-oriented, you could even go for JavaScript, but then in that case I would pick it’s brother TypeScript (as it’s strongly typed).

What are your recommendations and which coding language do you teach? Feel free to drop me an email at youri@codegrade.com.

Bibliography

Ali, A., & Kohun, F. G. (2009, June). Considerations for selecting a programming language to teach prospective teachers. In Proceedings of Alice Symposium.

Du Boulay, B. (1986). Some difficulties of learning to program. Journal of Educational Computing Research, 2(1), 57-73.

Grandell, L., Peltomäki, M., Back, R. J., & Salakoski, T. (2006, January). Why complicate things? Introducing programming in high school using Python. In Proceedings of the 8th Australasian Conference on Computing Education-Volume 52 (pp. 71-80).

Palumbo, D. B. (1990). Programming language/problem-solving research: A review of relevant issues. Review of educational research, 60(1), 65-89.

Vujoševic-Janicic, M., & Tošic, D. (2008). The role of programming paradigms in the first programming courses. The Teaching of Mathematics, 11(2), 63-83.

Continue reading

How to automatically grade R assignments

Streamline R Assignments with Automatic Grading in CodeGrade

Watch now! Efficient Grading with AutoTestV2!

Discover how AutoTest V2's streamlined grading and instant feedback transform the grading process for educators.

You're invited! Join our AI Assistant webinar

Discover CodeGrade’s AI Code Assistant! Join our webinar on Nov 20 with Professor Brian Brady to explore AI’s role in authentic code learning and skill-building.

How to automatically grade SQL assignments

Learn how to set up SQL assignments with CodeGrade for efficient assessment and feedback.

Sign up to our newsletter

See how CodeGrade can transform your courses today!