News for hackers. Stuff that matters.
Re:Haskell v Ada v C++ v Awk... An Experiment in Software Pr... by tikhonj on Thursday January 09, 2014 @07:55AM (#7030151)
Particularly worth noting is how well a novice Haskeller performed. In particular, the novice's program took the second-least amount of time and was the second shortest. Here's a description:

> The Haskell Report was given to a newly hired college graduate, who was then given 8 days to learn Haskell. This new hire received no formal training, but was allowed to ask an experienced Haskell programmer questions as issues came up during the self study. After this training period, the new hire was handed the geo-server specification and asked to write a prototype in Haskell.

A college student who had just started learning Haskell eight days ago managed to put out a very credible prototype! Clearly, Haskell is by no means impossible to learn.

Re:Haskell v Ada v C++ v Awk... An Experiment in Software Pr... by dserban on Thursday January 09, 2014 @06:30AM (#7029875)
Abstract (cut-and-pasted from the paper):

We describe the results of an experiment in which several conventional programming languages, together with the functional language Haskell, were used to prototype a Naval Surface Warfare Center (NSWC) requirement for a Geometric Region Server. The resulting programs and development metrics were reviewed by a committee chosen by the Navy. The results indicate that the Haskell prototype took significantly less time to develop and was considerably more concise and easier to understand than the corresponding prototypes written in several different imperative languages, including Ada and C++.

Re:Haskell v Ada v C++ v Awk... An Experiment in Software Pr... by gaius on Thursday January 09, 2014 @07:56AM (#7030153)
... but the Navy went with C++ for the actual system, I'll wager.
Re:Haskell v Ada v C++ v Awk... An Experiment in Software Pr... by dserban on Thursday January 09, 2014 @06:26AM (#7029857)
Re:Haskell v Ada v C++ v Awk... An Experiment in Software Pr... by agumonkey on Thursday January 09, 2014 @07:58AM (#7030165)
Re:Haskell v Ada v C++ v Awk... An Experiment in Software Pr... by ardz on Thursday January 09, 2014 @06:38AM (#7029895)
Haskell vs Lisp, development time (h): 10 vs 3

This hard fact says more than thousand committee reviews.

Re:Haskell v Ada v C++ v Awk... An Experiment in Software Pr... by TheCoelacanth on Thursday January 09, 2014 @01:20PM (#7032118)
> development times usually included documentation time

Most likely, the Haskell development time includes the time to write 465 lines of documentation, while the Lisp development time includes the time to write 12 lines of documentation. That makes it pretty obvious where the discrepancy in time comes from.

Re:Haskell v Ada v C++ v Awk... An Experiment in Software Pr... by lispm on Thursday January 09, 2014 @02:40PM (#7032658)
I would guess that the Lisp version was more descriptive (it had more program lines) and needed thus much less documentation than the Haskell version.
Re:Haskell v Ada v C++ v Awk... An Experiment in Software Pr... by TheCoelacanth on Thursday January 09, 2014 @04:56PM (#7033567)
I highly doubt that an 85 line Haskell program with 465 lines of documentation had the same amount of time spent on documentation as a 274 line Lisp program with 12 lines of documentation. The Haskell developer clearly put a lot more effort into documentation.
Re:Haskell v Ada v C++ v Awk... An Experiment in Software Pr... by ardz on Friday January 10, 2014 @10:31AM (#7037051)
Haskell's code is not far away from APL. Lots of Haskell code uses single letters instead of descriptive names. This makes it a lot harder to read and forces lengthy documentation:

reverse (PS x s l) = unsafeCreate l $ \p -> withForeignPtr x $ \f -> c_reverse p (f `plusPtr` s) (fromIntegral l)

form http://www.haskell.org/ghc/docs/latest/html/libraries/bytest...

People who write code like this should be banned. Code should be written in a way to be easily read by people, not a compiler. This is not a coincidence that there are 500 lines of documentation. This is how typical Haskell code looks like.

Re:Haskell v Ada v C++ v Awk... An Experiment in Software Pr... by FreeFull on Friday January 10, 2014 @01:34PM (#7038399)
Bytestring is a widely used library with very special performance requirements, and not a typical example of good Haskell code.
Re:Haskell v Ada v C++ v Awk... An Experiment in Software Pr... by ardz on Friday January 10, 2014 @03:28PM (#7039143)
I found it here: http://www.haskell.org/haskellwiki/Example_code

Description is rather clear: "To get a feel for what real world Haskell looks like..."

Re:Haskell v Ada v C++ v Awk... An Experiment in Software Pr... by FreeFull on Saturday January 11, 2014 @09:21AM (#7042640)
I have thought about it, and my reply didn't really address what you have said. Single-letter names obviously don't improve the code's performance. The reason they tend to be used is that the values associated with each binding tend to be very generic. If you have code like

  id :: a -> a
  id x = x
you can't really say anything more about what x is, since it could be anything. There are also patterns, such as xs is a list of x, and n is a number. When it's something a lot more specific, names that describe the variable's purpose should and are used. Typically, both the name of the argument and the type signature are looked at to quickly gain knowledge of what the function is probably doing.

The lengthy documentation tends to be more descriptive of what the code's purpose is rather than explaining what the arguments to it are.

I do acknowledge that Haskell code isn't usually too pretty to look at. I tend to find it rather readable myself, although that varies from library to library, and application to application. Applications tend to be a bit more readable than libraries, since the library implementation sometimes deals with concepts that are not exposed to the library's user.

Re:Haskell v Ada v C++ v Awk... An Experiment in Software Pr... by ardz on Monday January 13, 2014 @03:28PM (#7053046)
First rule of maintanence: readable code. I should be able to read code after short introduction. I remember it took me 1h (after Sussman lecture video) to read Lisp. It is several weeks now since I'm reading Haskell tutorials and docs and still have problems to understand code advertised as "what real world Haskell looks like".

It is the only language I know of which makes trivial problems hard and hard problems impossible.

Because of its syntax you have to write 10x as much documentation, as experiment shows and I can confirm this from my own experience. Haskell is full of BS.

Re:Haskell v Ada v C++ v Awk... An Experiment in Software Pr... by lispm on Friday January 10, 2014 @02:50AM (#7035584)
As I said, it does not need to, because it is written in a self-descriptive.

Writing documentation for Haskell programs seems to be needed - especially short Haskell programs written by experts tends to be cryptic.

There was a second Haskell program. 8 hours to write, still far from 3 hours for Lisp.

Re:Haskell v Ada v C++ v Awk... An Experiment in Software Pr... by TheCoelacanth on Friday January 10, 2014 @09:29AM (#7036692)
There is no 85 line program that needs 465 lines of documentation. The developer was clearly over-zealous. The second Haskell developer was a college student who learned Haskell a week earlier; so obviously they are going to take longer.
Re:Haskell v Ada v C++ v Awk... An Experiment in Software Pr... by lispm on Thursday January 09, 2014 @02:42PM (#7032669)
Since the Lisp developers were using 'Relational Lisp', I would guess that there were quite capable. Relational Lisp is another step up from a typical Lisp.
Re:Haskell v Ada v C++ v Awk... An Experiment in Software Pr... by lmm on Thursday January 09, 2014 @06:43AM (#7029908)
Only once you've measured how buggy the software is, and how much maintenance costs over the full lifecycle.
Re:Haskell v Ada v C++ v Awk... An Experiment in Software Pr... by ardz on Thursday January 09, 2014 @06:51AM (#7029939)
I have no such problems. Think/hack/try first, code later - this is my advice to you.

Pen and paper are my debugging tools, not a type system.

Re:Haskell v Ada v C++ v Awk... An Experiment in Software Pr... by lmm on Friday January 10, 2014 @03:26PM (#7039128)
I can do that, and I've used languages and hardware where it was the only option. But I'm much faster and more effective with a type system.
Re:Haskell v Ada v C++ v Awk... An Experiment in Software Pr... by gaius on Thursday January 09, 2014 @07:59AM (#7030168)
Both Haskell and C++ have come a long way since 1994.
Re:Haskell v Ada v C++ v Awk... An Experiment in Software Pr... by tempodox on Thursday January 09, 2014 @07:33AM (#7030068)
That link is dead.
Re:Haskell v Ada v C++ v Awk... An Experiment in Software Pr... by agumonkey on Thursday January 09, 2014 @08:06AM (#7030200)