
Dijkstra on Haskell and Java (2001) - prajjwal
http://chrisdone.com/posts/dijkstra-haskell-java
======
stiff
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.

~~~
jimktrains2
> CS students

I think CS students should be taught computer science, not software
engineering.

~~~
laureny
They should be taught both. Too often do I see people coming out of college
with strong theoretical roots and absolutely zero clue on how to use a
debugger, a source control system or the slightest idea of how a software
project goes.

~~~
Systemic33
Then they should have picked Software Engineering instead. There is a reason
both exist.

------
bunderbunder
Around the same time, my alma mater was switching from Scheme to Java for
their introductory courses.

Last time I went back to homecoming, it seemed that most the professors were
feeling pretty dissatisfied about the decision. One of the big reasons
mentioned was that Java's just too big and hairy of a language. They end up
spending all their time teaching API quirks and software engineering
principles (such as pretty much the entire subject of OOP), leaving little
time to focus on much more important basic skills such as breaking a problem
into smaller pieces and attacking a problem in an organized manner. Or even
simple stuff, like the difference between a value and a variable. They also
lamented the loss of a REPL, which is an invaluable tool for enabling (and
encouraging) students to experiment and get a better understanding of how a
programming language actually works.

For my own part, I wonder if the current cultural unfashionability of OOP
isn't somehow a result of the vogue for switching CS programs over to Java
around the turn of the century. I find myself thinking that what a lot of
newcomers to FP seem to think of as problems inherent to object-oriented
programming are really just problems inherent to not having worked your way
through SICP during your formative years.

~~~
yodsanklai
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 prefer OCaml to Scheme).

~~~
pdpi
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.

~~~
bunderbunder
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.

------
hesdeadjim
I went to the University of Texas right before they made this change and I
will say that my Programming Language course using Haskell was one of the
toughest classes I took there.

I was barely a novice at an imperative language, and all of a sudden I had the
comfortable struts of local mutable state ripped out from under me. Having to
solve most problems via recursion was incredibly challenging at that stage and
I'd be lying if I said I left that class feeling like I understood Haskell.

That course did have the desired effect that Dijkstra was hoping for though. I
never programmed functionally in my coursework after that, but it stuck with
me and the feeling that "there is something different out there" in the
programming language world has forced me to never be satisfied with one
language or one approach to solving a problem in my professional life since
then.

------
ElliotH
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 at first year undergraduate level is far below the standard required
for real world Java programming.

~~~
RyanZAG
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 generally the ivory tower being forced by business
constraints to adapt to outside business interests.

My university down here taught in Scheme for the introduction and theory
classes, and in Java for algorithms and networking. Seemed to work well as a
balance, although I'm not sure if they still do that.

~~~
danielweber
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.)

~~~
RyanZAG
It's just a business thing. Some large local companies come and talk to the
university and say that they need a bunch of CS grads to fit into their
business. The HR drone says they need to know Java to be able to integrate
into the company quickly. The lecturers get upset. The finance department gets
promised a donation, the marketing department gets promised easy job searching
for CS students. The ivory tower crumbles a bit and the lecturers teach Java.

~~~
danielweber
That might (might) explain a tiny college, but it's not a reasonable
explanation for universities with huge endowments to switch from Haskell to
Java.

~~~
RyanZAG
Yet they swapped - which is either explained by some love for java (unlikely)
or that "more money is more good" even with a huge endowment.

~~~
yongjik
Well yes it is easily explained by some love for java, why would that be so
unlikely?

Computer Science is a diverse field, and not every CS professor considers
mutable global variable an evil to be purged. (In fact, the majority of CS
professors can't be bothered to think about such matter. They're busy tuning
their neural networks, photorealistic simulation of snowflakes, improvements
to TCP or whatever their particular research interest is. The answer to "Java
or Haskell?" for them is "whatever that suits my need.")

------
timje1
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
the entirety of first year. I had been exposed to C++, ADA(!), Prolog and had
an in depth look at Erlang by the time my course finished...

~~~
mseebach
> 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.

~~~
sbov
Many of us went into college without the privilege of having a good idea of
what we wanted to do with ourselves.

In addition to that, among my circle of friends, it's common to know people
who switched majors mid-school because they stumbled upon something they found
more interesting - isn't that great? They thought they loved something, but
found something they loved even more. Or, I guess they should have just been
given the boot instead.

~~~
tbrownaw
_Many of us went into college without the privilege of having a good idea of
what we wanted to do with ourselves._

Yes, it's quite silly that college is mandatory rather than somewhere you go
for the purpose of learning something in further depth.

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

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

------
dxbydt
I can't help but notice that the vast majority of commenters are missing the
fundamental reason for all this handwringing. The reason isn't language schism
(that too, but I'd attach a much smaller weight to it) so much as the schism
between corporatism & academia.

Corporate America wants languages that are dumb, easy for corporate drones to
assimilate, hard to mess up with, verbose ( verbosity is misinterpreted as
documentation in the enterprise) and Java fits the bill from the get-go.

Now, that doesn't mean you can't do non-dumb things in Java - at Sun
Microsystems, we worked on all sorts of very cool R&D-type shit like
JavaOS([http://en.wikipedia.org/wiki/JavaOS](http://en.wikipedia.org/wiki/JavaOS)),
Hotjava (
[http://en.wikipedia.org/wiki/HotJava](http://en.wikipedia.org/wiki/HotJava)),
JavaSpaces
([http://en.wikipedia.org/wiki/JavaSpaces#JavaSpaces](http://en.wikipedia.org/wiki/JavaSpaces#JavaSpaces)
), JavaCC(
[http://en.wikipedia.org/wiki/JavaCC](http://en.wikipedia.org/wiki/JavaCC) ),
Jini ([http://en.wikipedia.org/wiki/Jini](http://en.wikipedia.org/wiki/Jini)
), ...a very long list of R&D stuff. Sun Research was fucking elite, & staff
engineers were considered outright geniuses. None of that cool R&D shit got
any traction.

So what got traction ? Whatever yucky shit corporate America wanted -
JavaBeans(
[http://en.wikipedia.org/wiki/Java_Beans](http://en.wikipedia.org/wiki/Java_Beans)
), EJB ([http://en.wikipedia.org/wiki/EJB](http://en.wikipedia.org/wiki/EJB)
), Swing
([http://en.wikipedia.org/wiki/Swing_(Java)](http://en.wikipedia.org/wiki/Swing_\(Java\))
), various sorts of form-builders, table widgets, reporting shit, IDEs,
classfile obfuscators,...

So Java became that. Rather than go down the R&D route, the pipeline became
more corporate America oriented.

Haskell has always had very deep roots in academia - the focus on enabling the
corporate American drone with Haskell is minimal, close to zero. So what do
you expect ? The focus will be on debating types & building theorem provers,
not on "how to show big bank's fourth quarter report in 3 colors with 7
columns and subtotals in single widget while data-binding seamlessly occurs in
middle tier using enterprise beans built from beanfactoryfactory" \- this sort
of shit that is commonplace in the Java EE world I inhabited post Sun, would
be considered positively gauche in Haskell.

~~~
kunai
Perfectly put. I'm having to take a VB.net course to advance to the next level
of my high school's CS curriculum, if you could even call it that.

It's painful as hell, and like you said, makes me feel like a corporate monkey
who's writing some ugly code for use in some specific pants-on-head retarded
enterprise "app."

~~~
discreteevent
If you think that kind of work is retarded then don't get fooled by the
languages and tools. A lot of the web stuff is just the same as VB. Just
because its ruby or clojure doesn't take away from the fact that its just
CRUD. Try and get into an interesting domain and don't worry too much about
the language they use. Domain, domain, domain.

------
rbanffy
The worst thing I have observed is colleges choosing Java (and C#) "because
that's what the market demand".

When I was in college (1986, engineering, not compsci) students started with
8-bit BASIC and FORTRAN (I mostly skipped classes on BASIC because I had
learned to program on my Apple II). One year later, they switched from BASIC
to Pascal. Later on, one of the teachers decided to teach APL. It was a
wonderful experience because it was a _different_ take on my previous
paradigms.

I am not sure what is the best way to teach someone how to program. When I was
a kid, you turned your computer on and immediately got to a REPL (one Dijkstra
would strongly disapprove, but still a programming environment). IMHO any
programming language that demands an IDE or a build system more complex than
make (even if hidden behind a shiny GUI) should not be used as an
introduction. Paraphrasing Dijkstra, it could damage the young minds beyond
repair.

If my Apple II booted into Eclipse, I'd have gone into cinematography.

~~~
annasaru
__If my Apple II booted into Eclipse, I 'd have gone into cinematography. __

That 's an awesome punchline.

------
danielweber
One of my favorite things about heaving to learn Scheme in my intro CS course
was that it put most students on an even footing with regards to already (not)
knowing the language. It's awesome to see Dijkstra alluding to that, "it
drives home the message there is more to programming than they thought."

I'm having a ball learning Clojure now, and it would be much much harder if
I'd never used Scheme. (I've done some functional programming in C++ and Ruby,
but I wouldn't have done that if I hadn't done it in Scheme earlier.)

------
Mikeb85
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 <\-
syntax, so you need to use monadic functions, and then there's type classes
and shit... In Haskell it seems the complexity goes up exponentially and
building anything beyond trivial is a huge hassle - no wonder 'design'
patterns like FRP seem to be all the rage (while the entire computing
landscape is being built on languages like C++ and Java).

Lisp/Scheme are conceptually very simple and easy to learn, but the syntax is
hard to follow, and some of the keywords make no sense to someone who's never
done any programming.

I personally think Ruby -> Java/C++ would be a great progression, with maybe
some SML/OCaml on the side somewhere along the way. I spent way too much time
dabbling in various 'trendy' languages like Clojure, Haskell, various Lisps
and other FPLs, Ruby and JS/Node, etc... Now I'm at the point where I just
want to build things, so I'm using a very practical, OOP, statically-typed,
compiled language that many people have already shipped many practical apps
with.... Probably not going back to 'trendy' languages.

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

~~~
Mikeb85
See all the functions which are funM. mapM, replicateM, etc... For a newbie
having to use a different function to apply to a monad vs. a pure function is
confusing and not necessary.

~~~
rollo
I'm just getting confused by the terminology. Those are pure functions too.
And you have different functions because they're doing something completely
different, operating on computational structures that are different from
primitive values the 'normal' functions as you called them operate on.

It's like saying C++/Java etc. are confusing because you can only print
certain values, but you can't print the print statement.

------
gerjomarty
The first programming language we learned at university was ML. It was a very
simple language for teaching functional programming, it has a minimal syntax
that makes some sort of sense and it was likely that everyone was starting off
at the same point with it.

Like Dijkstra said, getting these high-level concepts in there early is very
important.

------
mcguire
I'm a wee bit confused by this. I graduated from UTCS in 1990 (the first time)
and was a graduate student and employee of the CS department from about 1992
until 2004-ish.

At no time were the introductory classes in Haskell, to my knowledge.

According to the wayback machine[1], the introductory courses (CS307 at the
time) in 2001 were in Scheme, while subsequent courses were in C++. I recall
the introductory classes experimented with Miranda briefly.

On the other hand, the typed letter[2] _is_ from the EWD archives. Weird.

[1]
[https://web.archive.org/web/20010429024151/http://www.cs.ute...](https://web.archive.org/web/20010429024151/http://www.cs.utexas.edu/users/UTCS/undergradoffice/courseinfo/)

[2]
[http://www.cs.utexas.edu/users/EWD/OtherDocs/To%20the%20Budg...](http://www.cs.utexas.edu/users/EWD/OtherDocs/To%20the%20Budget%20Council%20concerning%20Haskell.pdf)

------
habosa
I love Haskell and Java. From a high level they are my favorite languages for
their respective paradigms, so I think most programmers should at least try to
write a simple program in both.

That said, I think people are overreacting to Java as a CS 100-level language
because of enterprise experiences.

I have written enterprise Java and I hate it, but I still love Java. Java EE
is all beans and POJOs and XML and Swing and cruft and I want to burn it in a
fire. But that's not Java, those are libraries.

Java is an excellent language to introduce someone to programming, because
there is very little magic. Everything is explicit, due to the static typing
and imperative nature. The computer (or JVM in this case) doesn't do anything
that you don't tell it to do. That's easy for someone to grasp.

Additionally, Java makes it very easy to write readable, organized, and
extensible programs even if they are verbose. Using classes, objects, methods,
types, and all of that OOP stuff makes it easy to write modular programs where
each piece of code does exactly one thing. In functional programming the
intricacies of passing state and higher-level functions lead to a lot more
spaghetti code for someone who has never programmed before.

Do I think that we should only teach Java? No, of course not. Do I think that
it's still a great first language? Absolutely.

If I had control of a curriculum, I'd teach Java for half a semester and then
Haskell for half of the semester. I think it's important to not introduce
"more productive" dynamic languages like Ruby or Python until students have
had to deal with concepts like types so that they can appreciate what Python
and other dynamic languages are leaving out.

At Penn, where I go to school, the intro to CS class teaches OCaml in the
first half and Java in the second. Unfortunately I think that so many people
are struggling with writing code as a concept that they're too frustrated to
appreciate the beauty of OCaml at first. Teaching it after something a little
easier would make the advantages clearer.

~~~
dllthomas
It's just my experience, but the people I know for whom Java was a genuinely
first language seem to have a harder time than anyone else grokking pointers.

~~~
habosa
That's definitely true, but no functional language is going to help with that.
Those are only farther from the metal.

The only thing I think Java handicapped me with was understanding pass-by-
reference or pass-by-value, but I figured it out when someone told me that
Java is "pass by reference by value" meaning that in the method meth(Object
obj) { ... } if you do obj.something() you are editing the original object,
but obj = newObject won't change the original reference.

~~~
dllthomas
I kind of think it's a problem (pedagogically) with Java's model specifically,
not purely distance from the metal. I wouldn't be surprised if there were
other high-level languages that caused similar trouble, but I also wouldn't be
surprised if some did not.

------
mattdeboard
Lots of good quotes in here, particularly:

> It is not only the violin that shapes the violinist, we are all shaped by
> the tools we train ourselves to use, and in this respect programming
> languages have a devious influence: they shape our thinking habits.

------
kabouseng
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 still don't use functional languages.

But then again Java is an equally bad choice, for the reasons mentioned, but
also you jump immediately into OOP, again expecting the student to have former
experience.

What is wrong with laying a solid foundation with the introductory class in C
or Python, and then moving on to the more advanced OOP or functional worlds?

~~~
mattgreenrocks
Industry is far too low a bar to aim at. College should give them the
fundamental understanding of programming that they can apply to a variety of
situations. Employability flows out of that.

~~~
hashtree
I truly wish this was a more commonly held view point. You would think,
speaking with many, that college was nothing more than a corporate worker
mill.

~~~
mattgreenrocks
This is a dangerously reductionistic viewpoint that castrates the intellectual
potential of students.

To a student versed in Lisp macros, a framework like Rails ceases to be magic
and starts being something that can be understood and improved on. Meanwhile,
industry shies away from the _possibility_ of a quick dive into a metaprogram,
because, (OMG), it's hard!

I'm exaggerating, but industry strikes me as profoundly anti-intellectual at
times. We need people to counter this sentiment and the damage it imposes on
all of us.

------
brendano
Here's a positive report on teaching "back to basics" first-semester
programming with Java. They only teach procedural concepts and no OO at all.
The point is, while Java itself is non-ideal for this and slants towards OO,
you can just ignore that part and teach with it anyway.

Lots of people here have raised concerns that the way Java forces class and
static declarations is confusing for beginners. Interestingly, the instructors
were concerned about that too, but found that students don't seem to mind.

[http://homes.cs.washington.edu/~reges/sigcse/basics.pdf](http://homes.cs.washington.edu/~reges/sigcse/basics.pdf)

[http://homes.cs.washington.edu/~reges/sigcse/basics.ppt](http://homes.cs.washington.edu/~reges/sigcse/basics.ppt)

The second major concern being discussed here, that functional programming
isn't possible in Java, I think is a non-issue for a true introductory first-
semester class, which needs to focus on more basic issues of procedural
programming and abstraction. The SICP approach is beautiful and great for
already advanced and highly motivated students, but that's honestly a small
minority.

(You can find many more examples of reports like this if you search for "CS1",
which is the shorthand for intro-to-CS that's used in the CS education
literature.)

------
joyeuse6701
Ah, I encountered this coming up when various friends were enrolling in
computer science courses at Universities. Curriculum either followed an
'engineering' format, a more EE to CS bottom-up methodology, or they followed
a top-down thought process.

The reasoning for bottom-up is that there are fundamental aspects of the
bottom up approach that truly teach the fundamentals that are necessary to
become a great computer scientist/engineer/developer that I don't think any
other method provides.

But the top-down approach is appealing for one reason it seems: It's friendly.
I would not be surprised if the retention rate for top-down was greater than
the bottom-up. Using something like Python, Java, or whatever other
conventional blackbox language is easy, comfortable, and immediately
demonstrates to a student the power of programming. The practicality of what
they learn is evident. Ideally, interest in this would continue down the line.
'This is really cool, but how does Python actually work?'.

Unfortunately, it seems that most people, when presented with a working
blackbox, don't care to see how it actually ticks. It takes a certain special
someone to open up a watch, disassemble and reassemble it. So who knows how
well the top-down carries over into learning the fundamentals.

The bottom-up has the drawback of intimidating the meek. I certainly was one.
I would have benefited from a top-down approach, as I am one of the types who
like to see how something ’ticks’.

So therein lies a trade off, would you sacrifice the known quality of your
curriculum for better retention? Having someone learn something, is better
than nothing, but that’s up to people like Prof. Dijkstra to decide.

EDIT: spelling/coherency

------
parenthesis
At the University of Edinburgh, they teach first year undergraduates Haskell
_and_ Java (Haskell in semester one and Java in semester two).

~~~
mschlafli1
But I bet that's only because Phil Wadler is there advocating functional
programming and Haskell to bits.

------
NigelTufnel
I think judging programming languages by their features is the same as judging
people by their talent and not by their deeds.

Take Java for example. Most people (Dijkstra included) hate it. But look how
much Java has accomplished. It's not a coincidence that Hadoop is written in
Java. It's not a coincidence that Java is the primary language on Android.

To quote a great man: "Java works. Java captures the essence of the
evolutionary spirit" Same thing applies to PHP, Javascript, and whatever
everyone hates.

Couple of years ago I thought that Java was the Devil's invention and the most
awful programming language ever. Then I started using Java with Hadoop. And
for the first week Java was the most awful programming language ever.
Two/three weeks in I was absolutely okay with Java. It worked. And for me
that's the only thing that counts.

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

------
Pxtl
I tend to think Java is a good first programming language, much like Basic and
Pascal were the "first programming language" for so many of us back in our
youths. Not every high-school offers programming, and of the ones that do
there's no guarantee students have _actually_ been properly introduced to
programming.

And like all "first programming language"s, it should be discarded as you
learn _proper_ languages.

2001ish-era Java was a fine vehicle for introducing programming. Just not much
else.

The _second_ programming classes should move in both directions away from Java
- to properly academic and expressive languages like Haskell, or getting their
hands dirty with the nitty-gritty of C and assembly languages.

~~~
the_af
What are Java's merits as a first programming language? Keep in mind all of
its warts would have to be unlearned later by the prospective student. It can,
like Dijkstra argued, introduce unhealthy thinking habits.

Why not a simpler higher-level language as a first language? (pick one, there
are lots of simpler languages than Java).

~~~
Pxtl
Most of the good "simple high-level languages" are dynamically typed... which
is also worth considering - Python would be a fine "first language" too if you
were okay with putting off the concepts of static typing into a later course.

But if you wanted to include static typing and were trapped in 2001? I'd be
hard-pressed to come up with a better language than Java, at least without
getting into some pretty obscure platforms.

------
hardwaresofton
I'll just leave this here...

[http://channel9.msdn.com/Series/C9-Lectures-Erik-Meijer-
Func...](http://channel9.msdn.com/Series/C9-Lectures-Erik-Meijer-Functional-
Programming-Fundamentals) (One of the greatest introductions and walkthroughs
of Haskell I have ever watched, taught by Erik Meijer)

I have actually watched every lecture (even the parts with stuff I "knew") and
thoroughly enjoyed it. If an entire course was taught like those lectures
were, I think you could teach someone a pretty darn good grasp of haskell
pretty quickly (I am of course ignoring the part where you learn really basic
fundamentals like bits/bytes, data types, references/pointers, etc)

------
ctdonath
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 have been
sensible but entrenching. Fortunately Syracuse University then was starting
students on something very strange: APL. That was a mind-opener I needed at
the time, and recommend such non-procedural/OOP language very early on for
serious students.

~~~
ben336
"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 generalization.

~~~
ctdonath
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.

------
ilbe
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?

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

------
undoware
I agree with Dijkstra that Haskell should be taught in undergraduate courses.
That's where we boil away most of the really bad, theory-ahead-of-practice CS
ideas that academe cultivates. And I say this as a lover of both Haskell and
universities.

It's not until you've spent several 4am nights getting darcs and hackage to
work that you realize no team can succeed without the sort of people who like
reality and boring details as much as beautiful ideas. Haskell's culture is
anathema to them. (And no, I'm not one of them. I just want my app to compile
and my deps to be found.)

------
rmanocha
I was a freshman at UT in 2002 in their CS program. I wish they had heeded
Djikstra's advice. Java with BlueJ was what we were taught from day 1.

To the departments credit, we did end up taking a couple of courses in Haskell
(the best one I remember was the course of compilers - we had to write a C
lexer in Haskell). It was one of the more fun classes I took (thanks, in a
great part, to the professor teaching us).

------
mathattack
The first programming language depends a lot on what the purpose is. EWD's
purpose is to train mathematicians specializing in computation. For these
types of people, Haskell is fine. "Commercial" languages are better for people
who want to learn the basics of programming to apply in a job later.

------
bakul
Why not teach assembly language programming so that the student can really
understand how a computer works, and teach Scheme so that they can really
understand the power of abstraction, recursion, functional programming etc. A
later course can be to write a Scheme compiler generating the same asm lang.

------
Arnor
I'd love to see an introductory course using Haskell on an open courseware
channel.

------
CmonDev
It's much better to pick something multi-typed and multi-paradigm like C# and
be able to show the difference between static and dynamic, imperative and
functional, AOP etc.

------
abcd_f
Does anyone know if anything came out of this letter?

~~~
steveklabnik
Read the third sentence of the article.

------
jokoon
Yet I can't find any book on FP in practice...

~~~
chrisdone
[http://www.cs.nott.ac.uk/~gmh/book.html](http://www.cs.nott.ac.uk/~gmh/book.html)
[http://shop.oreilly.com/product/9780596514983.do](http://shop.oreilly.com/product/9780596514983.do)
[http://shop.oreilly.com/product/0636920024743.do](http://shop.oreilly.com/product/0636920024743.do)

------
ExpiredLink
How many nano-Dijkstras has this letter?

------
Uchikoma
Classical progamming language is important fallacy.

------
michaelochurch
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 jobs
based on one or two CS classes, but two issues come to mind there. First, I
generally wouldn't hire someone (in a technology company) who took one CS
class and didn't continue-- but at least if she passed an SICP-style course,
I'd know that she learned _how to think_ about computational problems. Second,
you don't "know Java" when you come out of school. Java is actually highly
complicated (in good ways and bad) and the average college student hasn't been
exposed to all the mess of it (and that's probably good, because, while OOP
means about 20 different things to different people, business-style OOP is
cataclysmic).

~~~
CJefferson
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 nothing more than "mismatched
bracket" or "incorrect function call", whereas even fairly simple Haskell code
can produce very complex error messages, and ghci (for example) tends to make
things worse rather than better.

Java isn't perfect and has been getting more complicated, boxing & generics
for example, but still is not close to the pain one can create in a handfu of
characters in Haskell (of course, C++ has the same problem, for different
reasons).

Personally, I see Haskell as the C++ of functional language, and therefore
would prefer not to teach either Haskell or C++ as a first language.

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

~~~
scott_s
Scheme.

~~~
raverbashing
I want the Python of functional languages

~~~
etanol
Or Hy:

[http://docs.hylang.org/en/latest/language/api.html](http://docs.hylang.org/en/latest/language/api.html)

:-]

------
PaulHoule
Ugh, is this a guy who learned his CS from reading Proggit?

There's no way you can say Haskell is "orders of magnitude better than Java";
maybe it's better, but it's not that much better.

~~~
agumonkey
It's a transcript from Dijsktra's letter.

~~~
PaulHoule
Yeah, I know.

Dijstrka is pretty famous for picking the wrong side of fights about
programming languages.

~~~
hashtree
Perhaps by popularity and usage in corporate. In every other way, I'd say he
is spot on.

Signed,

Numerous jvm lang and haskell programmer

