Best Language for Beginner Programmers? 448
jahardman asks: "I work at a High School that has recently seen a decline in the number of students that want to take our entry level-programming course in Visual Basic. We have been toying with the idea of having the introduction course be in PHP or Ruby on Rails; but are not convinced that they lead well into higher level languages. Does anyone out there have suggestions as to what would be a better language to start students with? Ideally one that might be more 'enticing' as well?"
Re:Java? (Score:5, Informative)
I would NOT touch C++ at the novice level - way too much packed into it. Java is lighter and more modular, which is a better design practice. Teach by example, not just by examples.
Really, structure is more important than syntax. Anyone can learn a new syntax, but if they don't grasp structure, they will never grasp programming. For that reason, even Pascal as a teaching language has its good points.
The programming language D seems to have some of the benefits of C++ and C#, without as much overhead, so that might be a candidate too.
Don't go for over-structured languages like Ada - they're as bad for newbies as the totally unstructured ones. (In fact, either extreme is a mental health hazard to all programmers and should be banned under EPA guidelines.)
Pascal WAS a language designed for teaching (Score:4, Informative)
Python wasn't designed as an educational language. Guido explains [python.org] its origins in the FAQ.
DrScheme (Score:5, Informative)
Java & Eclipse (Score:4, Informative)
Re:Python (Score:4, Informative)
Re:consider Python (Score:5, Informative)
It has a very clean, refined syntax; It can be used equally well as an object-oriented language as a simple procedural scipting language; It is open-source, freely distributed, and cross-platform (so that students will be assured of the ability to install it on their home PC's easily and legally); and while it is easily extended, it has a very useful standard library which will fill the needs of beginning programmers for a few years to come.
Ruby is very similar to Python, and is another excellent choice, although I feel that the documentation for Python (in English, at least) is somewhat better.
Neither PHP nor Rails are good choices for beginning programmers -- while developing web applications is very simple for advanced and intermediate coders, remember that beginners can get into some serious trouble learning a programming language, a query language, and a markup language all at the same time. Perhaps these would be better for a second course.
May I suggest.... (Score:4, Informative)
That you find a book first. In fact - find Head First Java" [oreilly.com] IMHO the best book to teach teens about programming. Next arm yourself with a woman of renown to teach object orientation, namely Alice [alice.org], she will amase you and your teens. Lastly, once they have the basics down after the new year, get them up and running Code Rally [ibm.com] and the winner of the Grand Prix gets extra points towards that grade!!
Sera
Re:consider Python (Score:3, Informative)
While I agree with the statements as posed, I also think that Ruby (as opposed to Ruby + Rails) is an excellent alternative to Python and more generally useful (my experience) than Python.
Python's so quirky with the whitespace (I don't mind the whitespace personally, but I think it's weird to teach it as syntax in a first language).
But then take it with a grain of salt from someone who's moved on from Python to Ruby.
Re:Noooooo! (Score:3, Informative)
Don Box asked before. I suggested LOGO (Score:2, Informative)
Don Box [wikipedia.org] had a simular journal post about which language was best to teach his kids to program [pluralsight.com]. I felt that LOGO [wikipedia.org] was the best choice.
I still feel that way. In fact, to learn to program you really should start with simple text-only (like command line) or path-only (like turtle maps) interface stuff. Anything else requires the ability to think in terms of metaphors that are hard for newbies to grasp. It also helps new programmers learn to program in steps (i.e. design) rather than struggle with the grammar or vocabulary (i.e. one big main function).
Python is the perfect first language for learning (Score:2, Informative)
Python has a free book and pygame (Score:5, Informative)
In addition to that there is pygame [pygame.org]. A set of Python modules designed for writing games. It's really simple and easy to use. I think even beginner programmers wouldn't have much trouble making simple games. I wrote a breakout clone that's only 147 lines, I was going to use it to teach a programming class too. There is nothing complicated in it at all, just a few loops, if statements, some rectangle geometry and negating numbers. Elementary, really.
I think Python fits the requirement, more so than any other, for a language "that might be more 'enticing' as well."
technically, php is a 'higher level language' .... (Score:1, Informative)
Re:consider Python (Score:2, Informative)
Early on being able to directly interact with the interrupter is very useful.
Due to Python's high level nature programs can be written with very few lines of code allowing students to focus on what they want the program to do without the language getting in the way.
Re:What is "dubious" about it? (Score:2, Informative)
Please, please. How many times does this have to be rehashed here on Slashdot and the Internet in general, especially when good, detailed information is so easily accessible? The Java "language" is an open specification. How do you think GCJ and other projects are able to do their work? Sun's JRE source code is quite a different story, for example, but that's not what I was referring to.
They accept feedback from other members of the JCP, but all the decisions are made by Sun.
This is incorrect, actually. The final "decisions" are made by the applicable Expert Group for the submitted JSR, which is made up of industry "experts" from many different companies, possibly including Sun, but often not. For a nice breakdown of the entire process, please see here:
http://www.javaworld.com/javaworld/jw-10-1999/jw-Hope that helps.
Re:Why not C? (Score:2, Informative)
Compile a piece of C code pathologically designed to break a C++ compiler.
But less specifically, if your requirements are:
Assembler is not portable. Nor is it very maintainable.
There are a few languages that will allow explicit memory operations, but most of them do not.
Out of these, C is the most widely understood and the most widely ported. There are probably several embedded processors that don't have a port of C++ or pascal. Since C is also one of the most widely understood low level languages, the argument for any other low level language is weak. Hence, if you are forced to make a choice, the only choice is C.
depends what you want to teach them... (Score:3, Informative)
If you want them to have a clue how computers actually work, show them assembler and/or C.
If you want them to learn the "my data is mine i can easily do what i want with it" attitude, teach them Python, Perl, Ruby or PHP.
If you want them to get "standard" jobs in the industry, teach them Java or C#, with some C++.
In no case would I first show them any form of Basic. Kind of brain-damaging as a first language.
My personal take would be to give them two different classes corresponding to the first two items in my list: ML/Lisp and assembly/C. Make a solid grab at the two extremes and they can always figure out the 'middle' stuff on their own, which is comparatively easier.
Re:Functional? (Score:1, Informative)
Re:Noooooo! (Score:5, Informative)
If you teach them Pascal, and don't explain that Pascal does GC, then they will be hosed when they get to a C/C++ course and don't understand why they have to manage memory.
Pascal does not do GC.
And yes, most of Pascal is cleaer than C
Pascal:
myDates: array [1..10] of Date;
C:
Date myDates[10];
What is the low bound and high bound of myDate in C and in Pascal?
How do you do an array from 99 to 104 in C? You cant
There is plenty stuff where Pascal is FAR clearer than C, its designed to be so, while C is designed to be a portable assembler.
angel'o'sphere
Re:Scheme (Score:1, Informative)
C has almost as many parentheses as Lisp does, if you count curly braces; and typically more punctuation if you include commas and semicolons.
Emacs and vi can both match parentheses automatically, and Emacs can automatically indent Lisp code so that you can visually discern mismatched parenthesis by glancing at indendation. (vi may do the same, but I don't use it.)
Multiple Tiers for Teaching Programming... (Score:3, Informative)
I've noticed everyone here is recommending their favorite language, without mentioning why it might be useful for beginning programming. I'd like to address that issue:
In Beginning Programming, you're assuming that the student know absolutely nothing about programming. They should know Algebra (to understand variables), but that's about the extent of Math.
Thus, probably the Right Thing to do is build on the basic Math understanding that your students have, and start to introduce programming concepts from there.
For that reason, I'd start with a Functional Programming [wikipedia.org] language as they tend to be rather obviously Math-derived, and help ease the introduction of programming constructs. I would recommend Scheme, since it is associated with one of the best "Teaching Programming" texts ever, Structure and Interpretation of Computer Programs [mit.edu].
After they've grasped Functional Programming, I'd have them move on to Procedural Programming [wikipedia.org], starting in Pascal or Modula-2. These two are excellent languages which illustrate the fundamentals of procedural programming, without some of the nastier pitfalls. There are also excellent textbooks available for Pascal (fewer for Modula-2). Later, I'd move them to C to introduce pointers and some of the other hairier features.
Finally, they're ready for Object Oriented Programming [wikipedia.org], for which I'd use Java - it's widely used, very common for college-level coursework, and there are a large number of supporting utilties and good textbooks useful for teaching aids.
Overall, I'd look at teaching Functional in 1 semester, Procedural in 1 or 2 semesters (depending on the detail and breadth you want), and OO in 1 or 2 semesters.
In all honestly, I love scripting languages like Perl, Python, and Ruby. However, as a teaching tool, they're all too multi-purpose, and it's easy for the student to do something they're not supposed to do (even though it works). For teaching languages, you want ones which pretty much only allow the student to program in the methodology you're teaching. That is, you generally want those languages which are LESS flexible, since your main goal is correctness, not functionality.
-Erik
Guido von Robot might be worth a look. (Score:2, Informative)
http://gvr.sourceforge.net/ [sourceforge.net]
Or PL/I, of course.
Scheme or Python (Score:2, Informative)
If you want them to be able to program in their first day, teach them Python.
My question is, "What do you want them to do with the knowledge they gain in your course?" If this is to be an introductory course to progamming and/or computer science, it makes sense for it to be both enjoyable and educational. Start them out with Python and get them into PyGame, they'll be tickled to be writing games in their first course. If/when they want to get into writing web applications, send them off to Cheetah or some other templating language for Python. If/when they want to write GUI applications, send them off to wxPython.
Of course this all fails when they get to college and they are forced to learn Java (C/C++ was so much better to learn), but by the time that rolls around, we hope they have matured enough to understand that learning multiple programming languages is actually good for them.
My answer is: it doesn't matter that much (Score:2, Informative)
Re:Well.. (Score:3, Informative)
Rails is a Web-site framework built using Ruby, much as Struts is a framework/tool-kit built using Java.
Ruby makes for an outstanding first language. Learning to use Rails (or Nitro or Wee) could serve as a "next step" course for developing Web applications while examing Ruby's meta-programming facilities.