Live data from Hacker News

Dijkstra on Haskell and Java (2001)

chrisdone.com

81–90 of 253 posts

Re: Dijkstra on Haskell and Java (2001)

#81
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…

> might leave behind students that have not yet been exposed to any programming

And good riddance. If you make it to university without exposing yourself to your subject as a matter of passion (and few subjects are more easily approached by hobbyists than programming) you're going to waste your time there.

University is a not a "school" you attend for learning a subject. You can't show up for English Literature if you have never read a novel. You show up at the music department if you don't already play an instrument very well. You can't show up at Zoology if you can't tell a reptile from a mammal. You can't study Economics if you've never heard of Keynes. And you can't study computer science if you can't program a computer.

This was not always the case for programming, but it certainly is today, and I'm not convinced it wasn't too in 2001.

Re: Dijkstra on Haskell and Java (2001)

#82
post #75
post #65

Earlier quoted context omitted.

Please, don't get me wrong, but why would someone with no programming experience pick compsci? It's not exactly a sexy career (for every übergeek in shorts with a Macbook Air there is an army of corporate drones with comporate-issue desktops using whatever tools corporate IT mandates, wearing corporate-standard neckties), it's difficult (to do it right) and financial return is far from assured.

I went to search for the data to throw in the face of these assumptions, and found some corroborating evidence :) http://www.studentbeans.com/student-money/a/degree-courses-w... According to these numbers, of the 2006/2007 graduates in the UK, Computer Science had the highest unemployment rate after 6 months (10%).

If you do it for the money (even if you get good money), you'll lead a miserable life.

I taught many aspiring programmers over my career and it's painful to see the struggle some go through contrasted with the ease the "naturals" have. Programming classes can't turn you into a programmer any more than swimming classes won't make you a fish. A good teacher will help you become a good programmer, but only if you have the knack [1].

1- http://www.youtube.com/watch?v=CmYDgncMhXw

Re: Dijkstra on Haskell and Java (2001)

#83

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…

> Before people can write "Hello world", they're told they have to write "public static void main(String[] args)"

Bootstrapping is hard. My introduction was in Fortran, and I had written a couple of sort implementations before I ever learned to enter an array by any means other than hard-coding it into the program. Kernighan and Ritchie did an excellent job with bootstrapping programming concepts in their book on C.

And, somewhat off-topic, but since you mentioned Hello World and I mentioned K&R, it's worth noting that K&R's meaning when they said that Hello World was the first program you should write in any language was that you need to be able to run something. You have to be able to enter the program, compile it, link it, run it. Today a book can offer an example for Linux, one for Windows, and one for Mac and cover nearly everyone. Not so simple in 1978, when K&R first came out, so they basically tell you to get Hello World running with the help of a local expert (perhaps a teacher), and then come back to the book and start learning.

Re: Dijkstra on Haskell and Java (2001)

#84
post #69

I do most of my programming in Java and I'm convinced I want to learn functional programming, just to broaden my thinking. What are some considerations regarding starting with SICP book/Scheme vs. Scala vs. Closure vs. Haskell?

Personally I prefer Haskell because it's pure. Here's some good book: http://learnyouahaskell.com/ Scala is just Java+FP, so I use it as a replacement for Java development.

Re: Dijkstra on Haskell and Java (2001)

#85
post #44

Earlier quoted context omitted.

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.

Haskell is a relatively difficult language to try. Introductions and books almost seem to expect you to understand the syntax when you begin. And I/O is introduced late, which makes it hard to play around with.

Re: Dijkstra on Haskell and Java (2001)

#86

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…

A lot of the arguments against Java seem to focus on "Time-to-Hello-World". While I agree that the first time you execute a program and see those magic words appear on your terminal, I don't think we should judge a language on that. Visual basic has a very short TTHW (esp. if you take into account the time spent on learning about terminal emulators for most languages), that doesn't make it a good language.

If you take an OO programming language as your teaching language, you need to introduce a number of concepts first.

Hr 1: Talk about classes and objects. Introduce the Car and Bike object, that both have the method 'steer()', the attribute 'wheels' and only the car has the property 'hood'. Introduce return types here, as well as arrays.

Hr 2: Then explain how the 'color' on Car is public, while you'd like the accelerate() method to be private.

Hr 3: Explain how some methods and attributes are static. what is a property of the concept 'Car' and what is an attribute of an instance?

In Hr 4 you introduce them to the classes String and System.

Your students will now know:

-class -public -static -void -String[]

You can now tell them about the 'magic' that makes things start, the 'main' method.

Class MyFirstProgram { public static void main(String[] args) { System.out.println("Hello World"); } }

No magic, and a nice start to becoming a proper OO-programmer.

If you want too teach them FP, Haskell is not a bad way to go. If you want to teach them OO, Java isn't as crappy as people say it is.

Re: Dijkstra on Haskell and Java (2001)

#87
post #69

I do most of my programming in Java and I'm convinced I want to learn functional programming, just to broaden my thinking. What are some considerations regarding starting with SICP book/Scheme vs. Scala vs. Closure vs. Haskell?

You don't want to have to learn how to use a dynamic language effectively at the same time as learning how to do functional programming, so unless you already know python/ruby/similar I'd say you want a strongly-typed language, i.e. Scala or Haskell (or OCaml, which might actually be the best middle ground if you're willing to try it). Haskell would very much be jumping in at the deep end; it's elegant, pure, and forces a very different way of thinking. OCaml is a bit less purist, still quite elegant, and doesn't perform as well as the other two if that's a consideration. Scala is inelegant, but has seamless integration with Java and similar syntax; if you want to start incrementally it's the best choice, but you may find you're slower to adopt a functional style, because you can write "java-in-scala" and it'll work.

Re: Dijkstra on Haskell and Java (2001)

#88
post #63
post #42

Earlier quoted context omitted.

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.

It's trivially easy to write perfectly valid looking Haskell programs that are abysmally slow because of how they are actually executed, and since the reason for this can't be explained at a level of abstraction of such a course, people learn to treat the language as a closed black box, while you can't really competently use any language without understanding its execution model. Abstractions are fine, but you have t…

As Brian Beckman explained, as an aside, in "Don't fear the Monad" [1], these two differing views were born in the '70s and split two programmers into two camps:

The bottom-up people, and the top-down people:

- The bottom-up people start with the hardware and only add abstractions and trade performance where necessary (fortran, c, java)

- The top-down people started with perfect abstraction/logic and reduced/removed abstraction to get access to the hardware and performance where necessary (lisp, ml, haskell)

I don't think the two camps may ever get along. Kind of like our version of Conservative and Liberal. (nor should they, in the true spirit of democracy?)

[1] http://www.youtube.com/watch?v=ZhuHCtR3xq8

Re: Dijkstra on Haskell and Java (2001)

#89
My lineup was: Intro1/2: C++. Systems: Assembly. Data Structures: C++. Unix Systems: C/perl. Algorithms: C++. Software Engineering 1/2: Java. Networking: Java. Architecture: C/Assembly. OS: C.

SEng1/2 was introduction to Java/design patterns. That's it. It was the largest waste of time. Then, the holy grail, networking! That professor really threw us into the dark sides of APIs and tortured us. Very little direction and ridiculous projects. That's where I 'learned' Java.

Three years later, I cannot remember Java. I do not recall how to handle the Arrays or anything of that nature. I can still rehearse C++ code off the top of my head! There was no functional programming at my uni in _any_ course.

Re: Dijkstra on Haskell and Java (2001)

#90
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…

> might leave behind students that have not yet been exposed to any programming And good riddance. If you make it to university without exposing yourself to your subject as a matter of passion (and few subjects are more easily approached by hobbyists than programming) you're going to waste your time there. University is a not a "school" you attend for learning a subject. You can't show up for English Literature if yo…

Plenty of computer science students at my (SICP-using) university had never programmed before attending, yet they're great at it. Your attitude is especially damaging to female students, who are even less likely to lack programming experience. Computer science isn't even about programming all that much.

> You can't study Economics if you've never heard of Keynes.

Have you ever even been to a university?

Post reply on HN