Live data from Hacker News

Dijkstra on Haskell and Java (2001)

chrisdone.com

41–50 of 253 posts

Re: Dijkstra on Haskell and Java (2001)

#41

I have to say that Java is the absolute worst language for pedagogy. Before people can write "Hello world", they're told they have to write "public static void main(String[] args)", which are presented as magic incantations, "don't worry about those yet". Thus begins the corporate-style coding culture of bashing stuff without understanding it. The stated reason for starting in Java is so that students can get coding…

Just because you should not explain to students what "public static void main(String[] args)" is the first day does not mean that you can never teach them. Actually, if your students cannot understand what this line is after one full class of Java, then the problem is with the teacher, not the students.

Having learned C and C++ before even touching Java, "public static void main(String [] args)" arbitrarily shoved inside a class is still an aspect of the Java that absolutely annoys the crap out of me. Before you even print "Hello world" to the screen, you're exposed to an obscene amount of opinionated design (classes! classes everywhere!). Given a competent instructor, students should learn to "break out of main()" as quickly as possible. However, the class where I actually learned Java formally had an adjunct professor who would put EVERYTHING into one class so that students wouldn't have to learn about code organization so early (IMO a huge mistake).

All of that aside, I find it amazingly stupid that a best practice for Java has you creating a specific class like MyCoolAppRunner with only one MAGIC function whose only job is to load ANOTHER class to handle the actual app. IMO C and C++ get it right by having main() exist in the ether by itself -- it indirectly abstracts the stack and heap in a way that makes MUCH more sense than the way Java handles things.

Re: Dijkstra on Haskell and Java (2001)

#42
post #33

To me there seems to be something wrong with using as the first language something that depends on a very, very complicated runtime and execution model to run on the hardware we currently are using. This way people end up viewing programming languages as some God-given black box and not just something another computer program written by another person provides for you. I think CS students should instead start by lear…

I disagree. The whole point of abstraction is that you don't have to care about the underlying mechanisms (although most non-trivial abstractions are leaky as Joel Spolsky has written about).

For instance, someone who writes assembly should not have to know how a transistor works. A course in introductory programming similarly should not be about how a processor works.

Re: Dijkstra on Haskell and Java (2001)

#43
post #6

Earlier quoted context omitted.

If Haskell is the C++ of functional languages, what, in your opinion, is the C of functional languages ?

The C of statically typed functional languages is OCaml.

Which is more complicated and less expressive than haskell? That seems like a pretty bizarre choice.

Re: Dijkstra on Haskell and Java (2001)

#44

I have to say that Java is the absolute worst language for pedagogy. Before people can write "Hello world", they're told they have to write "public static void main(String[] args)", which are presented as magic incantations, "don't worry about those yet". Thus begins the corporate-style coding culture of bashing stuff without understanding it. The stated reason for starting in Java is so that students can get coding…

While I personally agree with teaching something other than Java, there is one big advantage of Java you have overlooked-- as the core language is so simple, bugs caused by incorrect use of the language tend to be "shallow" (bugs caused by algorithmic mistakes can still be very complex of course). An easy example of this is compile-time errors -- the most complex compile time error you can get of Java tends to be not…

>Personally, I see Haskell as the C++ of functional language

You should try it some day, it is absolutely nothing like your misconceptions.

Re: Dijkstra on Haskell and Java (2001)

#45
post #16

Dijkstra assumes that students will already have been exposed to imperative languages before joining university, and will appreciate the change. I think that this assumption might leave behind students that have not yet been exposed to any programming (that stuck). Over in the UK I certainly hadn't encountered anything more complicated than html before I hit university, and was very happy with sticking with Java for…

What year did you enter university? I know the number of kids exposed to programming before university now is much higher than it was when I entered in 1996. I think it's safe to assume (but would love to have some real data) that most CS freshmen these days have dabbled with at least one of the mainstream imperative languages before they hit uni.

I'm a second year CS major. That's not a safe assumption. Some of them learn to swim, and some of them drown. A guy in my CS1 class last year (there was no placing out) failed to comprehend the concept of words controlling a computer.

Further evidence is the four class intro sequence steadily had fewer sections (of the same size) with each passing term

Re: Dijkstra on Haskell and Java (2001)

#46
As much as I enjoy Dijkstra's wit in general (and I agree with the argument for learning functional languages early), I imagine taking a shot at "Texas's solid conservatism" didn't help his case all that much. For "enlightened" individuals, most left thinking and academic people are really no better at mitigating tribalism, prejudice, and ignorance of other points of view than the far fringes of the right. Perhaps it would have been more effective to appeal to the self interest of the council.

Re: Dijkstra on Haskell and Java (2001)

#47
post #16

Dijkstra assumes that students will already have been exposed to imperative languages before joining university, and will appreciate the change. I think that this assumption might leave behind students that have not yet been exposed to any programming (that stuck). Over in the UK I certainly hadn't encountered anything more complicated than html before I hit university, and was very happy with sticking with Java for…

> Dijkstra assumes that students will already have been exposed to imperative languages before joining university

For those entering CS, this is probably true. But it's also probably true that that's because of the students' own initiative to investigate a topic that interests them.

I think high schools have gone the opposite direction. In the 80s, most high schools had some sort of computer class (often taught on TRS-80s or C-64s). These were introductions to programming taught in Basic.

Nowadays, most high schools still have a computer class. But now its Word, Powerpoint, Excel, and build a (static) web page. (There are, of course, some high schools with much better programs.)

Re: Dijkstra on Haskell and Java (2001)

#49
post #38
post #33

To me there seems to be something wrong with using as the first language something that depends on a very, very complicated runtime and execution model to run on the hardware we currently are using. This way people end up viewing programming languages as some God-given black box and not just something another computer program written by another person provides for you. I think CS students should instead start by lear…

Your first paragraph seems to be entirely nonsense. Almost everyone was first introduced to a high level language. This did not prevent anyone from understanding that those languages are themselves software, written by people. In fact, you generally have to take a whole course on compilers.

Knowing the single fact that a language is ultimately a piece of software is different from having an intrinsic understanding that each high level construct has to be somehow translated to what the computer can do. Everyone learns the fact "compilers provide programming languages" pretty quickly, but beginning programmers don't get early enough into the habit of thinking how what they write in a high level language translates to what the actual computer does, and they end up with broken programs. Whether you are using Haskell or Java, if you don't understand the execution model it's trivially easy to run into problems with memory management, like reallocating memory over and over when growing collections, exploding the stack via inefficient recursions etc. etc.

Re: Dijkstra on Haskell and Java (2001)

#50
post #16

Dijkstra assumes that students will already have been exposed to imperative languages before joining university, and will appreciate the change. I think that this assumption might leave behind students that have not yet been exposed to any programming (that stuck). Over in the UK I certainly hadn't encountered anything more complicated than html before I hit university, and was very happy with sticking with Java for…

I spent my first few undergrad years as a CS major at UT before this change happened, and had no prior experience with programming (I started in '97).

The INTRO-intro CS class at the time actually used Pascal, and was endlessly confusing to me as a cold beginner.

My next course, however, was taught in Scheme, and immediately I felt more at home. And for the first time, I felt like I might have some actual aptitude for programming.

Without that peek into the elegant heart of computer science, I doubt I'd have stuck with it as long as I did.

Post reply on HN