If I was teaching someone to code now, I would start with something interactive.
I'd suggest a procedural style language and a functional style of language.
My recomendations YMMV...
Procedural : C
If you don't know at least basic C, then you generally have a very flaky idea of what's going on with the computer. C is a pain in the ass, with compilation and link problems, the associated (crap) makefiles, memory management etc etc, but IMHO if you want to be a decent programmer, you have to know enough C to be able to appreciate differences in other languages
Pros:
required for a lot of open source (understanding, compiling etc)
learn enough to fix makefiles etc
solid procedural style
memory management the hard way makes you appreciate GC
pointers
Cons:
compiled
makefiles (yuck!)
not interactive
pointers (+ pointer arithmetic)
Functional : Haskell
I'd have said any functional language (one of the MLs etc), but Haskell seems to be the newest functional language so it's probably the most relevant to the current state of programming (not sure I'd liek to build a dynamic site with it!)
Pros:
learn recursion properly
it's pure functional, no side effects
interactive environment makes it super-easy/quick to test/try things out
it's free (GHC)!
good tutorials available
head
tail
map
Cons:
Monads are a little wierd
unlikely to be a big thing commercially, so a little less relevant than pretty much any other language
The languages I wouldn't touch with a 10 foot barge pole...
Anything .Net
- Nice environment, but material teaches bad practice, very few .Net developers know anything about unit testing, scripting builds (or using build tools) (that I've met)
Python
- Can't stand the "whitespace is a part of the program" feature, apart from that I'd say it'd be a good choice for beginners, me I don't like it
Javascript
- Has nice features, but it's not the easiest language to try out without resorting to running things in a browser (or even worse, Windows Scripting Host [shudder])
C++
- "Make an octopus by nailing legs on a dog" - say no more
Lisp
- as cool as it is, I'd hate to have to teach someone else...
Java
- It's really not as easy to learn as it once was, library bloat, inconsistant APIs, 1000s of tutorials that assume knowledge in framework x, y or z (Have you tried to run any tutorial for Java Web development in the past year that doesn't assume that you'll use Hibernate+Spring+A.N.Other framework?)
- Static compilation bites for learning / No interactive environment to learn with
- Over-reliance on tools (similar to .Net)
<rant>
Just 2 years ago, I'd have said that Java would be quite a decent language to get started with, but with Java5 and all the many new ways you can shoot yourself in the foot (JSF - where did that come from?), I'd definately stay away. It's now come to the point where I'm (Java Technical Architect/Lead Technical guy here) actively trying to move projects at work away from Java (mainly towards Ruby where appropriate), simply as the developers seem to get blinded by all the "cool" eclipse plug-ins, and they can't work without Hibernator, TomcatRunner, DBVisualizer etc etc. What happend to Ant + JUnit + Vi?
Sun's push for specs that are only feasible with a critical mass of tool support, along with new Java developers and their "Tool Lust" (ooer missus) and .Net envy will be the death of Java.
</rant>
Yeah and I suppose Ruby's a good learners language, but I'd start with C + Haskell first to get the basics before moving onto Ruby for development.
Kev