Live data from Hacker News

Dijkstra on Haskell and Java (2001)

chrisdone.com

31–40 of 253 posts

Re: Dijkstra on Haskell and Java (2001)

#31
My old university has a big partnership with MIT, and the first programming course is, I believe, similar to MIT's.

I learned programming with Scheme, in that course, in 2004. I used, without noticing, many techniques I would later have relearn due to a "prolongued exposure to imperative programming". In my semester I used closures, functions as first class objects and lots of recursion.

The following three semesters I forgot all that, for I had to use C, C++ and Java. When, in the fourth semester, I had my AI course in Lisp, I used "let"s and loops for everything. In the middle of the semester, I remembered recursion, and how it made everything better (in Lisp). Later, by myself, I relearned closures, functions as first-class-objects and other stuff.

Having Scheme as an introductory language is good because it put students that came from a IT-technical high-school education equal to general high-school education students (that have never seen programming before). With the "real world" so drowned in imperative programming languages, there are few courses that can justify using a functional programming language. The things I know about FP, I know because I thought myself.

I'm not saying FP is better than imperative programming, is just that both should be (well) taught. (As some other paradigms too, I believe).

Some years ago my old uni, like MIT, changed from Scheme to Python. Python is my favourite programming language. But I'm still not happy with the decision.

Re: Dijkstra on Haskell and Java (2001)

#32

I would guess Haskell would be perfect if the goal is to produce academics. But if most of your students are destined for industry, Haskell is in my opinion the absolute worst language. - You'll probably get a high drop out rate because of the complexity (recursion, pure / first class functions etc). - You rely that your students already have experience at high school with imperative languages - The industry by far s…

> "The industry by far still don't use functional languages." What industry are you talking about? I note a few programming languages trying to introduce functional programming features into their languages

Re: Dijkstra on Haskell and Java (2001)

#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 learning basics of computer architecture at a high level and programming on a level close to the computer architecture that so far has turned out to be practical, the Von Neumann machine. This way they can understand the whole field better, if you never face the challenges of organizing computations in a computer without many existing layers of abstractions designed by other people, you will never understand the development of the field and how the disciplines of algorithms, operating systems, computer architecture, etc came to be the way they are, too many things are taken for granted by people who have only seen very high level languages.

People should know what the stack is, how function calls works, what is an assembler, what linked lists, binary trees, hash maps, ... are and why those had to be invented etc. I think something at the level of Go or C is best for that. Then I think a good moment comes for a course like SICP where people can learn how to take those pieces and build abstraction layers out of them.

Re: Dijkstra on Haskell and Java (2001)

#34
post #11
post #9

Earlier quoted context omitted.

Java is definitely a terrible language for teaching and as a student's first introduction to arrays, memory handling and flow control it's pure terrible. However, Java is incredibly effective as a language for large teams. Since most of the companies coming to hire CS grads are big teams in need of extra hands on their software projects, they are looking for CS grads who know Java. So Java in universities is generall…

> Java is definitely a terrible language for teaching and as a student's first introduction to arrays, memory handling and flow control it's pure terrible Sadly, teaching OS classes with Java is a thing: http://www.amazon.com/Operating-System-Concepts-Abraham-Silb...

That's not really a bad thing. First, no beginner is going to be learning about coding OSes so teaching the basics isn't a problem. Secondly, Java OSes are far more common than you'd think, although this was more true of 5 years ago when many phones/smartcards/etc used Java in their OS internals. A lot of the topics in OS concepts would probably be useful if you wanted to hack on OSS Android too. So I don't think there is anything wrong with that book which sounds more like an example and reference book on using Java in OS internals (received mention a shotgun approach).

I don't see any problem with teaching CS concepts in Java. The concepts of message passing or a heap are the same everywhere. I was referring more to the basics of programming where you should either teach at a very low level (pascal is great), or at a very high level (python can work). I think people taught originally in something low level like pascal or C often have the best understanding of memory management and what their instructions are doing.

If I was teaching someone coding, I'd probably start with Pascal (incl inline ASM), then any language based on lambda calculus to get a good understanding of recursion, and then Java in a large team environment so they could understand why encapsulation, delegation and code quality are important. It's a shame more classes don't actually just have all 100 students work together on a single code base - it would be incredibly beneficial. The code would likely be terrible with 100 newbies to Java all hacking in their own required feature to the detriment of everyone else. That would drive the lesson home quick!

Re: Dijkstra on Haskell and Java (2001)

#35
post #6

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…

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

Except that Scala already is ;). Haskell pretty much sticks to functional programming and resisted adopting other paradigms (e.g. OO via O'Haskell). Scala, on the other hand seems to adopt as many paradigms as C++.

Re: Dijkstra on Haskell and Java (2001)

#36
post #6

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…

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.

Re: Dijkstra on Haskell and Java (2001)

#37
post #3

A problem I've noticed in my degree is that for a certain percentage of students Java just doesn't stick. I'm in my fourth year now and there are plenty of people who just can't program, because they've only been taught Java, and they didn't get that. It's far too big a language to teach in a semester or two to a previous non-programmer. Even if it does sink in they rapidly find that the simplified Java being taught…

I think there are 2 ways of teaching programming at the beginning, although I'm not sure which is best.

1. Teach structure and organisation of programming. - Python is a good for this as it's object oriented, but has very little boilerplate and syntax getting in the way of learning. A few universities have done well using Haskell for this instead, and I think that's quite a good option, particular as it introduces types.

2. Teach from the perspective of how a computer works - C is probably the best one for this as it helps students understand how computers work at a more basic level, being closer to assembly and machine code. It also allows for memory to be thought of as a much more basic resource of the machine that users must manage.

Java would be good for teaching data structures and algorithms, but I don't think that should come until after an introductory class using one of the above methods.

Re: Dijkstra on Haskell and Java (2001)

#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.

Re: Dijkstra on Haskell and Java (2001)

#39
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.

It may be turning around now, but applicants for compsci at Cambridge were apparently getting pretty dire by 2006, and this formed a significant part of the motivation for the Raspberry Pi (http://www.raspberrypi.org/about)

> The idea behind a tiny and cheap computer for kids came in 2006, when Eben Upton, Rob Mullins, Jack Lang and Alan Mycroft, based at the University of Cambridge’s Computer Laboratory, became concerned about the year-on-year decline in the numbers and skills levels of the A Level students applying to read Computer Science. From a situation in the 1990s where most of the kids applying were coming to interview as experienced hobbyist programmers, the landscape in the 2000s was very different; a typical applicant might only have done a little web design.

I joined at about that time and found it noticeable that having experience with C++ and a few other languages marked me out as more advanced than many of the other students.

Also relevant to this discussion is that in the first term we learnt ML, a functional language. This was partially because of advantages in talking about algorithms in it, but also to put everyone on a level playing field and introduce something that even keener students won't have encountered before. We did Java later, which I found much less rewarding.

Re: Dijkstra on Haskell and Java (2001)

#40
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.

2005. Because I'd been exposed to HTML and some scripting, I was able to skip on ahead pretty quickly. I estimate that most of my class (about 100 CS students) hadn't had any prior exposure to programming. They dropped like flies for the first few months.

However, I went to a pretty poor University (ranked ~60th), I have no doubt that the numbers are very different in the top universities.

Post reply on HN