It's a lot like Visual Basic, except: 1) Portable to MacOS and Linux 2) Easier to just jump in and write apps with 3) Produces apps with no DLL dependencies.
Give it a try, you might find it meets your needs.
Please, it takes kids YEARS to recover from the damage that learning any flavor of BASIC does!
"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration."
-- Edsger W. Dijkstra, SIGPLAN Notices, Volume 17, Number 5
Things (specifically BASIC variants) have improved since Dijkstra wrote that, but an underlying fundamental truth remains.
"Whom the gods would destroy, they first teach BASIC."
-- unknown
Have you tried RealBasic? It's not VB, it's closer to Java than any flavor of Basic from the past. In fact, I wouldn't mind at all if they changed the name... but try it before you knock it.
Yes, I have looked at RealBasic, at least briefly, and I agree it's not as bad as the language(s) that Dijkstra was complaining about (you'll note that I even said something along those lines). But if it's more like Java, then what's the point? Just teach 'em Java, and that way they'll have something that might actually be useful to them someday. Frankly, I think Pascal or Python or Scheme or Modula or Eiffel or Smalltalk would be a much better choice for an introduction to programming, but I certainly don
Noooo! Why would anyone teach students using Pascal instead C/C++. Does anyone think the BEGIN/END is really more straightforward than {/}? As students, they are going to have to *learn* things when they program, and curly-braces are the least of it.
Is 'record' and clearer than 'struct'?
If you don't want the students to have to deal with memory management, then use a garbage collection library with your C compiler. If you want to CYA, tell them that they are using a GC library. If y
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... neither you can't do 2 or more dimensional arrays in C (you have to relly on arrays of arays and manually initialize them).
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.
I spit in the general direction of "conciseness", and it's kinsman "cleverness".
To quote Kernighan:
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
I used to be a clever programmer, but then I graduated and got a Real Job, and had to read the code written by both Clever and Grown-up programmers. Guess which code was easier to modify, debug and add functionality to. Guess which code had less bugs.
A good (but not huge!) dose of verbosity and simplicity would go a long way towards making more robust applications.
Another relevant quote, by Jeff Polk, co-creator of CVS:
There's no obfuscated Perl contest because it's pointless.
The idea that learning something can "mutilate" you or decrease your ability to learn other things is crap. I, and most of the good programmers I know personally, learned on BASIC - evil old unrepentant BASIC, full of GOTO and GOSUB. Maybe Dijkstra had trouble teaching "good programming style" to students with a BASIC background because they had experience, and weren't automatically willing to accept someone else's definition of "good". Or maybe he was just kidding.
BASIC was grungy, useful, widely available, and offered a fast edit-run loop - key ingredients in getting a lot of kids hooked on computers.
I think that introducing the beginner to Brainfuck [wikipedia.org] is highly likely to mutilate them (or at least induce them to self-mutilate).
On a more serious note, I think that to most (non geek) people, computer = Interweb so a programming language that has the ability to output html is preferable. This would mean that they can show off their work to friends, which has a powerful re-inforcing effect in itself.
Although I like PHP, it sounds like Python has the edge in that it is more flexible in this regard
I'll tell you why it's a hot button for me. I tend to learn concretes first, concepts later. When I was 12, BASIC completely hooked me on programming. I was like the rat with a button wired to the pleasure center, and would have died of dehydration in front of a TRS-80 if not forcibly removed. Much like a talented kid banging on a drum kit, I was in love with the feedback loop, with the immediacy of the machine. In time, the love and deep awareness of computers that BASIC implanted led me through many
Java is a good language for a beginner and does teach some very useful OO concepts. I would quibble that as PHP can be run as a standalone application it is really no different from other scripting languages. However, it has poor structure and encourages some really bad programming practices. That's the only real reason I'd discourage it for beginners.
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.)
Java might be ok for some people - I think that's what AP Comp Sci classes use. However it has a few drawbacks:
1) It doesn't "scale down" [dedasys.com] as well as languages like Python, Ruby, Tcl etc... So might not be as well suited for those who aren't as interested/motivated/quick on the uptake.
2) It's kind of dubious, IMO, to be promoting a product of one company.
In any case, that would leave us with the scripting languages, which I think are all worth considering for different reasons, and all have in common a faster, easier development cycle with no need to recompile each time.
Python: clear, easy to read, and very general purpose. Good introduction to OO without beating you over the head with it or forcing you to adapt to it from day 1.
Tcl: because of the interesting introspection that it has and uses for certain common programming tasks, I'm not sure it's the best to start with, but on the other hand, being able to create something *visible* on the screen with a few lines of code is pretty gratifying, especially for a beginner. (Python has Tkinter which is pretty good too, but slightly more complex to start with than regular old Tk).
Ruby also seems like a good, reasonably generic language - I don't know it as well, but from a casual glance, don't like the (willful) resemblance to Perl in terms of the syntax. But I think you could do a lot worse - you'd certainly have some advanced concepts available to teach with it.
If you teach them PHP, you're going to be teaching them web programming, basically. I'd stick to a more general purpose language (you can use PHP for general purpose tasks, but it's still really oriented towards the web).
On the other hand, if you've got bright kids and are willing to explore something interesting, you might try languages like Smalltalk or Scheme, that introduce some really interesting ideas.
I once was an adjunct professor at USF [usfca.edu] and introduced programming to MIS students. The first time that I taught that class, I presented a simple, console based balance checkbook example in Java. I watched as the class recoiled in horror at all those curly braces.
For the next class, I presented the same program only this time written in Python. That class was much more comfortable with the Python sample code than the previous class was with the Java sample code.
If I'm remembering correctly, Python came out of a language designed for teaching. The very syntax encourages some good programming principles (indentation, etc.), and it's object-oriented. It's a very common language to find on shared web hosting plans. Also, Ruby on Rails isn't a language - it's a framework. The language is Ruby. Ruby would also probably be a good language for students to learn, though it seems less popular right now than Python.
PHP as a _language_ is probably not a great idea, but used in conjunction with web development, it would be great, but don't forget MySQL and/or PostgreSQL. And Perl, though that should come later; students need to learn programming with something with decent syntax before being exposed to something like Perl.
I agree. Python is an excellent starting point for beginning programmers:
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.
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.
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 u
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).
Quirky? How so? The using of whitespace/indentation for meaningful things really only encourages good programming and readable code. As long as you don't mix tabs and spaces (i.e. use a decent text editor that allows you to replace tabs with a group of spaces) the mandatory indenting is a fantastic thing.
Much in the same way that LISP's usage of parenthesis
Quirky? How so? The using of whitespace/indentation for meaningful things really only encourages good programming and readable code. As long as you don't mix tabs and spaces (i.e. use a decent text editor that allows you to replace tabs with a group of spaces) the mandatory indenting is a fantastic thing.
I guess that's an opinion, and a lot of python programmers claim that.
The last time I used a language in which whitespace was significant syntactically, it was friggin' COBOL. From my perspective, I find p
YMMV, but for me, having whitespace be syntactically significant is just BAD!
That was my initial reaction when I first met Python: sacrilege!
In many other block-structured languages it's customary to indent but the {} or begin...end markers are the syntactically significant things. Unfortunately, when humans read the code, it's actually the indentation they use to parse the logic most of the time, as many a new C student has learned via the standard deviously indented if...if...else demonstration.
On reflection, that means having the indentation not be significant, yet using other markers that are, is a bit like putting a banner comment at the top of every function with the function name in it: it's fine if you copy it in properly, but it doesn't really help, and it's a maintenance hazard that can actually harm readability if it's changed incorrectly.
Punctuation in a programming langauge is good, exactly up to the point that it stops increasing readability and/or reducing errors. After that, it's just clutter. So IMHO the question is whether (from some objective, analytical point of view) ignoring whitespace and introducing {} or begin...end markers improves readability or reduces bug count for programmers using the language. I suspect the answer really is a matter of taste: for some programmers it will, and for some it won't.
This is why not everyone agrees on whether syntactic whitespace is a good or a bad thing. There just isn't a single, universal right answer to the question.
Tab characters, as distinct from the tab key, are nothing more than a primitive and error prone text compression method. They should've been put out to pasture years ago.
---
I love the free market zealots think monopoly is a good thing.
It's quirky in that it allows both spaces and tabs to be used interchangeably, instead of forcing indentation to be done the One True Way, tabs.
But there isn't One True Way.
Or you end up with some abortion of how the text is written to the file, and therefore wrong. Emacs, for example, will not write out a single tab for each level of indent. It will collapse them all down to a single character to be space efficient.
Then you have the encoding for how many levels of indent you actually have being encoded in an editor-specific method. So things like vi, cat, less, lpr (or notepad and printing if you're on windows) don't know how to interpret the content.
I've had this argument with my co-workers -- some like two spaces indent, we had standardized on 4, but when edited by some editors, it crapped back a broken representation of the string because it was 'cleverly' encoded --- and it was incompatible with other editors.
This is why whitespace chars shouldn't be interpreted as being syntactic, nor should they be stored in the file in an incompatible way.
I second the Python recomendation. It's a great language to learn concepts on and it's very powerful so it scales well when they get into higher level programming. Plus, it's cross platform on just about anything and everything that has a console.
Personally, I am a fan of Wirth-style languages, so I would recommend Modula-2 (successor to Pascal with a cleaner syntax), or Oberon (successor to Modula that adds objects and garbage collection). Although I'd stay away from the native Oberon programming environment since it is quite unlike the environment most of us are familiar with (Windows and its look-alikes). Both of these languages, like Pascal were designed for instruction, but are powerful enough to be used in production environments.
I've been recommending (and teaching) c++ for several years now. Pascal was great, even Java has its good points. The main thing is whatever language is being used to introduce programming use it as an example language for the programming concepts which are being taught.
To add on to this... pick a language that doesn't require learning some new GUI/framework/etc. Pick something that can easily read/write to a simple console.
In other words, consider assembly code. Sure, it takes a bit of effort to learn, but it's still by far the best way to really get to grips with programming.
I don't know about Ruby on Rails, but I strongly agree with you about PHP and VB. I think they both lead poorly to working in other languages.
I would recommend Python, because I'm more familiar with it than Ruby. It has a clear, elegant syntax, and many concepts in it exist in other languages as well.
But, Ruby may be perfectly adequate as well. I know that most concepts that exist in Python that aren't particularly language specific have counterparts in Ruby.
I used to recommend assembly, then scheme, just so all the people who entered thinking they were programmer hotshots because they knew BASIC, VB or C or something would find themselves in deep water and having to learn something new.
But I suspect that's a bit overly hostile. Depends on the environment of course. Still might be a good idea for people going to a hard-to-get-into technical school to knock them down a peg or two and convince them that there's stuff they don't know.
Python and Ruby are very similar, and I would recommend them about equally.
C/C++ are bastard hard as starter languages, and VB is just about the tool of the deevil.
I don't know about Ruby on Rails, but I strongly agree with you about PHP and VB. I think they both lead poorly to working in other languages.
Well, that all depends on what environment the person intends on working in. I know most here would rather die than work in a Windows centered environment, but you know? They exist in large numbers, not everyone is "down" on Windows, and in that case, Windows centered languages such as VB, C#, and maybe C++ (down the line, maybe) is the direction to go. As far as PHP
Hear, hear. My vote is definitely for Python. It's my language of choice in general, but it also has a lot of qualities that make it great for introducing to programming. A few of my favorites:
helloworld is literally a one-liner -- don't have to wrap it in a function (or, god forbid, a class *cough*Java*cough*) or import any I/O libraries
The syntax is ludicrously simple; eliminates bugs like "if(foo); {do_stuff();}"
The standard library is substantial and reasonably well-documented
While Ruby may be a good choice for a 1st language (though I'd teach either python or java), DO NOT teach Rails.
Besides the obvious concerns of having to teach HTML at the same time, Ruby on Rails uses *way* too much magic for beginning programmers. There are all sorts of domain specific shortcuts that Rails uses. How are you supposed to teach iteration when the Rails uses something like collection_select [rubyonrails.com]?
Python. Python has everything you need and then some. It runs on every platform (Linux and OS X boxes already have it installed), and it's free.
Python (through the use of forced whitespace) forces them to learn to write more readable code (I remember taking C++ in high-school, the stuff people wrote would make your eyes bleed). The language has everything your students might need for intro programming (for loops, functions, etc). If they want to continue on will Python later (or you want to offer advanced classes later) it has bindings for all sorts of stuff (XML, OpenGL, QT, GTK, and many many other things). It also has all sorts of handy stuff like an interactive interpreter, a "for each" loop, and more. It's object oriented too.
Look into Python. It's easy to use and would make a great stepping stone if they want to later use a language like C/C++/Java. Or (as I said) Python is great in and of its self and they can stick with it.
One more reason why Python is great for teaching is that you get results much faster than in some traditional languages. Of course this is great for everyday programming work, but for students the motivational aspect of rapid development is even more important. There's very little grunt work you need to do before getting into the fun stuff.
Python is definitely the way to go. There is a free book that is written especially for High School CS classes, it's called How to Think Like a Computer Scientist: Learning with Python. You can get it here: http://greenteapress.com/thinkpython/ [greenteapress.com] for free in any of these electronic formats: PDF, LaTeX, Postscript, and HTML. Or you can buy printed copies here: http://greenteapress.com/thinkpython/terms.html [greenteapress.com]
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."
We have recently started using Python in our first programming/CS course in the first-year of University. Feedback from students has been quite good. The biggest complaint now is when we switch to Java in the next course: "Why do we have to use Java? Everything so so much harder."
From my point of view, Python is well structured and has all of the language features I'd ever want while introducing programming (and arguably, all I'd ever want period). Students seem to pick up relatively good habits (of cours
In school kids have objectives that are more short term. Graduating, having fun and being creative are common examples of that. As educators you have more long term objectives for the kids. Preparing them for college or the professional world being prime examples of that. The answer to your question is somewhere in the middle.
If I wanted to interest kids in programming and teach them something useful I would try something like a course in Unreal Tournament editing or some other game that has a well defined scripting language. Yes it is a game but the scripting language is very C like in nature. And let's be honest you should really be focusing on teaching them how to analyze, break down and solve problems progamatically regardless of the language. Teach them that and then let them decide if it is something they want to pursue.
Another great aspect of teaching a course this way is that it shows them both the difficulty and the rewards of programming. It is not easy to create good levels in these games. They have to learn to handle various types of media as well as programming the main logic. As a great bonus they end up with something they all can play with in the end.
Any how, this kind of idea is not for a conservative environment and if you are in that situation then teach them Java and emphasize object oriented development. If your environment is a bit more progressive then I would look at the gaming route.
Although, lord knows we don't need any more web developers, but... If they kids have access to notepad and some type of free webhosting then they can always work on a web page regardless of having to have a compiler. Once they understand how syntax works (like closing your tags!) then they can move up to more complicated programs that make you hunt down errors after you compile.
Although some people would debate getting the inner workings down pat first is more important (like hello world programs in C), I'd
Well, give them photography skills. Learn Photoshop and all you know is Photoshop. Learn Photography and Paint Shop Pro and The GIMP come easy as well.
But that's beside the point. Knowing markup is also a good idea. As long as you teach them XML, they'll be able to figure things out. But the question was about actual programming and which language you should teach first, not about markup and web developing.
scripting language holy wars aside, python WILL teach good programming style, it's clean, easy to learn, multiplatform, and if you want a good real world example of why it's useful --- well, bittorrent comes to mind.
Go with Python. It's quick, easy, and clean. It encourages decent syntax, and is portable to anything. Furthermore, as it's interpreted, you get the instant gratification of being able to run the program once you've saved it and set the permissions--no waiting on a compiler. Also, studens can take their work home with them, as it's portable and free both as in freedom and as in beer.
Also, the GUI bindings aren't that hard to use and most are equally portable.
It might actually be good to start the students on the path to learning Cocoa. With X-code and interface builder a large number of fairly powerful applications can be constructed with very minimal coding, but the students will have the option to code 'till their heart's content.
Interface builder would allow students to even go as far as building a fully functional web browser without having to touch any code, and since it is free you wouldn't have to invest much into your startup.
I suppose that the only d
If the kids don't know anything about programming, and are interested in math, Scheme (or Lisp) might be the best language to teach them. The can learn some really interesting concepts.
But, that's probably too academic, in which case I recommend Jython. It'll be really useful as a scripting language, and will allow you to have a follow up course on Java in which you slowly replace a large Jython program with Java code and then extend it even farther.
Scheme is a great progamming language to start with. At least try an interpreted language first, you can explore while interacting directly with the interpreter, it's more fun. And there are video lectures about scheme available online for free at the MIT. Very interesting, and made by the creators of the language (Abelson and Sussman).
(Please don't start downloading them all at once, those are huge files).
A quick google found a torrent [www.sik.fi] of the DivX versions. 9GB total. There's currently 2 seeds and 3 peers. The files are under the Creative Commons licence.
Give DrScheme [drscheme.org] a look. Nice graphical IDE, libraries, dead simple syntax. Free. Different language levels to cater to the learning process. And pleanty of introductory texts [schemers.org].
I would contend that it's much easier to move from functional to procedural than the other way. Witness the teeming masses of procedural programmers that end up saying, "Well I tried looking into some of that functional stuff because it sounded interesting, but it's just too weird. I can't get my head around it." I know some very bright programmers who have a lot of difficulty with the functional style because they're so used to procedural. In contrast, I think anyone could pick up procedural programming if
Really! Running programs from Eclipse is dead easy (no Makefiles) as is debugging the stacks (to see the how the clockwork ticking). Very visual, method completion, infopop javadoc, convention enforcing wizards and all (GUI too). Taking up Java with Eclipse is a breeze and Java itself has a nicely documented library for anything you want to play with and explore the basic practices of OOP.
I learned programming using Borland's Turbo Pascal (yes, Windows, not free as in speech (ZOMG)) and it certainly helped me learn some programming basics. I've moved on to learning C++ now and the Pascal background made it much easier.
(Oooh, I can't wait to watch the modding for this comment.)
C has a standard (a few, actually, C89 and C99 are probably the most
important). Its not a difficult language to learn, its supported on almost
every platform out there, and for certain
tasks, its the only choice. Plus, there are many good support tools for C
(gdb, valgrind, gprof, etc). Finally, many, many libraries are written in
C -- C often ends up being the 'glue' code to tie another language to a
specific library. And don't forget the many, many projects that already exist
in C -- if you want to extend any of those projects, you need to understand the
language.
I always thought that assembly is not a bad teaching language either.
It helps to understand how a processor works.
I would also recommend lisp, but that has already been covered in this thread.
Now tell me, what is ONE thing you can do in C that you can't do in another language? And by another language I can mean anything from machine code, various architecture assemblers, C++, etc.. Now I would like you to list the things you CAN'T do in C, or are immensely difficult in C, but are quite easy in other languages (parsing anyone, memory management, Stack Frame manipulation, raw manipulation of registers - and n
Now tell me, what is ONE thing you can do in C that you can't do in another
language? And by another language I can mean anything from machine code,
various architecture assemblers, C++, etc..
Gotta weasle a bit: By saying "only choice", I meant "only reasonable choice".
Short of assembly, C (or its cousin C++) is frequently the only reasonable
choice for embedded programming (and lets be honest, for big projects,
assembly is quite often not a reasonable choice). When resources are low, C
shines.
When I first started with Java/VB, I found programming to be really hard. I decided to learn assembly/C++ and, just like dasunt said, I think they taught me how computers really work.
Once I knew that everything is a just a number (pointers, instructions, everything) and that memory is just one big linear array, nothing was a mystery anymore -- I could figure out what the compilers and other languages were really doing. This put me way ahead of average programmers my age until 4th year university when they forced everyone else to learn that stuff.
To be a good programmer I think you have to understand how computer really work, and C/assembly is the best way to pull back the curtain and be confident that you can get anything to work.
On a related note, when people are teaching object oriented C++ to beginners, it's common to focus on the high level stuff (encapsulation, polymorphism). What I'd like to see is for them to mix in a little bit of "and here's how you would implement polymorphism in C" -- then people see how it all comes together. Er, well, that's what I think:~)
I agree with C, for two big reasons. One, it's one of a few languages that it's possible to fully master. It's just not that complex. C++ introduces tons of special cases in its type system, and it hides more behind the curtains. Java simplifies this, but hides still more. Which is the second reason - C is much closer to the machine. As soon as you learn a bit of C, you should be familiarized with assembly language, the stack, etc., just so you get an idea of what's actually going on. Only then do yo
I have to second perl. There are a large number of different programming tasks out there, and for each task there is one or two languages that excel; but the tasks that perl excels at are the ones you need a tool to accomplish 90% of the time.
I did my programming in HS with TurboPascal, in a "Computer Math" class.
It was just me and a few honor-role students (lets just say I got bored easily, so I sluffed off.. I have no problems being a B student). None of them really had any aptitude for programming, but the language itself worked well for them because of the syntax. We wrote simple games, stuff to do our math homework and difficult calculations, and the like. I ended up writing a printing program for printing out our source code.
I've found that python works really well as a beginning language. Python (and many other interpreted languages) let you write fully functional programs with very few programming concepts. It's really easy to introduce one concept at a time, focus on it, and then use that to introduce the next.
You can start small by using the interpreter as a calculator, then move the caculations to a script and executing that. After a while you can gradually introduce variables, comments, functions and modules. After that, you could introduce the standard library and show how to print the contents of a file or download a web page. Or you could introduce the OO concepts of classes, encapsulation, polymorphism and inheritance. It's really up to you and how well your students are going.
Advanced students should also be able to create simple GUI or command line interfaces. Python has a great base class for command line programs that takes away most of the tedious parts. It also has some simple and easy database modules if you want to teach relational databases and SQL as well as programming.
But don't forget that the most important thing to do is to teach them how to teach themselves. Show how to look through the standard library for something new, or how to find and install new modules from the net.
When everyone has become comfortable with the language (and if you have the time) you can introduce a similar language for contrast. I've found that people who have experience with a wider variety of languages tend to be able to "grok" programs a bit easier than those who haven't.
PHP or Ruby on Rails; but are not convinced that they lead well into higher level languages.
Uhm, PHP and Ruby shouldn't be mentioned together like that. Ruby *is* a higher level language compared to PHP.
But that's not really important to a *beginning* programmer. What you really want to do is first teach the basics, then immediatelly teach about "best practices", like keeping code simple and clean, writing *TESTS*.. unit testing should be taught AS SOON AS POSSIBLE in my opinion. Ruby makes it easy an
I'd need a really good argument to not use Java. A decent Java developer is harder to find than a C++ or even a C# guy. Tools like Eclipse are free and there is a lot of free online documentation. And it's easier to build a quick GUI in Java than C++.
I remember learning to program in BASIC during my very early years. I hated it. I still hate BASIC, it was crap.
I also remember learning Logo when I started at high school. That little turtle that pottered about on the floor was really cool, and it had all of the concepts that a programming language needs.... loops and conditionals! Having a real-world output from the program was a good way to inspire students to learn it - everyone really enjoyed it.
There are some gizmos now called the MicroMouse or somesuch. It's a little PIC powered rover that is similar to the Turtle. You program it up with a simple dialect of C, and download the code into the PIC. The development environment comes with all the libraries to make things like starting motors and reading switches easy from the C code. That might be a good way to teach the basics without boring students that otherwise don't see a use for it:)
Those that enjoyed it enough went on to study the more advanced stuff in later years of school.
Of course, my days in Logo were back when the BBC 8-bit micro was new and powerful.
I also remember learning Logo when I started at high school. That little turtle that pottered about on the floor was really cool, and it had all of the concepts that a programming language needs.... loops and conditionals!
I have to admit that I always envied the people who learned turtle graphics (at the time when it was au courant).
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!!
I was thinking about this (from the perspective of what I would do to educate a promising youth with no programming experience who seemed to have a the right mind for it) same sort of topic a while back, and here's what came of it: First, kill Visual Basic - that's just plain bad.
Also note that you'd need some good emulators or some old-school hardware for some of this (although you might be able to build/find new DOS-era hardware based on Intel's 386EX chip, I think they still make it for little embedded sy
Here's my qualifications for choosing Java, then Assembly:
Java: - Is not too verbose (Hello World is not daunting) - Any algorithm can be reasonably implemented - Any structure can be reasonably represented - No low-level complications like pointers - Supports modern programming techniques like functional and O-O - The student can do real-world things in it - The student can experiment at home for free
Don't forget assembly!! - Too many new programmers need to do something low-level, or interoperate with another language, and they have no concept how memory is arranged, what source code compiles down into, or even what a compiler does! They don't comprehend that a string isn't an intrinsic thing the CPU recognizes, and that there are hundreds of ways to store and manipulate them. So when they have to learn about memory-thrashing, multithreading, garbage-collection, optimization, etc. they are lost.
This must be taught this very early on, not as an advanced course, so that when they learn other lagnauges and algorithms they can see where it comes from.
I agree highly with the point about assembly language. While I think no school should teach students to write serious programs in assembly, I'm shocked at the fellow programmers that I talk to today who have no real idea of what a 'memory overflow' really is, or why is it called a 'overflow', why not just 'insufficient memory'. They don't understand the differences between stack or heap, what is a null-pointer, and have difficulty in understanding concepts such as arguments pass-by-reference and pass-by-value (for object references).
When they start to use Java or.NET, they can't understand what's so great about garbage collection, and when they write C++... Arrggh memory leaks galore (and/or segfaults), and then they ask - what is a segmentation fault? Why is it called a 'segfault'?
While I had no particular love for assembly or compilers back in the university days when I 'had' to write them to graduate, looking back, they laid a foundations of understanding what exactly is going on in the machine. I'm grateful for that lecturer whose name I've forgotten in the particular choice of assignment.:)
---
Anyway, I think people who want to take writing software seriously needs to know this stuff - sooner or later. It's like a carpentry artisan needs to know about wood, and not just about carving.
Seriously. AT-Robots or some other assembly-like language to teach them how to program with registers, conditional jumps, interrupts, and all that. They'll later realize they hate goto from this. But mostly it's really stinkin' fun, and they'll hardly realize they're programming. Instead they'll be thinking about the problem they're solving, trying to beat each other in competition.
Then a language like C, to learn about functions, loops of various sorts, pointers, maybe even function pointers. This is when i
Let me start this post by putting on my flame-proof suit. =)
In order of preference:
C++ - but don't move into the advanced features right off the bat. I like string handling better than C though, so it gets the nod for the top slot. But the user would have to learn the compile process. Templates, STL, and OOP can all be added once you have the basics down.
C - pretty much on par with C++ in the features you would want to introduce to a beginner.
Ones I'm unsure on:
Pascal: I can't comment on this one, but it's supposedly well-suited for teaching.
Ones I wouldn't touch for intro programming because of syntax.
Python
Ruby
Lisp
These are all fine languages, but they all have specialized syntaxes, and the bridge between that, and their *next* language would be where you do them a disservice by using these ones.
Other poor choices:
Perl
PHP
Perl, which has a reasonably decent syntax, but because of the TIMTOWTDI philosophy, it's actually, IMHO, an ill-suited introductory programming language.
PHP, while similar syntax to C/C++, has the benefit of not having to learn how to compile apps. It's ultimate downfall is it's scoping rules and lack of namespaces. This is stuff an intro programmer should learn about.
PHP, while similar syntax to C/C++, has the benefit of not having to learn how to compile apps. It's ultimate downfall is it's scoping rules and lack of namespaces. This is stuff an intro programmer should learn about.
I think compiling should be a second year thing, at least for high school.
Actually, I'd put Pascal below C at this point. I think teaching OO concepts is important and Pascal falls down on that. I used to like it -- ages ago.
Not moving on to the advanced features just yet is exactly why I would teach Java first before C++. Java is like C++ with training wheels. It supports all your basic OO in a very constrained format that makes it hard to make dumb mistakes in. It teaches you interface based programming, single inheritance models and other good OO techniques. Too many new C++ programmers start multi-inheriting and dynamic casting right off the bat and end up not learning the importance of KISS until they really get bitten
Java's "music" class library appears to support every musical instrument in the symphony but on closer inspection requires you to understand metallurgy before you can instantiate a trombone, and spit valves are in the open position by default. C++'s music library on the other hand assumes that all brass insturments are, at their most fundamental level, a kazoo. You can drive it with anything from bare lips to a jet-powered compressor, but despite Stroustrup devoting eight pages to protected
abstract virtual base pure virtual private kazoo destructors, never once in the 20-year standardization process did anyone notice there is no member function called play().
If you teach VB, PHP, Perl, Ruby, Python, Java then your students will spend most of their time gluing together other people's library code. This is boring, uninformative, and gives a false and anticlimactic sense of early achievement. Yes, five minutes in VB will glue together a working text editor. And you learn nothing in so doing. Similarly PHP for a website. Good languages to start programming have a simple core library that does basic IO and data manip, and nothing else. The best are probably Scheme or
I'll echo the "Python" recommendations, tempered by the fact that a Rails-like framework may be a good idea. On the other hand, it may involve learning too many things at once; I've been web developing for just shy of ten years now and it's hard for me to feel how hard this stuff is. But take Javascript, HTML, Ruby, the Rails framework, and a couple of things tossed in for good measure, and it may prove a bit much. (Or not. I happily defer to anyone who has actually tried to teach programming starting peopl
I suffered an introductory course in programming in VB while studying physics at university and despised it. Later I was fortunate enough to come across SICP and the SICP videos when I decided I needed to learn programming in earnest but if I'd been stuck with something like C++ or BASIC or Java, I suspect I'd still have found programming a tedious and unrewarding distraction from real maths and science and never really understood its potential. Now I actually like and respect it and there are good resource
1. It's an "instant gratification" language that makes it easy to get results.
2. You can do a lot of web based projects which teens should find interesting.
Yes, PHP has a lot of problems. It's very undisciplined. However, I think it's a good choice for a class where probably 80% of the kids won't ever program again.
I don't think anybody who is new to programming will think a programming
language is cool based on the capabilities of the language or the libraries it
has. The coolness factor is based on seeing some application built in it, and
they want to be able to do the same thing. I doubt that there is any consensus
among your students as to what a cool language is. The students may have some
aversion to VB from things they have read, but all languages have critics as
well as hype.
I think you will be able to attract students to your course by focusing on what
you can do in the course and not on what language you get to use. A course on
"Building a Blog", "Programming a Robot", or "Building an Online Store" is much
more enticing than PHP or Ruby on Rails. When you watch a home remodeling show,
they don't advertise it as the show with the coolest miter saws and wrenches.
The show isn't about the tools, it is about the end product, a new deck, or new
cabinets in your kitchen.
Since you are teaching new programmers, I will suggest languages and frameworks
based on how easy they are to start using as opposed to how good they are in
the long run.
PHP has excellent documentation. Although its function names can be
inconsistent or duplicated (e.g. sizeof, strlen, count), it is fairly easy to
follow the code. This would probably be the easiest well development platform
to get started on without evaluating different components, since you really
don't need to bother with libraries to do MVC for a beginners course. You
definitely will want to set up PHP with "xdebug" so that PHP will provide you
with a stack trace for your errors. Otherwise, you will only see the line
number where the error occured, which is not very useful if the line number is
inside a function that gets called in a hundred different places.
Ruby on Rails is a very large frameworks, and you are just throwing names
around to suggest this for an intro course. Ruby, the language, and a basic
html templating system might be easy to teach, but Rails involves the MVC
pattern, object-relational mapping for database access, and an architecture for
unit/functional testing. This is NOT good for beginners. The Rails tutorials
will also give you a false impression of how easy it is by having you build a
bunch of database driven web pages with very little code. After you finish the
tutorial, you will still have a lot to learn.
Although I think Ruby is a more powerful language for an experienced developer
than PHP is, it has a lot of syntax rules to learn. For example, curly braces
{} could contain a block of code or an associative array, and "joe!" means run
the joe! function, and "!joe!" is a boolean NOT operator acting on the return value of
joe!
My personal favorite programming language is Python. It has a cleaner syntax
than PHP or Ruby, although an amazing amount of new Python programmers are
burnt by mismatched indentation between tabs and spaces. Python will treat a
tab as the same indentation level as 8 spaces, but your text editor may be
using a different value. Even though python tells you the line where the syntax
error is, the error may be invisible in your editor. If you are interested in
Python for web development, Zope involves learning too much infrastructure for
beginners. You would be better off with Spyce.
Instead of making your students build things from scratch, they may feel likethey are accomplishing more by customizing an opensource program that alreadyexists. You can find a bazillion PHP web portal projects at http://freshmeat.net./ [freshmeat.net.]
Straight C. They're gonna have to learn it sometime, it's useful, and they'll learn about how the computer works. Unless people don't think knowing something as low-level as pointers or a sort algorithm is important. Then go ahead and teach Java with its libraries for everything and garbage collection and slow-and-fatness.
Python is a great choice for a first language. Heck, it's a great last language, if you're not a pro. Ruby's OK, but python is more straightforward, while stil giving you lots of power.
Java's too verbose, C/C++ is too close to the hardware, and we probably shouldn't go that low for a fist language. PHP is too domain specific (and kinda cluncky). Ideally, your students would get a bit of exposure to several languages, so they can see some differences (typeing, etc)
This question would be much easier to answer if you could provide us with some insight as to why they dislike VB. Otherwise, we're just guessing.
Personally, I think VB.NET is an excellent beginner's language. It is simply easier to quickly get to the "making windows programs" stage (which is the interesting part) than Perl or Python. The syntax is more human-readable than java or C#, but is instructive for good technique since it supports full proper OOP. Finally, the rich framework and ability to build
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.
When I was younger, the ability to program the robotic turtle really empowered me! The fancy shapes and colors produce amazed me, and it made me feel like I was accomplishing something. It isn't a coincidence that one of the first things I programmed in Integer BASIC [wikipedia.org] (my second language) was a clone of LOGO for the IIgs [wikipedia.org] (also, we couldn't afford a copy).
Hey, it's what got me interested in programming. It's interactive so it gives instant results. It can teach the basics of algorithmic thinking without burdening the beginner with all the necessary quirks that go with "normal" programming languages. If they find they actually have a talent and interest in programming, a more conventional language can be used for a 102 course.
I've actually thought a lot about this question since my wife took a Java 101 c
Python is the perfect first language for learning to program. It has a fast learning curve, teaches good programming practises, introduces powerful programming principles quickly and easily, and is fun for the students, allowing them to do real things, including graphics, games, web programming etc.
Ron Stephens
Python Learning Foundation [awaretek.com]
I always thought Inform [inform-fiction.org] would be a cool learning language. It introduces the concepts of objects in a very easy-to-grasp way. It's really easy to throw together a working game.
Also what about something like DarkBASIC [thegamecreators.com]? I haven't used it at all, so I have no idea if the syntax is intelligible (or if it teaches good programming practice). Think about how students would respond to something like this, though...
When I learned programming, it was painful to get past the strange things I didn't understand in C, C++ and Java's "Hello World" program.
Header files, main(), etc. It was intimidating to me, and I am far from the most intimidated by new concepts person I can imaging.
The reason I like PHP for a programming teaching language:
It uses basically the syntax that is common to C, C++, Java and Javascript. It's an introduction to curly braced code blocks, parentheses as a grouper for boolean evaluation,
Before you go to the effort of changing all of
your teaching material, etc, etc, you need to
have a good handle on why students are
not taking the course. Are you sure it is the
programming language you are teaching that is
turning them off?
What you need to do (and this is hard!) is
to find out why students are turning away,
and try to address those issues.
Python is great for this. It's object oriented, interpreted, has amazing documentation and tutorials readily available, and forces the developer to learn good indentation practices at the start.
This is what I started with, and found it very easy to from there learn Java, C, and C++.
The best language is the one that the teacher can teach well. If the teacher can't do a good job explaining the language, it doesn't matter how good the language is for programming... there will be a lot of kids in class that will be lost.
I think Tcl is a great beginner's language because it balances a shallow learning curve with a quite a lot of power. (More than most expect before they've tried it.) Although I hardly ever program, I've dabbled in C, C++, Java, VisualBasic, and Python, but Tcl was the only language that I felt at home with. I was writing useful programs (GUI programs, even) within 2 hours of discovering its existance. A lot of OSS folks are put off by it's blindingly simple syntax:
I'm seeing lots of good advice, but a lot of it coming without a few very simple questions. What are you wanting the students to come away with? And what are the students interested in coming away with?
Back in high school, when I was first learning to program, I wanted some level of instant gratification. This is the basis of languages like Logo, where a core set of commands give a visual representation. But we can get similar results today in other domains.
losman mentioned [slashdot.org] UnrealScript, which I generally like, but still has some drawbacks. First, is the cost of the handful of Unreal licenses and the hardware to run them. It also assume the developers are on Windows (at least until UT2007), which may not be true for students at home. But beyond such technical issues, are you going to handle the distractions/complications of the additional media assets? As a teacher, if you're up to the challenge, you can take advantage of this to drawn in more students and allow students to follow their own interests within the environment. Ideally, students can group around projects where they all contribute based on their interest. Lastly, can you handle the parents (or tax payers in a public school setting) who see violent video games as inherently evil.
Web apps can offer similar instant gratification. The pitfalls here include maintaining a server that allows server side scripts and teaching HTML (and probably basic browser compatibility) along the way. Again, you need to decide whether hooking into additional media is going to be an advantage or distraction in the classroom.
One problem both of these share is the difficulties in tracing the stack. Their unique run contexts can make it hard to debug problems, which can be as frustrating for your students as it is for you trying to help them as project dues date approach.
That said, it is possible to bring the engagement of a game to other development platforms. A small top down arcade game can teach several core concepts, from simple data structures (lists of actors, multi-dimensional arrays of terrain, variables like position and health, event handlers from input or actor collision). Build an outside level editor and you can teach GUI development, file I/O, and string manipulation.
If you go the GUI and graphical route of a game, Java seems like a good match. I believe it works well in classroom scenerios. At the basic level, the virtual achine it free and platform independent. Several good IDEs are available, and I believe there is work on an Eclipse plugin geared toward students. The APIs are stable, self-consistant, and well documented, although exceptionally broad and thus easy for a novice to get lost in without guidance. And if you target applets, students have a simple way to show off their work.
I'm sure C# has basically the same benefits, but I don't know enough to comment on it. Given an MS grant for a Visual Studio lab, I wouldn't rule it out.
Python is also an option, but I would choose wxWindows over tkinter anyday. Being a dynamically typed language, you loose the support of a context sensitive IDE, but you gain the easy access to a shell-like evaluation environment, useful for allowing students to interactively test thier code fragements (actually, integrating Beanshell into a java app is both easy and useful). I've never found a debugging environment for Python I liked, but at least they exist.
Several other scripting languages could be mentioned here, but again I am not familar enough to comment on them.
Other posts have mentioned C, C++, and assembly. While I think they are all critical for a complete CS education, I am not convinced they are ideal for a high school introduction course.
However, if the target audience is more advanced, I would put C on the table before the others, especially if taught in an object oriented way to mimic modern programming practice. This is a great way to show what that C++ compiler or that Java or C# VM are doing on the metal.
If you want to teach them Computer Science and the deeper concepts of programming, then give them Lisp and/or some form of ML.
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.
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.
Ruby is a programming language. Easy to learn, but very powerful, combining features from Smalltalk and Lisp (among others) but with a more friendly (i.e., C-like and file-based) syntax.
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.
Life would be so much easier if we could just look at the source code.
-- Dave Olson
RealBasic (Score:3, Insightful)
It's a lot like Visual Basic, except:
1) Portable to MacOS and Linux
2) Easier to just jump in and write apps with
3) Produces apps with no DLL dependencies.
Give it a try, you might find it meets your needs.
Noooooo! (Score:5, Funny)
"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration."
-- Edsger W. Dijkstra, SIGPLAN Notices, Volume 17, Number 5
Things (specifically BASIC variants) have improved since Dijkstra wrote that, but an underlying fundamental truth remains.
"Whom the gods would destroy, they first teach BASIC."
-- unknown
Re:Noooooo! (Score:3, Informative)
Re:Noooooo! (Score:3, Interesting)
Frankly, I think Pascal or Python or Scheme or Modula or Eiffel or Smalltalk would be a much better choice for an introduction to programming, but I certainly don
Re:Noooooo! (Score:3, Interesting)
Noooo! Why would anyone teach students using Pascal instead C/C++. Does anyone think the BEGIN/END is really more straightforward than {/}? As students, they are going to have to *learn* things when they program, and curly-braces are the least of it.
Is 'record' and clearer than 'struct'?
If you don't want the students to have to deal with memory management, then use a garbage collection library with your C compiler. If you want to CYA, tell them that they are using a GC library. If y
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:Noooooo! (Score:5, Insightful)
I spit in the general direction of "conciseness", and it's kinsman "cleverness".
To quote Kernighan:
I used to be a clever programmer, but then I graduated and got a Real Job, and had to read the code written by both Clever and Grown-up programmers. Guess which code was easier to modify, debug and add functionality to. Guess which code had less bugs.
A good (but not huge!) dose of verbosity and simplicity would go a long way towards making more robust applications.
Another relevant quote, by Jeff Polk, co-creator of CVS:
What a load of rubbish (Score:5, Interesting)
BASIC was grungy, useful, widely available, and offered a fast edit-run loop - key ingredients in getting a lot of kids hooked on computers.
Brainfuck is what they need (Score:3, Insightful)
I think that introducing the beginner to Brainfuck [wikipedia.org] is highly likely to mutilate them (or at least induce them to self-mutilate).
On a more serious note, I think that to most (non geek) people, computer = Interweb so a programming language that has the ability to output html is preferable. This would mean that they can show off their work to friends, which has a powerful re-inforcing effect in itself.
Although I like PHP, it sounds like Python has the edge in that it is more flexible in this regard
Re:What a load of rubbish (Score:3)
Java? (Score:4, Insightful)
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.)
Re:Java? (Score:2)
Don't you mean OSHA guidelines :)
Re:Java? (Score:3, Funny)
"Scripting" language (Score:4, Insightful)
1) It doesn't "scale down" [dedasys.com] as well as languages like Python, Ruby, Tcl etc... So might not be as well suited for those who aren't as interested/motivated/quick on the uptake.
2) It's kind of dubious, IMO, to be promoting a product of one company.
In any case, that would leave us with the scripting languages, which I think are all worth considering for different reasons, and all have in common a faster, easier development cycle with no need to recompile each time.
Python: clear, easy to read, and very general purpose. Good introduction to OO without beating you over the head with it or forcing you to adapt to it from day 1.
Tcl: because of the interesting introspection that it has and uses for certain common programming tasks, I'm not sure it's the best to start with, but on the other hand, being able to create something *visible* on the screen with a few lines of code is pretty gratifying, especially for a beginner. (Python has Tkinter which is pretty good too, but slightly more complex to start with than regular old Tk).
Ruby also seems like a good, reasonably generic language - I don't know it as well, but from a casual glance, don't like the (willful) resemblance to Perl in terms of the syntax. But I think you could do a lot worse - you'd certainly have some advanced concepts available to teach with it.
If you teach them PHP, you're going to be teaching them web programming, basically. I'd stick to a more general purpose language (you can use PHP for general purpose tasks, but it's still really oriented towards the web).
On the other hand, if you've got bright kids and are willing to explore something interesting, you might try languages like Smalltalk or Scheme, that introduce some really interesting ideas.
Re:Java? (Score:4, Interesting)
I once was an adjunct professor at USF [usfca.edu] and introduced programming to MIS students. The first time that I taught that class, I presented a simple, console based balance checkbook example in Java. I watched as the class recoiled in horror at all those curly braces.
For the next class, I presented the same program only this time written in Python. That class was much more comfortable with the Python sample code than the previous class was with the Java sample code.
consider Python (Score:5, Insightful)
PHP as a _language_ is probably not a great idea, but used in conjunction with web development, it would be great, but don't forget MySQL and/or PostgreSQL. And Perl, though that should come later; students need to learn programming with something with decent syntax before being exposed to something like Perl.
IMO, anyway.
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.
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 u
Re:consider Python (Score:3, Insightful)
Quirky? How so? The using of whitespace/indentation for meaningful things really only encourages good programming and readable code. As long as you don't mix tabs and spaces (i.e. use a decent text editor that allows you to replace tabs with a group of spaces) the mandatory indenting is a fantastic thing.
Much in the same way that LISP's usage of parenthesis
Re:consider Python (Score:3, Insightful)
I guess that's an opinion, and a lot of python programmers claim that.
The last time I used a language in which whitespace was significant syntactically, it was friggin' COBOL. From my perspective, I find p
Syntactic whitespace (Score:5, Insightful)
That was my initial reaction when I first met Python: sacrilege!
In many other block-structured languages it's customary to indent but the {} or begin...end markers are the syntactically significant things. Unfortunately, when humans read the code, it's actually the indentation they use to parse the logic most of the time, as many a new C student has learned via the standard deviously indented if...if...else demonstration.
On reflection, that means having the indentation not be significant, yet using other markers that are, is a bit like putting a banner comment at the top of every function with the function name in it: it's fine if you copy it in properly, but it doesn't really help, and it's a maintenance hazard that can actually harm readability if it's changed incorrectly.
Punctuation in a programming langauge is good, exactly up to the point that it stops increasing readability and/or reducing errors. After that, it's just clutter. So IMHO the question is whether (from some objective, analytical point of view) ignoring whitespace and introducing {} or begin...end markers improves readability or reduces bug count for programmers using the language. I suspect the answer really is a matter of taste: for some programmers it will, and for some it won't.
This is why not everyone agrees on whether syntactic whitespace is a good or a bad thing. There just isn't a single, universal right answer to the question.
Re:consider Python (Score:3, Insightful)
Tab characters, as distinct from the tab key, are nothing more than a primitive and error prone text compression method. They should've been put out to pasture years ago.
---
I love the free market zealots think monopoly is a good thing.
Re:consider Python (Score:5, Insightful)
But there isn't One True Way.
Or you end up with some abortion of how the text is written to the file, and therefore wrong. Emacs, for example, will not write out a single tab for each level of indent. It will collapse them all down to a single character to be space efficient.
Then you have the encoding for how many levels of indent you actually have being encoded in an editor-specific method. So things like vi, cat, less, lpr (or notepad and printing if you're on windows) don't know how to interpret the content.
I've had this argument with my co-workers -- some like two spaces indent, we had standardized on 4, but when edited by some editors, it crapped back a broken representation of the string because it was 'cleverly' encoded --- and it was incompatible with other editors.
This is why whitespace chars shouldn't be interpreted as being syntactic, nor should they be stored in the file in an incompatible way.
Re:consider Python (Score:5, Insightful)
Give it a look. Tons of resources out there also.
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.
Re:Pascal WAS a language designed for teaching (Score:5, Insightful)
Teach programming, not the language. (Score:5, Insightful)
Re:Teach programming, not the language. (Score:2)
Re:Teach programming, not the language. (Score:2, Funny)
My answer (Score:5, Insightful)
I don't know about Ruby on Rails, but I strongly agree with you about PHP and VB. I think they both lead poorly to working in other languages.
I would recommend Python, because I'm more familiar with it than Ruby. It has a clear, elegant syntax, and many concepts in it exist in other languages as well.
But, Ruby may be perfectly adequate as well. I know that most concepts that exist in Python that aren't particularly language specific have counterparts in Ruby.
I used to recommend assembly, then scheme, just so all the people who entered thinking they were programmer hotshots because they knew BASIC, VB or C or something would find themselves in deep water and having to learn something new.
But I suspect that's a bit overly hostile. Depends on the environment of course. Still might be a good idea for people going to a hard-to-get-into technical school to knock them down a peg or two and convince them that there's stuff they don't know.
Re:My answer (Score:5, Interesting)
Don't discount VB and C#... (Score:2)
Well, that all depends on what environment the person intends on working in. I know most here would rather die than work in a Windows centered environment, but you know? They exist in large numbers, not everyone is "down" on Windows, and in that case, Windows centered languages such as VB, C#, and maybe C++ (down the line, maybe) is the direction to go. As far as PHP
Re:My answer (Score:2, Insightful)
Re:My answer (Score:3, Interesting)
Besides the obvious concerns of having to teach HTML at the same time, Ruby on Rails uses *way* too much magic for beginning programmers. There are all sorts of domain specific shortcuts that Rails uses. How are you supposed to teach iteration when the Rails uses something like collection_select [rubyonrails.com]?
Python (Score:5, Insightful)
Python (through the use of forced whitespace) forces them to learn to write more readable code (I remember taking C++ in high-school, the stuff people wrote would make your eyes bleed). The language has everything your students might need for intro programming (for loops, functions, etc). If they want to continue on will Python later (or you want to offer advanced classes later) it has bindings for all sorts of stuff (XML, OpenGL, QT, GTK, and many many other things). It also has all sorts of handy stuff like an interactive interpreter, a "for each" loop, and more. It's object oriented too.
Look into Python. It's easy to use and would make a great stepping stone if they want to later use a language like C/C++/Java. Or (as I said) Python is great in and of its self and they can stick with it.
Re:Python (Score:4, 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."
Re:Python (Score:3, Interesting)
Feedback from students has been quite good. The biggest complaint now is when we switch to Java in the next course: "Why do we have to use Java? Everything so so much harder."
From my point of view, Python is well structured and has all of the language features I'd ever want while introducing programming (and arguably, all I'd ever want period). Students seem to pick up relatively good habits (of cours
Would you like to play a game? (Score:5, Insightful)
If I wanted to interest kids in programming and teach them something useful I would try something like a course in Unreal Tournament editing or some other game that has a well defined scripting language. Yes it is a game but the scripting language is very C like in nature. And let's be honest you should really be focusing on teaching them how to analyze, break down and solve problems progamatically regardless of the language. Teach them that and then let them decide if it is something they want to pursue.
Another great aspect of teaching a course this way is that it shows them both the difficulty and the rewards of programming. It is not easy to create good levels in these games. They have to learn to handle various types of media as well as programming the main logic. As a great bonus they end up with something they all can play with in the end.
Any how, this kind of idea is not for a conservative environment and if you are in that situation then teach them Java and emphasize object oriented development. If your environment is a bit more progressive then I would look at the gaming route.
I'd recommend web development. (Score:2)
If they kids have access to notepad and some type of free webhosting then they can always work on a web page regardless of having to have a compiler. Once they understand how syntax works (like closing your tags!) then they can move up to more complicated programs that make you hunt down errors after you compile.
Although some people would debate getting the inner workings down pat first is more important (like hello world programs in C), I'd
Re:I'd recommend web development. (Score:2)
But that's beside the point. Knowing markup is also a good idea. As long as you teach them XML, they'll be able to figure things out. But the question was about actual programming and which language you should teach first, not about markup and web developing.
Troll? (Score:2)
python! (Score:3, Interesting)
The envelope, please? (Score:2, Insightful)
Also, the GUI bindings aren't that hard to use and most are equally portable.
What about using X-code? (Score:2)
Interface builder would allow students to even go as far as building a fully functional web browser without having to touch any code, and since it is free you wouldn't have to invest much into your startup.
I suppose that the only d
Scheme (Score:2)
But, that's probably too academic, in which case I recommend Jython. It'll be really useful as a scripting language, and will allow you to have a follow up course on Java in which you slowly replace a large Jython program with Java code and then extend it even farther.
Re:Scheme (Score:2)
And there are video lectures about scheme available online for free at the MIT. Very interesting, and made by the creators of the language (Abelson and Sussman).
(Please don't start downloading them all at once, those are huge files).
http://www.swiss.ai.mit.edu/classes/6.001/abelson- sussman-lectures/ [mit.edu]
Re:Scheme (Score:2)
(Please don't start downloading them all at once, those are huge files).
A quick google found a torrent [www.sik.fi] of the DivX versions. 9GB total. There's currently 2 seeds and 3 peers. The files are under the Creative Commons licence.
Re:Scheme (Score:3, Insightful)
Like how to count parens? I spent a lot of time doing:
1 2 3 3 3 3 2 2 3 4 4 3 3 3 2 1
Java (Score:5, Insightful)
DrScheme (Score:5, Informative)
Re:Functional? (Score:3, Insightful)
In contrast, I think anyone could pick up procedural programming if
Java & Eclipse (Score:4, Informative)
Pascal (Score:2)
Why not C? (Score:5, Insightful)
Why not teach them C?
(Oooh, I can't wait to watch the modding for this comment.)
C has a standard (a few, actually, C89 and C99 are probably the most important). Its not a difficult language to learn, its supported on almost every platform out there, and for certain tasks, its the only choice. Plus, there are many good support tools for C (gdb, valgrind, gprof, etc). Finally, many, many libraries are written in C -- C often ends up being the 'glue' code to tie another language to a specific library. And don't forget the many, many projects that already exist in C -- if you want to extend any of those projects, you need to understand the language.
I always thought that assembly is not a bad teaching language either. It helps to understand how a processor works.
I would also recommend lisp, but that has already been covered in this thread.
Re:Why not C? (Score:2)
Now tell me, what is ONE thing you can do in C that you can't do in another language? And by another language I can mean anything from machine code, various architecture assemblers, C++, etc.. Now I would like you to list the things you CAN'T do in C, or are immensely difficult in C, but are quite easy in other languages (parsing anyone, memory management, Stack Frame manipulation, raw manipulation of registers - and n
Re:Why not C? (Score:2, Insightful)
Gotta weasle a bit: By saying "only choice", I meant "only reasonable choice".
Short of assembly, C (or its cousin C++) is frequently the only reasonable choice for embedded programming (and lets be honest, for big projects, assembly is quite often not a reasonable choice). When resources are low, C shines.
Re:Why not C? (Score:5, Insightful)
Once I knew that everything is a just a number (pointers, instructions, everything) and that memory is just one big linear array, nothing was a mystery anymore -- I could figure out what the compilers and other languages were really doing. This put me way ahead of average programmers my age until 4th year university when they forced everyone else to learn that stuff.
To be a good programmer I think you have to understand how computer really work, and C/assembly is the best way to pull back the curtain and be confident that you can get anything to work.
On a related note, when people are teaching object oriented C++ to beginners, it's common to focus on the high level stuff (encapsulation, polymorphism). What I'd like to see is for them to mix in a little bit of "and here's how you would implement polymorphism in C" -- then people see how it all comes together. Er, well, that's what I think :~)
Re:Why not C? (Score:2)
Re:Why not C? (Score:2)
TurboPascal was great.. (Score:2)
I did my programming in HS with TurboPascal, in a "Computer Math" class.
It was just me and a few honor-role students (lets just say I got bored easily, so I sluffed off.. I have no problems being a B student). None of them really had any aptitude for programming, but the language itself worked well for them because of the syntax. We wrote simple games, stuff to do our math homework and difficult calculations, and the like. I ended up writing a printing program for printing out our source code.
Great p
python is a good beginning (Score:5, Interesting)
You can start small by using the interpreter as a calculator, then move the caculations to a script and executing that. After a while you can gradually introduce variables, comments, functions and modules. After that, you could introduce the standard library and show how to print the contents of a file or download a web page. Or you could introduce the OO concepts of classes, encapsulation, polymorphism and inheritance. It's really up to you and how well your students are going.
Advanced students should also be able to create simple GUI or command line interfaces. Python has a great base class for command line programs that takes away most of the tedious parts. It also has some simple and easy database modules if you want to teach relational databases and SQL as well as programming.
But don't forget that the most important thing to do is to teach them how to teach themselves. Show how to look through the standard library for something new, or how to find and install new modules from the net.
When everyone has become comfortable with the language (and if you have the time) you can introduce a similar language for contrast. I've found that people who have experience with a wider variety of languages tend to be able to "grok" programs a bit easier than those who haven't.
Perl. (Score:5, Funny)
Ruby or Scheme perhaps (Score:2, Interesting)
PHP or Ruby on Rails; but are not convinced that they lead well into higher level languages.
Uhm, PHP and Ruby shouldn't be mentioned together like that. Ruby *is* a higher level language compared to PHP.
But that's not really important to a *beginning* programmer. What you really want to do is first teach the basics, then immediatelly teach about "best practices", like keeping code simple and clean, writing *TESTS*.. unit testing should be taught AS SOON AS POSSIBLE in my opinion. Ruby makes it easy an
C# or Java (Score:2)
Logo? (Score:3, Interesting)
I also remember learning Logo when I started at high school. That little turtle that pottered about on the floor was really cool, and it had all of the concepts that a programming language needs.... loops and conditionals! Having a real-world output from the program was a good way to inspire students to learn it - everyone really enjoyed it.
There are some gizmos now called the MicroMouse or somesuch. It's a little PIC powered rover that is similar to the Turtle. You program it up with a simple dialect of C, and download the code into the PIC. The development environment comes with all the libraries to make things like starting motors and reading switches easy from the C code. That might be a good way to teach the basics without boring students that otherwise don't see a use for it
Those that enjoyed it enough went on to study the more advanced stuff in later years of school.
Of course, my days in Logo were back when the BBC 8-bit micro was new and powerful.
Re:Logo? (Score:2)
I have to admit that I always envied the people who learned turtle graphics (at the time when it was au courant).
Re:Logo? (Score:2)
I feel better for having learned it. Gone are the good days of computing. Now it's all VisualCRAP.
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
Old Basic (Score:2)
I was thinking about this (from the perspective of what I would do to educate a promising youth with no programming experience who seemed to have a the right mind for it) same sort of topic a while back, and here's what came of it:
First, kill Visual Basic - that's just plain bad.
Also note that you'd need some good emulators or some old-school hardware for some of this (although you might be able to build/find new DOS-era hardware based on Intel's 386EX chip, I think they still make it for little embedded sy
Java, then assembly language (Score:5, Insightful)
Java:
- Is not too verbose (Hello World is not daunting)
- Any algorithm can be reasonably implemented
- Any structure can be reasonably represented
- No low-level complications like pointers
- Supports modern programming techniques like functional and O-O
- The student can do real-world things in it
- The student can experiment at home for free
Don't forget assembly!!
- Too many new programmers need to do something low-level, or interoperate with another language, and they have no concept how memory is arranged, what source code compiles down into, or even what a compiler does! They don't comprehend that a string isn't an intrinsic thing the CPU recognizes, and that there are hundreds of ways to store and manipulate them. So when they have to learn about memory-thrashing, multithreading, garbage-collection, optimization, etc. they are lost.
This must be taught this very early on, not as an advanced course, so that when they learn other lagnauges and algorithms they can see where it comes from.
Re:Java, then assembly language (Score:4, Insightful)
I agree highly with the point about assembly language. While I think no school should teach students to write serious programs in assembly, I'm shocked at the fellow programmers that I talk to today who have no real idea of what a 'memory overflow' really is, or why is it called a 'overflow', why not just 'insufficient memory'. They don't understand the differences between stack or heap, what is a null-pointer, and have difficulty in understanding concepts such as arguments pass-by-reference and pass-by-value (for object references).
When they start to use Java or
While I had no particular love for assembly or compilers back in the university days when I 'had' to write them to graduate, looking back, they laid a foundations of understanding what exactly is going on in the machine. I'm grateful for that lecturer whose name I've forgotten in the particular choice of assignment.
---
Anyway, I think people who want to take writing software seriously needs to know this stuff - sooner or later. It's like a carpentry artisan needs to know about wood, and not just about carving.
assembly! (Score:2)
AT-Robots or some other assembly-like language to teach them how to program with registers, conditional jumps, interrupts, and all that. They'll later realize they hate goto from this. But mostly it's really stinkin' fun, and they'll hardly realize they're programming. Instead they'll be thinking about the problem they're solving, trying to beat each other in competition.
Then a language like C, to learn about functions, loops of various sorts, pointers, maybe even function pointers. This is when i
Anything that starts with "C" (Score:3, Insightful)
Let me start this post by putting on my flame-proof suit. =)
In order of preference:- C++ - but don't move into the advanced features right off the bat. I like string handling better than C though, so it gets the nod for the top slot. But the user would have to learn the compile process. Templates, STL, and OOP can all be added once you have the basics down.
- C - pretty much on par with C++ in the features you would want to introduce to a beginner.
Ones I'm unsure on:- Pascal: I can't comment on this one, but it's supposedly well-suited for teaching.
Ones I wouldn't touch for intro programming because of syntax.These are all fine languages, but they all have specialized syntaxes, and the bridge between that, and their *next* language would be where you do them a disservice by using these ones.
Other poor choices:Perl, which has a reasonably decent syntax, but because of the TIMTOWTDI philosophy, it's actually, IMHO, an ill-suited introductory programming language.
PHP, while similar syntax to C/C++, has the benefit of not having to learn how to compile apps. It's ultimate downfall is it's scoping rules and lack of namespaces. This is stuff an intro programmer should learn about.
Re:Anything that starts with "C" (Score:2)
I think compiling should be a second year thing, at least for high school.
My order of preference:
Re:Anything that starts with "C" (Score:2)
Re:Anything that starts with "C" (Score:2)
Re:Anything that starts with "C" (Score:5, Funny)
Java is C++ without the giant rotating knives.
Java's "music" class library appears to support every musical instrument in the symphony but on closer inspection requires you to understand metallurgy before you can instantiate a trombone, and spit valves are in the open position by default. C++'s music library on the other hand assumes that all brass insturments are, at their most fundamental level, a kazoo. You can drive it with anything from bare lips to a jet-powered compressor, but despite Stroustrup devoting eight pages to protected abstract virtual base pure virtual private kazoo destructors, never once in the 20-year standardization process did anyone notice there is no member function called play().
Avoid all languages with big libraries (Score:2)
Good languages to start programming have a simple core library that does basic IO and data manip, and nothing else. The best are probably Scheme or
Bwa? (Score:2)
My experience (Score:2)
Go with PHP (Score:2)
1. It's an "instant gratification" language that makes it easy to get results.
2. You can do a lot of web based projects which teens should find interesting.
Yes, PHP has a lot of problems. It's very undisciplined. However, I think it's a good choice for a class where probably 80% of the kids won't ever program again.
What entices high school students? (Score:3, Insightful)
I think you will be able to attract students to your course by focusing on what you can do in the course and not on what language you get to use. A course on "Building a Blog", "Programming a Robot", or "Building an Online Store" is much more enticing than PHP or Ruby on Rails. When you watch a home remodeling show, they don't advertise it as the show with the coolest miter saws and wrenches. The show isn't about the tools, it is about the end product, a new deck, or new cabinets in your kitchen.
Since you are teaching new programmers, I will suggest languages and frameworks based on how easy they are to start using as opposed to how good they are in the long run.
PHP has excellent documentation. Although its function names can be inconsistent or duplicated (e.g. sizeof, strlen, count), it is fairly easy to follow the code. This would probably be the easiest well development platform to get started on without evaluating different components, since you really don't need to bother with libraries to do MVC for a beginners course. You definitely will want to set up PHP with "xdebug" so that PHP will provide you with a stack trace for your errors. Otherwise, you will only see the line number where the error occured, which is not very useful if the line number is inside a function that gets called in a hundred different places.
Ruby on Rails is a very large frameworks, and you are just throwing names around to suggest this for an intro course. Ruby, the language, and a basic html templating system might be easy to teach, but Rails involves the MVC pattern, object-relational mapping for database access, and an architecture for unit/functional testing. This is NOT good for beginners. The Rails tutorials will also give you a false impression of how easy it is by having you build a bunch of database driven web pages with very little code. After you finish the tutorial, you will still have a lot to learn.
Although I think Ruby is a more powerful language for an experienced developer than PHP is, it has a lot of syntax rules to learn. For example, curly braces {} could contain a block of code or an associative array, and "joe!" means run the joe! function, and "!joe!" is a boolean NOT operator acting on the return value of joe!
My personal favorite programming language is Python. It has a cleaner syntax than PHP or Ruby, although an amazing amount of new Python programmers are burnt by mismatched indentation between tabs and spaces. Python will treat a tab as the same indentation level as 8 spaces, but your text editor may be using a different value. Even though python tells you the line where the syntax error is, the error may be invisible in your editor. If you are interested in Python for web development, Zope involves learning too much infrastructure for beginners. You would be better off with Spyce.
Instead of making your students build things from scratch, they may feel likethey are accomplishing more by customizing an opensource program that alreadyexists. You can find a bazillion PHP web portal projects at http://freshmeat.net./ [freshmeat.net.]
C (lalalalala.. lameness filter sucks) (Score:2)
Python, natch. (Score:2)
Java's too verbose, C/C++ is too close to the hardware, and we probably shouldn't go that low for a fist language. PHP is too domain specific (and kinda cluncky). Ideally, your students would get a bit of exposure to several languages, so they can see some differences (typeing, etc)
Re:Python, natch. (Score:2)
Personally, I think VB.NET is an excellent beginner's language. It is simply easier to quickly get to the "making windows programs" stage (which is the interesting part) than Perl or Python. The syntax is more human-readable than java or C#, but is instructive for good technique since it supports full proper OOP. Finally, the rich framework and ability to build
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
Logo (Score:2)
Hey, it's what got me interested in programming. It's interactive so it gives instant results. It can teach the basics of algorithmic thinking without burdening the beginner with all the necessary quirks that go with "normal" programming languages. If they find they actually have a talent and interest in programming, a more conventional language can be used for a 102 course.
I've actually thought a lot about this question since my wife took a Java 101 c
Python is the perfect first language for learning (Score:2, Informative)
Crazy ideas (Score:2)
I always thought Inform [inform-fiction.org] would be a cool learning language. It introduces the concepts of objects in a very easy-to-grasp way. It's really easy to throw together a working game.
Also what about something like DarkBASIC [thegamecreators.com]? I haven't used it at all, so I have no idea if the syntax is intelligible (or if it teaches good programming practice). Think about how students would respond to something like this, though...
GAMES!
Making a reasonable case for PHP (Score:2, Interesting)
When I learned programming, it was painful to get past the strange things I didn't understand in C, C++ and Java's "Hello World" program.
Header files, main(), etc. It was intimidating to me, and I am far from the most intimidated by new concepts person I can imaging.
The reason I like PHP for a programming teaching language:
Are you sure that the PL is the problem? (Score:2)
What you need to do (and this is hard!) is to find out why students are turning away, and try to address those issues.
Python, all the way (Score:2)
This is what I started with, and found it very easy to from there learn Java, C, and C++.
Best Language (Score:5, Insightful)
Why not Tcl? (Score:2)
I think Tcl is a great beginner's language because it balances a shallow learning curve with a quite a lot of power. (More than most expect before they've tried it.) Although I hardly ever program, I've dabbled in C, C++, Java, VisualBasic, and Python, but Tcl was the only language that I felt at home with. I was writing useful programs (GUI programs, even) within 2 hours of discovering its existance.
A lot of OSS folks are put off by it's blindingly simple syntax:
[command] [arguments]
But this shouldn't be a
What is the goal? (Score:3, Interesting)
Back in high school, when I was first learning to program, I wanted some level of instant gratification. This is the basis of languages like Logo, where a core set of commands give a visual representation. But we can get similar results today in other domains.
losman mentioned [slashdot.org] UnrealScript, which I generally like, but still has some drawbacks. First, is the cost of the handful of Unreal licenses and the hardware to run them. It also assume the developers are on Windows (at least until UT2007), which may not be true for students at home. But beyond such technical issues, are you going to handle the distractions/complications of the additional media assets? As a teacher, if you're up to the challenge, you can take advantage of this to drawn in more students and allow students to follow their own interests within the environment. Ideally, students can group around projects where they all contribute based on their interest. Lastly, can you handle the parents (or tax payers in a public school setting) who see violent video games as inherently evil.
Web apps can offer similar instant gratification. The pitfalls here include maintaining a server that allows server side scripts and teaching HTML (and probably basic browser compatibility) along the way. Again, you need to decide whether hooking into additional media is going to be an advantage or distraction in the classroom.
One problem both of these share is the difficulties in tracing the stack. Their unique run contexts can make it hard to debug problems, which can be as frustrating for your students as it is for you trying to help them as project dues date approach.
That said, it is possible to bring the engagement of a game to other development platforms. A small top down arcade game can teach several core concepts, from simple data structures (lists of actors, multi-dimensional arrays of terrain, variables like position and health, event handlers from input or actor collision). Build an outside level editor and you can teach GUI development, file I/O, and string manipulation.
If you go the GUI and graphical route of a game, Java seems like a good match. I believe it works well in classroom scenerios. At the basic level, the virtual achine it free and platform independent. Several good IDEs are available, and I believe there is work on an Eclipse plugin geared toward students. The APIs are stable, self-consistant, and well documented, although exceptionally broad and thus easy for a novice to get lost in without guidance. And if you target applets, students have a simple way to show off their work.
I'm sure C# has basically the same benefits, but I don't know enough to comment on it. Given an MS grant for a Visual Studio lab, I wouldn't rule it out.
Python is also an option, but I would choose wxWindows over tkinter anyday. Being a dynamically typed language, you loose the support of a context sensitive IDE, but you gain the easy access to a shell-like evaluation environment, useful for allowing students to interactively test thier code fragements (actually, integrating Beanshell into a java app is both easy and useful). I've never found a debugging environment for Python I liked, but at least they exist.
Several other scripting languages could be mentioned here, but again I am not familar enough to comment on them.
Other posts have mentioned C, C++, and assembly. While I think they are all critical for a complete CS education, I am not convinced they are ideal for a high school introduction course.
However, if the target audience is more advanced, I would put C on the table before the others, especially if taught in an object oriented way to mimic modern programming practice. This is a great way to show what that C++ compiler or that Java or C# VM are doing on the metal.
Anm
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.
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
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.