Take the 2-minute tour ×

As this question is closed, let me do an attempt that actually meets all 6 requirements.

At our faculty, there's for the moment a big change in the classes "informatics". We used to teach Java, but this is going to be replaced with Matlab (and the class will be called "Scientific Computing"). Personally, I'm not in favor of that idea, because :

  • Matlab is not freeware, hampering the possibilities for the students to get hands-on experience. They can on campus or via VPN, but not on their own computers.
  • Matlab isn't even a real programming language, but a mathematical environment that excells in that but fails in anything else.
  • Matlab isn't suited for general concepts of programming.

edit: these last two points seemed a bit strongly formulated. Matlab has progressed quite a bit since I last encountered it.

Now I also had a problem with Java, as that turned out to be a real pain in the proverbial behind for many students, mainly because of the verbosity.

As it's for a general course in programming, I think these points are important :

  • all basic concepts of programming
  • rather easy syntax without too much verbosity
  • the possibility to easily program both procedurally and object oriented
  • a short feedback loop on your programming
  • a proven usefulness in many applications, especially in the scientific world (bioPerl, bioConductor, bioPython, bioJava, ...) so they can be used for practical work during their studies.

What's your idea about the best teaching language on a serious level (hence not the pseudo languages used in primary or secondary school, I'm talking bachelor level at university/college)?

edited to keep the question more general.

Originally I mentioned R, Python or Perl, and :

R is maybe less of a good choice as that one is a vectorized language. This is far from general, so it might be too specific. edit: I consider it a blessing, but the argument here was that a vectorized language is not general enough for teaching purposes as people would get into trouble when moving to Perl and Python. I'm also not talking statistics education, we're talking students of level 1st bachelor. Any direction, any kind. I just added the personal experience.

share|improve this question
I was hoping you could explain what you mean by verbosity in Java. Thanks. –  johnny Dec 6 '10 at 16:28
@johnny : class myfirstjavaprog { public static void main(String args[]) { System.out.println("Hello World!"); } } -- in R : print("Hello World") . Well... –  Joris Meys Dec 6 '10 at 16:33
There's a matlab clone -> Octave that works pretty well and it's free. –  aggietech Dec 6 '10 at 16:43
verbosity in Java: List<String> myList = new ArrayList<String>() as apposed to def myList = [] in Python or Groovy. –  Eric Wilson Dec 6 '10 at 17:00
For scientific programming, there's also Maxima, see an example here. –  Trinidad Dec 6 '10 at 19:47
show 10 more comments

closed as not constructive by Thomas Owens Jun 25 '12 at 17:35


6 Answers

up vote 5 down vote accepted

If you are going to teach them how to program regardless of what it will be used for, then start with a programming language that is easy to understand. Ruby or Python seem like the best option right now. They are simple in their syntax, very popular, and fairly new which guarantees they'll be available for quite some time. They can also use them for websites and webservices with frameworks.

No one really uses Basic or QBasic anymore and C while being the best in my opinion to teach a deep understanding or programming (memory management, stack, pointers, objects with C++, structures, etc.), it's too complicated and also "verbose".

I was taught OOP Pascal when I started and I wish they had started me with functional programming before telling me that everything needs to be an object. I didn't grasp the difference and the advantages and disadvantages until years later.

share|improve this answer
If you think that C is too verbose, I wonder what do you think about Visual Basic :-) –  Konamiman May 4 '12 at 7:31
Why do you feel that newness of language helps ensure it will be available for some time? –  Tshepang Jun 25 '12 at 17:47
@Tshepang All languages are created with a purpose in mind, the older the language the older its purpose is. Newer languages have new features and methods, so as long as they are popular and widely used they will remain relevant for some time. Until a new one is created that makes it a lot easier to do/create something. –  Marlon Aug 27 '12 at 14:53
add comment

From the shortlist I vote Python.

Interesting alternatives (that I have at least some familiarity with) include Object Pascal, Modula 2, Ada, C#, Scheme, Objective CAML, F# and Haskell.

I disagree with duros - I use C++ every day and I used C for years, but I don't see C-family languages as a good first choice. That includes Java, C# and Python - when you learn about pointers, it helps to make the pointer operations as explicit as possible - not hidden in the form of Java-like implicit references. For pointer stuff, I suggest a Pascal-family language first. Verbosity will be at least on a level with Java, though, and the lack of garbage collection is significant (not necessarily a disadvantage, but significant either way).

C and C++ I'd reject on weak typing issues - implicit casts, which aren't always a good thing for learning in particular. Also, there's oddities like int *x, y; (y is an int, not a pointer-to-int) which can confuse. The comma operator probably catches everyone when they write their first switch statement, not to mention forgetting break. And C++ is just a huge language, with nice features true, but also with some real nasties.

The one thing that might make me rethink that - Visual C++ Express Edition is free (in the beer sense) and very good. So good that you might want to consider it for running-in-the-debugger-as-a-teaching-tool reasons. The same applies to Visual C# Express Edition, of course.

Most alternatives have issues in terms of convenient libraries. Python, Perl, Java and .NET languages (C# and F#) are hard to beat for that. Ruby probably belongs in that list, but I'm not very familiar with it. You may be able to work around some library issues for other languages by providing a "distro" of ready-built libraries with some automatic configuration, but this may involve quite a bit of work. For example there are libraries for just about anything for C++, but it takes a bit of research to select libraries, make builds of them that can link together compatibly, tell your tools where to find each library and so on. You can solve that to some degree with a "use Linux" policy, but the range of languages that get serious library support in Linux repositories is limited.

Haskell in particular requires a very different skillset to more conventional languages, so should probably be disqualified unless you're are looking to teach that particular skillset. Other functional languages I've mentioned may also be rejected for similar reasons, though Objective CAML and F# are very plausible exceptions, capable of doing everything that conventional imperative languages can do with not-that-different syntax, but adding a range of tricks from the functional toolkit. F# also has the benefit of access to the .NET libraries.

Perl, I'd reject simply because I don't like the language - not entirely for subjective reasons, but I still wouldn't want to have to defend that position.

So - Python probably still gets my vote, but a Pascal-family language is probably better for learning pointers (Free Pascal or GCC Ada) and Objective CAML is a very interesting alternative (as is the closely related F#).

share|improve this answer
add comment

When teaching well educated adults programming as a cross-curricular thing, ie. science majors, maths majors, I find that it sinks in best if you approach it from a position they are comfortable with.

Introducing programming via a language orientated to the sort of tasks they face like Mathematica, R, etc, with real world problems that they are aware of the methods to solve the issue and are aware of the need for a computerised solution. That way they tend to see the point of it, the transition is not overly confusing and they start to learn basic programming concepts via a form of osmosis.

If they need to do something more complicated, then they can step up to something more traditionally broad in scope a lot easier than if they started there.

Failing that, pick an easy to read, forgiving language with good feedback when you have made errors and easy debugging. Students get put off by a long road to results, instant/quick gratification is key to retaining enthusiasm.

share|improve this answer
add comment

How is a vector-based language a bad thing?! Especially if you're teaching beginners, you should focus on getting things done rather than worry about loop indices. Plus, R already has math and statistics routines built-in, which is exactly what you want in a "Scientific Computing" course.

If you have your heart set on Python, at least use the SciPy / NumPy libraries. These will give you math routines as well as present a vector programming interface.

share|improve this answer
I use R daily, I know SciPy / NumPy, I'm talking general education, not statistics. –  Joris Meys Dec 6 '10 at 16:41
add comment

You're talking about a pretty specific environment, i.e. solving complex scientific or mathematical equations. I don't see where teaching the class using a general computing language (java, C#, etc) would be that beneficial, as they're not going to have the required syntax or library functions you're going to need. I don't see where teaching a particular language (or environment, like MathLab) is going to be a problem. Don't most IDEs or environments offer student pricing?

Sorry, the question led me in the direction of that specific environment, if you're talking about a general computing environment, I'd go with teaching what is currently dominating the market to give them a feel for what is out there. I think thats currently either Java or .Net

share|improve this answer
that's the personal touch I have to give to prevent this question getting closed. I mean very open, we're bio-engineers and bioPerl, bioJava, bioPython are all used in other courses. I just happen to sit in the statistics/mathematical department. But I consider that a wrong approach to teaching general informatics to freshmen. –  Joris Meys Dec 6 '10 at 16:46
add comment

As someone coding in Matlab on a daily basis as a researcher in biology, I do have to ask: What makes Matlab "not a real language" in your opinion? Its history of being good for numerical analysis? Because Matlab does fit all the requirements on your list, and the disadvantage #1 can be taken care of with a good set-up of the license server (I don't need VPN in order to use a license at home).

Anyway, I guess that, in the end, the choice of programming language should really depend on the goals of the class. If what you want is give the students an idea of what they can do with programming, Matlab is great, because it's easy to write code, easy to debug, and the documentation is excellent. Python (with SciPy/NumPy/matplotlib) could be an alternative, but is a bit harder to get into than Matlab.

If this is an introductory course for "general programming", after which they go on and learn a lot more programming, Matlab is not such a great choice, because students will not have learned to do declarations, they'll know nothing about pointers, and because they'll still start counting at 1.

share|improve this answer
@Jonas : the problems you give are known to others as well, R to start with. I just learnt that Matlab can do some kind of object-oriented programming, which is cool actually. Honestly, I'm not too familiar with matlab, as I mainly use R. Matlab is too limited for my analyses in the sense that it just lacks a lot of methods implemented in R packages. Plus, I can't get it coupled to Java, the stringwork in Matlab is not too obvious to me either. Most important: with R I can develop solutions for customers with GUI without having to ship it with a very expensive package. –  Joris Meys Dec 6 '10 at 18:51
@Jonas : regarding the licenses, we can't just let 200+ students put matlab on their computers, can we? And that's only one faculty. –  Joris Meys Dec 6 '10 at 18:55
@Joris Meys: regarding licenses: IIRC, you can whitelist MAC addresses for concurrent licenses, so you could install Matlab on students' computers, and it would run as long as they're whitelisted, and it would stop running as soon as they're done with the course. The alternative is to link authentication to network logon, but this requires VPN. –  Jonas Dec 6 '10 at 19:20
@Joris Meys: Obviously, R is more powerful for statistics, which is why there is a Matlab-to-R connector, so that you can call R from Matlab. In Matlab, you can trivially link to Java (you can call java functions on the path as you would call Matlab functions), since the Matlab UI is written in Java, anyway. Finally, I don't know what you mean with stringwork: You can do regex, if that's what you mean. Re:Shipping code, yes, that's probably the main disadvantage. Fortunately, the researchers I collaborate with have access to Matlab. –  Jonas Dec 6 '10 at 19:25
@Joris: your prejudice against MATLAB is due to your own unfamiliarity. I have seen this all too often. Sorry. –  rwong Dec 7 '10 at 5:58
show 5 more comments
