# Which of the following programming languages will help me better to teach the basic concepts of CS and why? [closed]

I'm really looking for opinions from experts

I have been asked to teach a group of students “How To Program”, these students are really new to programming.

What I want is to make them like programming and enjoy doing it (as I do), so which programming language should be used to teach them, in order to achieve that goal?

The students are about 17 to 22 years old, and there are 25 students in the group.

My background lies in 9 years of programming experience. I had used many programming languages like C++, Java, VB.NET, C#, JavaScript, PHP, Swift, Python.

• Welcome to Computer Science Educators! Quite an interesting question. Aug 8 '17 at 22:15
• What are you actually trying to teach? A programming language is a means to teach a concept. What concept are you trying to teach? If you don't include a concept, I think this question is both primarily opinion based and too broad. Aug 8 '17 at 23:22
• For what it is worth, the language isn't the most important thing. For example, I would simply hate to have to go back to programming in my first language, though I love to program in general. Focus on the teaching, not the language. Aug 8 '17 at 23:22
• I've voted to close this question because as it stands it's simply a language popularity contest. Please keep in mind that close is not the end of the road for the question. If you'd like help fixing it so it can be reopened, please stop by our question help chat room. Aug 8 '17 at 23:34
• @Ali Even if you have received a helpful answer, I would consider it a personal favor if you came by Guidance to help us fix the question anyway. We've been discussing it, but there's no way to re-open the question without some more input from you. The problem is that if the question is on-hold for long enough, it will eventually get automatically deleted by the system. :( I want to find a way to preserve it so that it will have value for future visitors as well!
– Ben I.
Aug 9 '17 at 15:41

Of the languages you mention knowing, I'd recommend Python.

• You know it. This naturally applies to the other languages in your list, but there are other languages that would also be candidates if you knew them. It's certainly possible to learn a language and teach at the same time, but best to avoid it if you can.
• It's succinct. You want them writing code, not boilerplate. It'll be simpler for them to learn to understand code logic if every line is actually doing something meaningful instead of just existing to fulfill syntactic requirements.
• It has a REPL environment. The ability to do easy interactive debugging and testing of individual lines quickly will make it easier to try things out early on.
• The annoying "whitespace is syntactically significant" thing, while pointless and occasionally counterproductive for experienced programmers (who would already be formatting things correctly) is actually a good thing for beginners who need to be trained in proper indentation.
• Simple GUI (and other) Libraries. Anything that lets them see the results of their coding on the screen as quickly as possible will help get their interest. And GUIs are hardly the only libraries available; chances are anything they want to play with has an associated library out there. You want to get them writing real (albeit simple) code instead of toy programs, so they can get excited about it.
• Support for functional programming. Not the first thing they'll be doing, but an advantage of Python over dedicated teaching languages that were never intended for practical use is that the advanced features are there once the students are ready for them. They can learn the basic syntax, then start playing with, e.g. list comprehensions, then move on to a fully functional style (when that's the best approach) when they're ready for it.
• Free, portable and open source. No need to tie them to a specific platform if you don't have to. This also makes it easy for them to work on projects at home one whatever hardware they have available.

• No real low-level facilities. Python won't teach them about memory management, pointers, etc. They'll need to switch to something that does eventually (I recommend C for that), but that can be the second language.
• No variable declarations. This is going to be an annoying source of bugs for beginners as well as experts; if you misspell a variable you're writing to, it'll just assume you're declaring a new variable and silently do just that. Python could really benefit from something like Perl's use strict.
• Poor scope resolution and visibility mechanisms. In, e.g. C, you can have variables that are global, local to the file, local to the function, or local to the block. Probably in part due to its lack of explicit block delimiters, Python doesn't really have that kind of granularity; everything's either global or local. And since it doesn't declare its variables, there are positions in the code where a write to a variable will have local scope but a read from the same variable would have global scope. Python 3 has improved this somewhat due to the introduction of nonlocal scope.
• Python 2 vs Python 3. Python 3 is the better language, but since it broke backwards compatibility, sometimes you have to choose between Python 3 and a library you want to use. Less of an issue with beginners than it is in real practice.

I would also strongly anti-recommend PHP and Java; the former was put together in a very hackish manner and will teach them bad habits, and Java is a full-on new BadHabitFactory().createBadHabit().getInstance().getHabitSet() generator.

• IMO, the lack of low level stuff is not necessarily an issue. It's important at some point of course. It's good for theoretical stuff (knowing how a computer works), but for a new programmer it's not a practical thing. Aug 8 '17 at 23:28

Depending on your relationship with the students and their general level of background, I'd say you might consider one of the two following options.

(a) The language you know best. Then you won't be struggling with the language and how to use it, and can focus on the teaching of it.

(b) A language that you don't know at all. Then you can use a discovery style of working with the students to discover together how to program in that language.

with option (b), instead of you showing them how to do things, you can have the students show you.

With either method, however, keep in mind that the most important thing is not what you do or say, but what the students do. Your lectures (if you even do that) are far less important than the exercises that they do.

If you aren't already an experienced teacher, I suggest a lab based system in which students are encouraged to work together and to ask a lot of questions. Active students will learn. Passive ones won't.

It isn't really about whether one language is better or worse.

My recommendation is Python, and I want to make some points from the student´s perspective.

• Python is simple and understandable. Since they do not have to learn everything at once, for example, assigning values to a name (variable) will be very easy.
• You need very few requirements to start (in a GNU/Linux distribution, you actually do not need anything to get started). And, as a plus, they can start coding in the Notepad or gedit, where they will actually learn the language and not be dependent on an IDE.
• You always get more motivated if you can build useful things with the language that you are learning. For example, for the last part of the course, consider using tkinter for creating simple forms and menus, with just a few lines of code.
• With Python, you can emphasize how important is to have a clean and readable code.
• There is a lot of documentation and help online, and with a lot, I mean a lot.
• Welcome to Computer Science Educators! Aug 8 '17 at 23:08
• I think this is a decent answer, but it doesn't explain why Python is any better than other common scripting languages, such as Ruby, PHP, or Perl. Aug 8 '17 at 23:13
• Thanks @EllenSpertus, looking forward to be an active member in this site. :D Aug 9 '17 at 16:45