# What programming language to teach?

**URL:** <https://boards.straightdope.com/t/what-programming-language-to-teach/665992>\
**Category:** In My Humble Opinion\
**Created:** [August 12, 2013, 1:37am UTC](https://boards.straightdope.com/t/what-programming-language-to-teach/665992 "2013-08-12T01:37:18Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Saint\_Cad](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/saint_cad/32/18907_2.png) [@Saint\_Cad](https://boards.straightdope.com/u/Saint_Cad)\
**Post date:** [August 12, 2013, 1:37am UTC](https://boards.straightdope.com/t/what-programming-language-to-teach/665992/1 "2013-08-12T01:37:18Z")

</div>

I just found out I’m teaching a high school Intro to Programming class. The previous teacher used python, but I’m thinking of using Ansi-C or Java.  
In today’s world, what would be a good language for a student to learn?

---

<div class="post-metadata">

**Author:** ![Indistinguishable](https://avatars.discourse-cdn.com/v4/letter/i/90ced4/32.png) [@Indistinguishable](https://boards.straightdope.com/u/Indistinguishable)\
**Post date:** [August 12, 2013, 1:39am UTC](https://boards.straightdope.com/t/what-programming-language-to-teach/665992/2 "2013-08-12T01:39:15Z")

</div>

See recent thread [“What’s the best language to learn programming with?”](http://boards.straightdope.com/sdmb/showthread.php?t=697236), perhaps.

---

<div class="post-metadata">

**Author:** ![Jragon](https://avatars.discourse-cdn.com/v4/letter/j/e19b73/32.png) [@Jragon](https://boards.straightdope.com/u/Jragon)\
**Post date:** [August 12, 2013, 2:07am UTC](https://boards.straightdope.com/t/what-programming-language-to-teach/665992/3 "2013-08-12T02:07:58Z")

</div>

I’d say it depends on the crop of students you’re going to get. If you’re going to get people who aren’t already technologically inclined or just want to be able to make things, go with Python. If the class tends to get people who really want to be engineers or software engineers, or else people who really want to understand programming and the computer go with C. While I have my favorite languages that I think might be best at a purely philosophical, they’re not popular. I think C and Python meet a healthy intersection of having sound concepts and being popular enough to be useful.

I would lean toward Python, upon doing some straw polling and talking to some faculty, I’ve been finding that at a college level people with backgrounds in C tend to drop out or struggle more when exposed to OO languages compared to those that start with Python, Ruby, or C. If you want to do C I’d actually lean towards teaching the more C-like subset of C++ (e.g. treating it as C with Objects). C# may also be a good choice, depending on whether or not you’re already familiar with it.

---

<div class="post-metadata">

**Author:** ![drewtwo99](https://avatars.discourse-cdn.com/v4/letter/d/d07c76/32.png) [@drewtwo99](https://boards.straightdope.com/u/drewtwo99)\
**Post date:** [August 12, 2013, 2:11am UTC](https://boards.straightdope.com/t/what-programming-language-to-teach/665992/4 "2013-08-12T02:11:46Z")

</div>

I vote for Python. It’s a great language to teach as an introductory language, and its actually used in quite a bit of scientific applications.

Java is not a bad choice either, as far as utility goes, but it’s a lot more difficult to teach introductory programming with it.

---

<div class="post-metadata">

**Author:** ![thelurkinghorror](https://avatars.discourse-cdn.com/v4/letter/t/7c8e57/32.png) [@thelurkinghorror](https://boards.straightdope.com/u/thelurkinghorror)\
**Post date:** [August 12, 2013, 2:16am UTC](https://boards.straightdope.com/t/what-programming-language-to-teach/665992/5 "2013-08-12T02:16:40Z")

</div>

1. Something free for the students.

I will guess that students willing to fulfill an elective taking a computer programming class are going to be more computer-savvy than those who choose to take, say, intro to Excel.

Python/C#/VB maybe Java.

---

<div class="post-metadata">

**Author:** ![Jragon](https://avatars.discourse-cdn.com/v4/letter/j/e19b73/32.png) [@Jragon](https://boards.straightdope.com/u/Jragon)\
**Post date:** [August 12, 2013, 2:24am UTC](https://boards.straightdope.com/t/what-programming-language-to-teach/665992/6 "2013-08-12T02:24:47Z")

</div>

One edge I will give to Java over C is the ease of integrating visualization tools. While I don’t like classes that teach Swing to beginners (especially because Swing is kinda bad anyway), I’m really biased towards showing beginners what their programs do. And showing them what they do in a way other than just passing test cases. I do like the idea of essentially having the class write plugins. E.G. write a backend for [Dice Wars](http://www.gamedesign.jp/flash/dice/dice.html), but force students to write the undirected graph implementation that allows the game to figure out who is next to who. This also gets them used to implementing code in somebody else’s framework, so they have to return things in a certain format – not just format things however they feel like it. (And, of course, at the instructor’s discretion additional constraints can be imposed – e.g. you must use an adjacency matrix in your implementations)

Obviously this needs to be mixed up so that students write a few programs with an entry point so they’re exposed to main functions and console interaction like printing, and you have to be careful that they’re not bogged down in your framework. In other words, your framework should rely on their code returning the correct things, their code should have to call your code as infrequently as possible (excepting utility functions that make things easier for them).

I think Python also has relatively simple visualization too, doesn’t TKInter do something similar? (You have to install it separately, but it’s platform independent and easy to set up and work with).

Of course, this all depends on how much time the instructor is willing to spend developing project backends.

---

<div class="post-metadata">

**Author:** ![Saint\_Cad](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/saint_cad/32/18907_2.png) [@Saint\_Cad](https://boards.straightdope.com/u/Saint_Cad)\
**Post date:** [August 12, 2013, 2:26am UTC](https://boards.straightdope.com/t/what-programming-language-to-teach/665992/7 "2013-08-12T02:26:43Z")

</div>

What about Ansi-C to start out then move to Python and Java to give them a taste of the more modern options?

---

<div class="post-metadata">

**Author:** ![Jragon](https://avatars.discourse-cdn.com/v4/letter/j/e19b73/32.png) [@Jragon](https://boards.straightdope.com/u/Jragon)\
**Post date:** [August 12, 2013, 2:32am UTC](https://boards.straightdope.com/t/what-programming-language-to-teach/665992/8 "2013-08-12T02:32:09Z")

</div>

I’d go the other way, start with Python and then move to C to show them what’s going on under the hood. C is cool, but I’d consider managing memory leaks and dangling pointers to be “intermediate”.

---

<div class="post-metadata">

**Author:** ![aceplace57](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/aceplace57/32/3500_2.png) [@aceplace57](https://boards.straightdope.com/u/aceplace57)\
**Post date:** [August 12, 2013, 2:32am UTC](https://boards.straightdope.com/t/what-programming-language-to-teach/665992/9 "2013-08-12T02:32:40Z")

</div>

I’d suggest spending some time on Windows Script Host. Tie it into Python with PythonScript.

I think students would get more out of learning to manipulate windows through scripts. It’s more hands on, practical application that they can actually use outside class.

---

<div class="post-metadata">

**Author:** ![Francis\_Vaughan](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/francis_vaughan/32/3093_2.png) [@Francis\_Vaughan](https://boards.straightdope.com/u/Francis_Vaughan)\
**Post date:** [August 12, 2013, 2:34am UTC](https://boards.straightdope.com/t/what-programming-language-to-teach/665992/10 "2013-08-12T02:34:05Z")

</div>

Yes, It really depends upon what the cohort is, and what the expectations are.

I have had the argument about undergraduate teaching languages many times over the decades. But that argument is about what to teach future professional programmers with. A high school intro class is a very different problem. It reminds me of taking chemistry at high school. I never took it any further. I did take physics further, but my last formal chemistry was at high school. I still use that knowledge in day to day life, but nothing more complex than maintaining a pool, and generally applying simple principles to everyday matters. I don’t earn any money that depends upon professional application of knowledge of chemistry. But there were other students in the class at school who did take chemistry at uni level. I don’t think any became professional chemists, but there were doctors, a biologist, and quite a few engineers in the making.

If you want to give a cohort of students a flavour of what is possible, Python is great. You can do a wide range of interesting things quickly. But if you have aspirations of teaching a set of skills that feed into a career, it might not be the best. But given the level and range of outcomes needed, I would be hard pressed to think of a better language.

As for teaching future professionals, there is no single language. They all have issues and compromises, many of them intrinsic to the nature of their target use. Personally, if I were creating an undergraduate course I would teach a combination of C and Python.

---

<div class="post-metadata">

**Author:** ![Jragon](https://avatars.discourse-cdn.com/v4/letter/j/e19b73/32.png) [@Jragon](https://boards.straightdope.com/u/Jragon)\
**Post date:** [August 12, 2013, 2:36am UTC](https://boards.straightdope.com/t/what-programming-language-to-teach/665992/11 "2013-08-12T02:36:10Z")

</div>

> [@aceplace57](#):
>
> I’d suggest spending some time on Windows Script Host. Tie it into Python with PythonScript.
> 
> I think students would get more out of learning to manipulate windows through scripts. It’s more hands on, practical application that they can actually use outside class.

That assumes all the kids have Windows, though. It’s a decent enough bet, but I’ve certainly known Mac families and even Linux families. It would be a pain to force one or two kids to have to come into the lab to do homework.

Bash scripting is a bit more portable, since you can install environments that interpret Bash on Windows relatively easily (though this is only “relatively” easily, I still wouldn’t recommend making them set up cygwin or msys).

---

<div class="post-metadata">

**Author:** ![ultrafilter](https://avatars.discourse-cdn.com/v4/letter/u/3d9bf3/32.png) [@ultrafilter](https://boards.straightdope.com/u/ultrafilter)\
**Post date:** [August 12, 2013, 4:10am UTC](https://boards.straightdope.com/t/what-programming-language-to-teach/665992/12 "2013-08-12T04:10:46Z")

</div>

The current [AP computer science](http://apcentral.collegeboard.com/apc/public/courses/teachers_corner/4483.html) curriculum is based on Java, and so are most college-level introductory programming classes. As much as I personally dislike Java, I think you’d need a pretty good reason to teach something else.

---

<div class="post-metadata">

**Author:** ![aceplace57](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/aceplace57/32/3500_2.png) [@aceplace57](https://boards.straightdope.com/u/aceplace57)\
**Post date:** [August 12, 2013, 6:36am UTC](https://boards.straightdope.com/t/what-programming-language-to-teach/665992/13 "2013-08-12T06:36:46Z")

</div>

It all depends on the purpose of the high school course. I can see just focusing on introducing programming to teens. Give them some useful skills they can use outside class. Theres no reason to structure the class for CS majors in college. Maybe if they enjoy the class then some of the students may consider a CS degree, but most probably won’t.

---

<div class="post-metadata">

**Author:** ![Francis\_Vaughan](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/francis_vaughan/32/3093_2.png) [@Francis\_Vaughan](https://boards.straightdope.com/u/Francis_Vaughan)\
**Post date:** [August 12, 2013, 6:57am UTC](https://boards.straightdope.com/t/what-programming-language-to-teach/665992/14 "2013-08-12T06:57:16Z")

</div>

The AP course outline includes these words (bolding mine):

> [@](#):
>
> The AP Computer Science A course is compatible with those topics that are taught in a typical CS1 course as described in the example curricula in the ACM/IEEE guidelines. Some colleges and universities may organize their curricula in alternative ways so that the topics of the AP Computer Science A course are spread over the first one or two college courses, with other topics from computer science interspersed.  
> The AP Computer Science A course can be offered by any secondary school that has faculty who possess the necessary expertise and have access to appropriate computing facilities. **The course represents college-level achievement for which most colleges and universities can be expected to grant advanced placement and credit**.

Personally I see this as a problem, not a cure. Unless there is a specific desire to present a course that will garner credit at tertiary level going down the standard CS pathway is the wrong thing to do. It really is a difficult question. It may be that teaching such a CS course at secondary level is what the world should do, but one needs to be quite clear about the objectives that the course provides, and what the students need.

---

<div class="post-metadata">

**Author:** ![Jragon](https://avatars.discourse-cdn.com/v4/letter/j/e19b73/32.png) [@Jragon](https://boards.straightdope.com/u/Jragon)\
**Post date:** [August 12, 2013, 8:19am UTC](https://boards.straightdope.com/t/what-programming-language-to-teach/665992/15 "2013-08-12T08:19:44Z")

</div>

> [@aceplace57](#):
>
> It all depends on the purpose of the high school course. I can see just focusing on introducing programming to teens. Give them some useful skills they can use outside class. Theres no reason to structure the class for CS majors in college. Maybe if they enjoy the class then some of the students may consider a CS degree, but most probably won’t.

Basing wanting a CS degree off a programming course (even AP Comp Sci) is folly anyway. I knew several people who did that who ended up dropping out of the major (or perhaps more accurately: only going for a minor) because CS is so math heavy (and mostly proof-riddled discrete math, which is also incredibly different from high school mathematics). Sure, if you hated your high school programming course CS probably isn’t for you (unless it’s just because you hated your instructor) – but in my opinion high school “CS” courses basically never prepare you for what a CS degree entails.

Now, a software engineering degree is another thing entirely – but a lot of places don’t offer those.

---

<div class="post-metadata">

**Author:** ![samclem](https://avatars.discourse-cdn.com/v4/letter/s/a9a28c/32.png) [@samclem](https://boards.straightdope.com/u/samclem)\
**Post date:** [August 12, 2013, 11:20am UTC](https://boards.straightdope.com/t/what-programming-language-to-teach/665992/16 "2013-08-12T11:20:00Z")

</div>

Moved to IMHO from General Questions.

**samclem** , moderator

---

<div class="post-metadata">

**Author:** ![Senegoid](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/senegoid/32/6606_2.png) [@Senegoid](https://boards.straightdope.com/u/Senegoid)\
**Post date:** [August 12, 2013, 1:03pm UTC](https://boards.straightdope.com/t/what-programming-language-to-teach/665992/17 "2013-08-12T13:03:17Z")

</div>

[FORTRAN](http://www.ee.ryerson.ca/~elf/hack/realmen.html) is as good today as it ever was, and it was good enough for me!

---

<div class="post-metadata">

**Author:** ![Francis\_Vaughan](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/francis_vaughan/32/3093_2.png) [@Francis\_Vaughan](https://boards.straightdope.com/u/Francis_Vaughan)\
**Post date:** [August 12, 2013, 3:38pm UTC](https://boards.straightdope.com/t/what-programming-language-to-teach/665992/18 "2013-08-12T15:38:22Z")

</div>

> [@Senegoid](#):
>
> [FORTRAN](http://www.ee.ryerson.ca/~elf/hack/realmen.html) is as good today as it ever was, and it was good enough for me!

Lordy, I haven’t seen that in a very long time. 😃

But I did get a very harsh reminder of it a week or two ago. Debugging a C++ program written in Fortran IV. It really was. Right down to the author indexing arrays starting at one. Compiled as C++, written as Fortran IV. Worked, astoundingly.

Modern Fortran, in F95 or later form is not a dead language, and is exactly the right tool in some cases.

---

<div class="post-metadata">

**Author:** ![iamthewalrus\_3](https://avatars.discourse-cdn.com/v4/letter/i/258eb7/32.png) [@iamthewalrus\_3](https://boards.straightdope.com/u/iamthewalrus_3)\
**Post date:** [August 12, 2013, 5:56pm UTC](https://boards.straightdope.com/t/what-programming-language-to-teach/665992/19 "2013-08-12T17:56:31Z")

</div>

I’d suggest staying with python.

Python, as an interpreted language, is by far the easiest for beginners. You can just open up the interpreter and start typing in commands!

\>\>\> x = 4  
\>\>\> y = x\*3  
\>\>\> y  
12  
\>\>\> L = [x,y]  
\>\>\> L  
[4,12]  
\>\>\> print “My list has %d elements” % len(L)  
My list has 2 elements

Can’t get more basic and immediately useful than that.

Most kids who are taking a high school programming course are _not_ going to become CS majors. You want to show them some basic concepts without scaring them away with manual memory management © and the One True Object Oriented approach (Java).

---

<div class="post-metadata">

**Author:** ![Pixel\_Dent](https://avatars.discourse-cdn.com/v4/letter/p/bc8723/32.png) [@Pixel\_Dent](https://boards.straightdope.com/u/Pixel_Dent)\
**Post date:** [August 12, 2013, 6:06pm UTC](https://boards.straightdope.com/t/what-programming-language-to-teach/665992/20 "2013-08-12T18:06:25Z")

</div>

I’m going to throw out an oddball to consider. How about Groovy?

It has the advantages of Python in that it is a scripting, dynamically typed language. You can open the groovy interpreter just like the python example right before this post.

However, Groovy is also based on Java. It runs on the java VM, you can type java code and run it as Groovy, and you have full access to all the Java libraries to call from your code.

So you can start with a simple interpreted language and gradually add complexity during the semester until you’re doing full OO code which is Java with improvements.

[Next page](https://boards.straightdope.com/t/what-programming-language-to-teach/665992.md?page=2)
