Live data from Hacker News

Dijkstra on Haskell and Java (2001)

chrisdone.com

81–90 of 124 posts

Re: Dijkstra on Haskell and Java (2001)

#81
post #74
post #72

Earlier quoted context omitted.

But the one liner was the implementation, and doesn't do a QuickSort...

In tests and homework, we would implement the one-liner quicksort with paper and pencil, much like a math test. In a pencil implementation of that Haskell, it is n log(n). Each line on the paper represented one level of recursion. Implementing it on silicon requires the trade-offs you mention. But silicon is just an implementation left to the reader... EDIT: I guess where I'm coming from, Haskell was used in the cont…

I'm not disputing the scaling properties of the Haskell one-liner, but it doesn't give you the benefits of the true QuickSort as your comment suggests, e.g. it doesn't guarantee in-place sorting or efficient use of when access be locked.

The point is, I find it questionable to praise Haskell for how you can implement a one-line QuickSort that isn't really a QuickSort.

Re: Dijkstra on Haskell and Java (2001)

#82
post #50

Earlier quoted context omitted.

To followup with a note from the article: "A very practical reason for preferring functional programming in a freshman course is that most students already have a certain familiarity with imperative programming. Facing them with the novelty of functional programming immediately drives home the message that there is more to programming than they thought." It's no surprise that this attitude can discourage students wit…

That actually did bother me in the letter. He states: -Most students taking CS courses are already familiar with an imperative laguage. -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. This would imply that most CS students already come pre-ruined. At that point then, does it matter what language is picked? A…

This is the same guy who said

"It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration."

and

"The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offense."

and

"FORTRAN, 'the infantile disorder', by now nearly 20 years old, is hopelessly inadequate for whatever computer application you have in mind today: it is now too clumsy, too risky, and too expensive to use."

Basically he's a mathematician who codes, and who wants code to be math.

Unfortunately in the real world code is also politics, business, history, sociology, and psychology. The math part is important, but it's not the whole story.

He's often funny, in a dry way, but it's useful to understand that he's actually not very insightful about the psychology of effective programming.

He praises mathematical intuition, and he wants to develop it, but he doesn't seem to have considered the possibility that simply throwing Haskell at people, or asking them to work through formal methods, may not be the best way to do that.

There's almost no useful research I know of that examines what mathematical intuition is, and even less about whether it's teachable. So Haskell and formal methods may help some people some of the time. But it's not in any way a given that they're the best of all possible teaching methods.

He also misses an entire class of UI/UX bugs where the code works exactly as it's designed to, and is provably formally correct, but an application is useless because the UI is incomprehensible and/or misleading and/or actively distracting to the task at hand.

Ironically, it's exactly that interface between fuzzy human expectations and implicit modelling tendencies and the rigidity of code that causes the most issues for practical projects.

This doesn't just apply to applications - it also applies to languages, operating systems, and development environments, some of which add unnecessary cognitive loads which make programmer mistakes more likely.

His solution - formal rigour - only works if you can formulate a problem precisely in the first place.

The set of problems where it's possible to do that doesn't come close to covering all the problem spaces touched by computing.

Re: Dijkstra on Haskell and Java (2001)

#83
post #69

Earlier quoted context omitted.

I really don't understand why people think monad is a "fancy scary term". It's a five-letter easily-pronounceable word. What makes it fancy or scary? I think people assume that they're scary, and then confirmation bias themselves into making them hard to learn, despite them being a reasonably simple concept overall. As for calling them strategies… if we called them that it would make learning and understanding the in…

Why would calling them anything different have any effect on learning other concepts?

Because the associated concepts, for example Kleisli categories, are easy to find if your search is seeded with the word "monad", but very hard to find if it's seeded with the word "strategy".

Re: Dijkstra on Haskell and Java (2001)

#84
post #64

Earlier quoted context omitted.

I really don't understand why people think monad is a "fancy scary term". It's a five-letter easily-pronounceable word. What makes it fancy or scary? I think people assume that they're scary, and then confirmation bias themselves into making them hard to learn, despite them being a reasonably simple concept overall. As for calling them strategies… if we called them that it would make learning and understanding the in…

> I really don't understand why people think monad is a "fancy scary term". The reason could be that the term "monad" comes from category theory, and that is a topic not everybody is too familiar with...

Lack of familiarity doesn't make it fancy, and for a software engineer it shouldn't make it scary either. One of the largest parts of our job is learning unfamiliar things.

Re: Dijkstra on Haskell and Java (2001)

#85
While I wouldn't start with Java (it's not the simplest language about - I'd probably use C or Python) Dijkstra's anti-Java rant is over the top. It's still a huge language and that's NOT because of any corporate advertising campaign. Something that succeeds as well as Java has to have some actual value.

Re: Dijkstra on Haskell and Java (2001)

#87

Earlier quoted context omitted.

I really don't understand why people think monad is a "fancy scary term". It's a five-letter easily-pronounceable word. What makes it fancy or scary? I think people assume that they're scary, and then confirmation bias themselves into making them hard to learn, despite them being a reasonably simple concept overall. As for calling them strategies… if we called them that it would make learning and understanding the in…

hmm, if we called them what they are we'd call them "type wrapper functions" and talk about "type wrapper function chains", monads carries zero metaphorical/associative meaning. I think thats the problem with the name and a large reason people find them so unapproachable, most other terms in computer science carry significant associative meaning that helps in learning them, pointers have to do with pointing at things…

You're demonstrating that you don't know what monads are. "Type wrapper function" could mean any number of things (lack of specificity is a bad trait in naming), but it couldn't mean a monad: monads consist of three things, whereas "type wrapper function" implies one thing.

Names don't need to be metaphorical. The purpose of a name is not to teach you what the thing is. For that, you should have a proper explanation from someone who knows. Names have a different, very important purpose: uniquely specifying the thing being named. "Monad" does that very effectively.

Re: Dijkstra on Haskell and Java (2001)

#88

While I wouldn't start with Java (it's not the simplest language about - I'd probably use C or Python) Dijkstra's anti-Java rant is over the top. It's still a huge language and that's NOT because of any corporate advertising campaign. Something that succeeds as well as Java has to have some actual value.

>Something that succeeds as well as Java has to have some actual value

Well yes, it has some value. However, just because a lot of people like/believe something doesn't make it good/true.

It's not like corporations have some vast conspiracy in place to encourage the use of Java; it's simply that Java, for a number of reasons, is attractive to middle-management types, even though it's not the best language to make good software. That's not necessarily a criticism of Java; from many perspectives, making good software is not the primary goal.

Dijkstra's big thing was prioritizing good software over cheap software. This may not be a realistic goal, but it certainly explains why he preferred Haskell to Java.

He wrote some really good essays on why you need languages like Haskell to raise the overall quality of software floating about. The more you can shift the burden of guaranteeing correctness away from humans and towards infallible mechanical systems (like Haskell's relatively powerful type system), the more likely you are to end up with good/correct software.

Re: Dijkstra on Haskell and Java (2001)

#89

While I wouldn't start with Java (it's not the simplest language about - I'd probably use C or Python) Dijkstra's anti-Java rant is over the top. It's still a huge language and that's NOT because of any corporate advertising campaign. Something that succeeds as well as Java has to have some actual value.

> Something that succeeds as well as Java has to have some actual value.

Like cigarettes?

Re: Dijkstra on Haskell and Java (2001)

#90
post #8

I don't see why they don't just teach C, x86, and Haskell everywhere. If you know the concepts behind these, you can quickly grok any other programming language. Also I never got the whole hype behind OOP. IMHO its self explanatory, nothing you need an entire course on to be effective and understand OOP programs. Memory layout and management, advanced pointer concepts and monads are a slightly different matter. If I…

and monads I really don't understand why people have such issues with monads. I don't have a haskell background and originally built up most of my functional programming skill in Python (going somewhat against the grain) and I find monads to be a fancy scary term for an extremely simple concept. I think if they were named something friendlier perhaps people's eyes wouldn't immediately glaze over and they could realis…

I don't know if I can agree with this. I've invested a significant amount of time in learning about monads (and functors, applicatives, monoids, and more from the bestiary of commonly used category theoretic structures in Haskell) and I find them quite challenging to grasp in their full generality. While specific use-cases are readily understood, getting to the heart of what a monad "is" has taken me time, and I honestly don't believe I've properly grasped it yet.

So I think there's a spectrum of understanding and effective use when it comes to monads and other algebraic structures like these, and I'm skeptical when people say, "oh yeah, a monad is just X, it's simple." I've said that myself in the past and I was wrong, and so were most of the people I've heard say that.

To put it another way: when I hear people who know what they're talking about say it's simple, they are talking about its structure, not about understanding what it is and how it is used. In that sense it is quite simple. But as Euclid said, there's no royal road to geometry (er, or monads...).

Post reply on HN