Live data from Hacker News

Dijkstra on Haskell and Java (2001)

chrisdone.com

171–180 of 253 posts

Re: Dijkstra on Haskell and Java (2001)

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

Up until about a decade ago, most CS graduates from MIT were never taught C or Java in any class. They still seemed to do pretty well in the job market. (Mostly it was assumed that if you really liked software development, you would go out and learn one of those languages outside of class, such as from a student-led seminar.)

Ah, yes, I remember those days (different university though). Our first class was programming in Pascal, and all subsequent programming classes were "deriving algorithms and proving them correct"-classes (a la Dijkstra). In other classes, like user interfaces, OO-programming, mathematics, computer systems, all kinds of projects, AI, and so on, the assignments had to be done in a particular language and it was up to us to learn it ourselves in addition to the classwork. So I had to learn and used java, c, c++, Delphi, PHP, prolog, bash, mathematica, matlab, haskell, ASM, python, and latex (although I could be forgetting some DSLs). It was fun though :-)

Re: Dijkstra on Haskell and Java (2001)

#172

Earlier quoted context omitted.

Or you can say: "Don't worry about this now , we will explain it later" :-)

Compare to this: #include int main() { printf("Hello world!\n"); return 0; } Woo! Your first program and I count, at most, 2 things that could be described as "magic" for someone who's never seen C before (the stdio library and double quotes being syntactic sugar for an array of chars). Even then, those two things are deterministic, so they won't remain magical for long.

"But what does 'return 0' do?" "It returns the value zero to the calling process." "Calling what?" "The process. Usually it will be the shell." "Wait, you just said process, what is this 'shell'?"

Re: Dijkstra on Haskell and Java (2001)

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

I have written quite a bit of Haskell, I'm not sure what you think is wrong with my belief. Also, I like C++ :)

Both are fairly big complex languages with horrible error messages, horrible compile times (if you use template haskell in particular), with a whole bunch of gotchas you have to learn to get good performance (the haskell gotchas are very different, and often based around lazy evaluation / memory bloat). Both have sharp edges that come from being old languages which have evolved over time.

However, both languages are good in practice for actually getting things done.

Re: Dijkstra on Haskell and Java (2001)

#174
post #130

Earlier quoted context omitted.

Same here. There are two camps in my "alma mater". Those that think that students should learn programming with a simple and "clean" language, and those that think students should focus on widely used languages. They too abandoned Scheme which means that student don't learn any functional language. I think it's a shame considering that functional paradigms are getting more and more commonplace. (However, I much prefe…

I can kind of see the point of going for "widely used languages", but if you don't want to use scheme or haskell, then at least go for c, c++, python, or javascript. A Java Hello World requires a ton of OOP boilerplate, and you're stuck either explaining OOP as the very first you do (which is stupid), or asking your students to either ignore the boilerplate or recite it as a magical mantra.

Well, argc and argv were a magical mantra to an 18-year-old reading K&R...

Edit: I was 22, not 18. Time flies.

Re: Dijkstra on Haskell and Java (2001)

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

Picking on one small point:

My experience of teaching is that a little knowledge of assembler is a dangerous thing when it comes to modern programming. Writing good code for a modern amd64 processor with deep pipelines and vector instructions has almost nothing to do with teaching simple assembler. Students often get the Idea they should do things like limit the number of local variables they use, not realising c or c++ compiles will turn their code in Single Static Assignment almost straight away.

Re: Dijkstra on Haskell and Java (2001)

#177
post #101

For serious students of the subject, kicking off with an unusual language can be helpful. As another noted: if the student hasn't even started programming prior to college, s/he is likely not of a succeeding mindset as the bulk of other students already grasp programming. Starting college, I'd already learned assembler, BASIC, and Pascal - all what Dijkstra was warning against over-ingraining; proceeding to C would h…

"if the student hasn't even started programming prior to college, s/he is likely not of a succeeding mindset" Clearly it couldn't have anything to do with a lack of access to resources, or simply developing an interest in programming later in life than you. Starting later may make them less likely to succeed, but saying that it is probably because they don't have a "succeeding mindset" is quite a privileged sounding…

Sorry if the "mindset" comment seems offensive. New students unfamiliar with the topic are up against others who have been programming for years already, who (sometimes regardless of opportunity) managed to get programming books from the library/web, found an affordable computer to work on, and despite any/all hinderances made it happen - to wit, a succeeding mindset.

It was a casual comment in a casual conversation. Apologies if it rubbed you the wrong way; please focus on the well-meant point.

Re: Dijkstra on Haskell and Java (2001)

#178

My personal opinion - the best languages for learning are script-able, dynamically typed languages like Ruby or Python. You can build very basic programs in a procedural or functional style, and then get introduced very softly into the world of OO. Haskell is great in some ways, terrible in others. Like the fact that you can't apply a normal function to a monad, and monads are hidden with do Lisp/Scheme are conceptua…

You can't apply normal functions to monads? Since when? Or what is a 'normal' function?

Re: Dijkstra on Haskell and Java (2001)

#179
post #153
post #133

Earlier quoted context omitted.

“Computer science is no more about computers than astronomy is about telescopes.” - Dijkstra It was just too relevant in this case...

How much weight would you give the opinion of an astronomer (today) who didn't know how to use a telescope?

I don't know. But I could imagine a theoretical computer scientist that didn't really know how to program, or 'use a computer' (I don't necessarily think that that is likely, but I think it might be possible). I had a TA in an algorithm course who claimed, when asked about which data structure was most appropriate for a certain algorithm, that he didn't really know anything about data structures (his background was pure math).

This might be a useless point in the context of something like an undergraduate degree in computer science, though. I guess it is a matter of how theoretical the program is.

Re: Dijkstra on Haskell and Java (2001)

#180
post #130

Earlier quoted context omitted.

Same here. There are two camps in my "alma mater". Those that think that students should learn programming with a simple and "clean" language, and those that think students should focus on widely used languages. They too abandoned Scheme which means that student don't learn any functional language. I think it's a shame considering that functional paradigms are getting more and more commonplace. (However, I much prefe…

I can kind of see the point of going for "widely used languages", but if you don't want to use scheme or haskell, then at least go for c, c++, python, or javascript. A Java Hello World requires a ton of OOP boilerplate, and you're stuck either explaining OOP as the very first you do (which is stupid), or asking your students to either ignore the boilerplate or recite it as a magical mantra.

Personally, I'm actually pretty hostile to the "widely used languages" camp. I think that position is founded on an implicit assumption about the students' abilities that is both unkind and unuseful: That they won't come out of the program with solid enough skills and knowledge that they can quickly learn any industry language they need. It also implies that the program has lost sight of its reason for existing. Universities have a responsibility to give their students the kind of academically demanding college-level computer science curriculum they're shelling out those huge heaps of money for. There's nothing inherently wrong with putting together a curriculum that just focuses on ticking off the things that show well on a resume, but if you're going to just be offering that level of education then you should do the honest thing by presenting it as a vocational program and pricing it accordingly.

I think the aforementioned assumption about students's ability to learn a lot of different languages a self-fulfilling prophecy, too. Anecdotally, the fresh-outs I've worked with who are least able to pick up new technologies tend to be the ones who came through programs that focus on widely used languages like Python or Java. They tend to have only acquired a superficial understanding of the tools they were taught in, and have very limited understanding of the underlying principles that they're built on and share with other technologies.

Which isn't to say that students shouldn't be exposed to those languages. For more advanced courses, switching to widely-used languages is an absolute must because those are the ones that tend to have the kind of library support that's necessary if you want to be able to focus on the subject at hand. For example, you're not going to get anywhere in a machine learning class if you're hobbled with a language that doesn't have a really good vectorized math library available. And even without that, schools do still have a responsibility to put a marketable language on their students' resume before graduation day.

Post reply on HN