Java vs. Scheme in Education
innoq.com
innoq.com
As easy as learning a dysfunctional one if not easier.
Now scheme may not be the best example of this as its syntax is entirely alien (then again all syntax is, when you've never developed), but the canonical is the following statement:
x = x + 1
If you've never developed before, the only place where you've seen something like this is maths, and in maths this is completely nonsensical.So learning imperative programming does require lots of deprogramming and reprogramming of your brain. Which make up most of the hurdles of learning an FP (or logic, or dataflow, ...) language later on: your brain (or its section that has to do with development) has been baked in imperative idioms and methods, FP languages not only don't use these but use completely different techniques to solve the same problems, so you have to "unlearn" the old ones and "relearn" the new ones.
Now, I'm sympathetic to your final paragraph, but having never taught functional programming to anyone, I can't corroborate it. Personally, I went through something similar when first learning how to think functionally.
It is akin to writing a text in your favourite text editor versus writing a text in Word. The latter will distract you with mark-up, random auto-'correction' and other diversions I'm still repressing.
The best thing one can do is get The Little Schemer[1], download DrRacket[2] and go through the book.
[1] http://mitpress.mit.edu/catalog/item/default.asp?ttype=2&...
The difficulty could be due to the brain damage C++ causes. Before I get incinerated, I have to remind you of Dijkstra quote about BASIC ("mutilates the mind beyond recovery").
Both BASIC and C++ (and Java, Smalltalk and so on) fixate several ideas about computing that make it harder to understand very different concepts. In a sense, that qualifies as mild brain damage.
I learned programming with BASIC on an Apple II+, went through FORTH (GraFORTH), C, Pascal, APL (The write-only language) and FORTRAN (in college) and later learned OOP with Smalltalk (and worked a bit with Actor). Did a lot of VB too (I had bills to pay), Perl, Java and Python. For obvious reasons, I don't completely agree with Dijkstra on the BASIC thing. I never liked C++ much, possibly because I learned OOP with Smalltalk and C++'s OOP seemed to me a misappropriation of the acronym. All things considered (it took me 8 years and a job offer to decide to learn C++) Smalltalk damaged me beyond recovery.
In the second half of the course, where you learnt Java and OO, was totally confusing to most those who'd just learnt Haskell as their first language and many people who got great grades on the Haskell part failed the Java part.
So it would seem that whatever you learn first is easy and normal and whatever you learn after that is confusing and difficult.
But a couple months ago I decided to give it another go with Scheme and I have been pleasantly surprised by how much more natural it seems to me. I'm having fun!
void main(String args[]) { ...
(DrJava)
That said, the amount of boiler plate code to do anything in Java can make it quite confusing... though, Scanner has made the input easier, and System.out.println() doesn't seem too much more than memorization.
But when you are learning how a car works and trying to build one, you would start off with one with manual windows and no power steering.
You shouldn't ever find yourself in the situation where you think an IDE is magical and "javac" is a typo of the word "java".
You have to download the jdk and set an environment variable. Then open a text editor. That's about all the 'worrying about the environment' that you have to do before you can start programming in Java.
With scheme, you download Racket or whatever (equivalent to downloading the JDK), you open it, and you start typing and getting instant feedback in your window.
No, you also have to think about various command-line tools invocation (java and javac for starters)
Use "javac" to compile to byte code. Use "java" to run your compiled program. This is all you need to know about these tools to start programming. There are various options for using java and javac, of course, but it's not like you can't compile and run a simple program without these options.
As for this part of your comment:
create a file, name it correctly, put the same name inside with a `class` statement whatever that means, then put braces everywhere and a `main` and a `String[]` which you don't know jack about
Yeah. You have to know a bit of Java before you actually start programming in it. If that's one of Java's shortcomings, well then, there are a lot of languages with the same shortcoming.
This is not true. There are statitically typed languages, usally functional, with a read-eval-print-loop. Haskell, Ocaml, SML, F#, Scala are the main ones I can tink of. There are many more. I will also note that your parenthetical is slightly inaccurate in that jvms usually JIT bytecode and don't just inteprete it straight.
http://stackoverflow.com/questions/3265357/compiled-vs-inter...
Lunaryom is correct. There are no 'interpreted' and 'compiled' languages, just different implementations. So, I was wrong in my original post. It would appear that you can just type and get instant feedback in Java (if you use Beanshell, for example).
Several weeks into the semester for Java, a student asked me what "public static void main" meant. I started giving him the correct answer when I stopped myself: his background did not prepare him to even understand my answer. I then told him, "I'll give you the real answer in a moment, but don't worry if you don't understand it. For now, it's the magic you have to tell the compiler to get your program to work."
I call it "magic" because it is something the student have to write without understanding what it means; for them, it is indistinguishable from a magic incantation. The less magic a student has to recite to get a working program, the lower the barrier to entry.
This is a great excuse, but uninteresting in discussing the relative fitnesses of Java and Scheme for teaching. Unless you want to take Java down one more peg.
> So, what you're saying about Java goes for just about any compiled language.
That's not even correct, many compilable languages also have REPLs, any compiled language can be interpreted (you just have to compile it on the fly). Haskell and OCaml can be used in a REPL, so can Erlang (though the Erlang console is quite far from a full repl).
> Use "javac" to compile to byte code. Use "java" to run your compiled program. This is all you need to know about these tools to start programming.
That's actually quite a lot, compared to "launch this, and then start playing". And you have to invoke `javac` for every single source file and with the correct options (the main issue for beginners generally being the classpath configuration).
> There are various options for using java and javac, of course, but it's not like you can't compile and run a simple program without these options.
You can run a trivial program without most of these options, but to reach simple you'll very likely need -cp early on.
> Yeah. You have to know a bit of Java before you actually start programming in it. If that's one of Java's shortcomings, well then, there are a lot of languages with the same shortcoming.
Yep. And that makes them worse teaching languages. I am happy you agree.
Once the JDK and environment have been set up by the sys admin, the tools are just available to the end users.
It's not, and I'd like to understand where you got such a thing from.
http://osteele.com/archives/2004/11/ides
Perhaps out of date now, given what IDE's can do, though I personally still prefer to learn a language and toolchain with a text editor, then graduate to Eclipse for the benefits you mention.
But did you learn a huge amount about programming?