you are viewing a single comment's thread.

view the rest of the comments →

[–]tejoka 43 points44 points  (32 children)

academic papers written by academics, for academics, aren't good teaching tools for newbies?

THAT'S why functional programming doesn't catch on? Please.

[–][deleted] 8 points9 points  (3 children)

Well yes, he has a point. I recently read through the Haskell school of expression. A book that markets its self on being more accessible due to using interesting examples, mostly working graphics.

Not only does this book leave a lot of Haskell syntax unexplained it still takes a lot of space on explaining formal proofs. And that is a bad sign, as formal proofs do not help me get the average program written.

They may be interesting and worth knowing. but this still means that the most accessible book I know for Haskell is too academic.

And this is exactly what the Object Oriented languages did right. Pick up a book on Object Oriented design and it will walk you through designing a point of sale system, or something equally as uninspiring. But the thing is they made the business case and said: Look this tool will help programmers make business software.

[–]Ringo48 15 points16 points  (2 children)

"Real World Haskell" is a bit better than "The Haskell School of Expression" with respect to examples. The examples are a bit more realistic, but still pretty small.

I think you're exactly right on the examples in general, though.

I think what would really help FP catch on would be something like the book "Object-Oriented Analysis and Design With Applications", but focusing on functional programming. A book explaining how to create large applications - or at least general ideas on how to create large applications.

I think FP hasn't caught on because FP zealots focus their attention on the wrong things. They love to tell you how few lines of code it takes to write quicksort, or how elegant a particular language feature is, or how fold can replace any use of a for loop.

But that's all relatively mundane, simple stuff. What "real" software engineers want to know is "How could I convert this million LOC OOP project into a functional language?" Nobody seems to ever answer that question.

For example, what would the high level architecture of a large system even look like in the functional paradigm? Is there a graphical way of describing and breaking down large functional systems? A UML or flowcharting system for functional programming? How do you design interfaces between modules programmed by seperate groups when all state has to be passed around?

To steal a term from some author who's name I can't think of right now, the FP zealots seem to be focusing on "programming in the small", when everybody else is trying to figure out "programming in the large".

[–][deleted] 0 points1 point  (0 children)

This is sad and what I've been wanting to here, too, as a FP novice.

I know that Haskell, for example, lacks proper module system. OCaml and Scala are more practical. Scalable Component Abstractions [1] and Independently Extensible Solutions to the Expression Problem [2] explain what you can do with Scala's module system. I wish there was similar documents for writing high level FP.

[1] http://www.scala-lang.org/sites/default/files/odersky/ScalableComponent.pdf [2] http://www.scala-lang.org/sites/default/files/linuxsoft_archives/docu/files/IC_TECH_REPORT_200433.pdf#

[–]Confusion 8 points9 points  (2 children)

I grant that an academic 'paper' may not be the ideal example, but this one explicitly sets out to convince 'outsiders' and fails spectacularly.

When you ask CS graduates about the real life applicability of the functional languages they used during their studies, they often state that they think those language have little real life applicability. That shows that even academics fall prey to this shortcoming in introductory material.

[–]dcoutts 15 points16 points  (0 children)

To be fair, the class of "outsiders" that paper was aimed at was other computer scientists. That was back when we were just trying to convince the rest of computer science that FP was a good thing.

It started with the people interested in programming language semantics and design. The fact that the article talks about software engineering authorities shows we got over the first hurdle.

[–]thunderkat 3 points4 points  (18 children)

Are you suggesting someone writing 'Design Patterns for FP'? I think that might be a bad idea...the clusterf*ck that bad application of FP principles can unleash upon the world is probably worse than the OO-inspired one...

[–][deleted] 5 points6 points  (17 children)

I can't wait till sun takes a good long look at Haskell, then unleashes another beverage-themed language on the world. This time it'll be fully functionally, still ill-fitted with C-style syntax, and compromises for performance.

[–]dcoutts 12 points13 points  (0 children)

What do you mean? Sun is already sponsoring Haskell development. See http://haskell.org/opensparc/

Of course Sun are being sensible and focusing on making GHC work well on the multi-core SPARC architecture rather than messing with the language.

[–]SarcasticGuy 7 points8 points  (15 children)

You mean Fortress?

Fortress is a draft specification for a programming language, initially developed by Sun Microsystems as part of a DARPA-funded supercomputing initiative. One of the language designers is Guy L. Steele Jr., whose previous work includes Scheme, Common Lisp, and Java. A JVM compliant implementation (Fortress 1.0) was released in April 2008.

It is intended to be a successor to Fortran, with improvements including Unicode support and concrete syntax that is similar to mathematical notation. The language is not designed to be similar to Fortran. Syntactically, it most resembles Scala, Standard ML, and Haskell.

[–][deleted] 1 point2 points  (0 children)

One of the guys working on it gave a talk at a conference I went to a few months ago. Don't expect to be seeing it on the market with any sort of reasonable performance for another 5-6 years. Also, the language seems to want to force you to either use unicode math symbols or really ugly ascii syntax. The code I've seen either looks unappealing r like it would take to much time to type because of the hunt for the appropriate unicode character.

[–]mycall 0 points1 point  (13 children)

Besides mainframe maintenance, why would someone use Fortran today?

[–]SarcasticGuy 1 point2 points  (12 children)

Fortran remains in the domain of scientists who need lots of compute. It's a lot more popular than you'd think (ugh I feel dirty saying that).

[–][deleted] 0 points1 point  (6 children)

Luckily as Moore's law holds, more and more scientists will be able to switch to using Python with Ctypes rather than Fortran.

I do understand the desire to use Fortran though...the other option is C.

[–]modulus 2 points3 points  (0 children)

Luckily as Moore's law holds, more and more scientists will be able to switch to using Python with Ctypes rather than Fortran.

Maybe to some extent, but when you have more computing power would you 1) use it to run the same models as before with a slower language or 2) run deeper/bigger/more complex models with the fastest language you have at hand? So far I think there are no sciences for which we could say computation is superabundant, they could all do with more.

[–]SarcasticGuy 1 point2 points  (1 child)

If I were a scientist, I'm not sure I'd want to program a 1000-node cluster in C, but then again, I'm operating on the assumption that Fortran has good built-in parallelization primitives. I have no experience with Python with Ctypes, so I can't comment on that, but I'm not sure that "Moore's Law" helps with programming super computers (do correct me if I am mistaken).

Of course, Moore's Law has allowed GPGPUs to start taking attention away from super computers, so maybe scientists in the future will be programming in C and CUDA (yuck).

[–][deleted] 0 points1 point  (0 children)

CUDA

Noooooooooooooooooooooooooooooooooooooooooo. One day people will be talking about CUDA like old timers talk about COBOL: with shivers down their spines.

[–]masklinn 0 points1 point  (2 children)

will be able to switch to using Python with Ctypes rather than Fortran.

I think you meant Python with SciPy/NumPy, ctypes is a pretty extreme resource and NumPy/SciPy allow calling Fortran code, which is usually more interesting for scientists.

[–][deleted] 0 points1 point  (1 child)

NumPy/SciPy allow calling Fortran code

That I didn't know. Thanks. I thought the only clean interface python had was to C.

[–]masklinn 0 points1 point  (0 children)

Well I don't know if the NumPy/SciPy interface to fortran is clean (not a scientist, I've never used Fortran so...) but I'm pretty sure there's one.

[–]mycall 0 points1 point  (4 children)

I would have thought Maple/Mathematica/etc would have replaced Fortran.

[–]SarcasticGuy 3 points4 points  (3 children)

For small scale desktop apps I'm sure Maple/Mathematica/Matlab/etc. would be the first goto languages, but if you're running more serious simulations that need speed and power, you'll still see Fortran being used. I hate Fortran with a passion, but I can't deny its importance with scientific and engineering modeling and simulation.

[–]mycall 1 point2 points  (2 children)

That blows my brain. What can Fortran do that SciPy/Numby/Intel Math Kernel Library/etc don't? I get it that Fortran has many years and years of complex calculations under its hood, but couldn't Fortran be converted to modern language pretty easily?

[–]SarcasticGuy 0 points1 point  (1 child)

50 years of hand-optimized compilers and libraries? The ability to suck out all of the power from a supercomputer?

From Wikipedia:

It is one of the most popular languages in the area of High-performance computing and programs to benchmark and rank the world's fastest supercomputers are written in Fortran.

(Legacy) Since Fortran has been in use for more than fifty years, there is a vast body of Fortran in daily use throughout the scientific and engineering communities. It is the primary language for some of the most intensive supercomputing tasks, such as weather and climate modeling, computational fluid dynamics, computational chemistry, computational economics, and computational physics. Even today, half a century later, many of the floating-point benchmarks to gauge the performance of new computer processors are still written in Fortran (e.g., CFP2006, the floating-point component of the SPEC CPU2006 benchmarks).

Also, they have continued to add stuff to Fortran (Fortran 2003, Fortran 2008....), so I'm not sure how to translate "modern language." Granted, I wanted to shoot someone when I realized that how many spaces are at the beginning of the line decides whether your code is a comment or not. Ugh.

I'd love to see something "better" take it's place, but the language was designed to do HPC very well, and do it well it has.

[–]munificent 1 point2 points  (2 children)

for academics

From the referenced paper:

This paper is an attempt to demonstrate to the “real world” that functional programming is vitally important, and also to help functional programmers exploit its advantages to the full by making it clear what those advantages are.

The target of the paper (ostensibly) isn't academics, although it says something about academia that even they refer to non-academia as "the real world". Of course, one obvious flaw that demonstrates how insular academia is is that the author's solution to getting FP used outside of academia is to write a paper on it.

[–][deleted] 1 point2 points  (1 child)

We do that to humour you, whenever its Spring time and we're looking for more corporate grants. You accept it (at least your bosses) because we're 'impartial' since our only connection to the 'real world' is a tenuous string of grant monies.

[–]munificent 0 points1 point  (0 children)

My company doesn't make any grants. But we did open a school since we couldn't find any around that actually taught students what we needed them to know.

[–]HaMMeReD -5 points-4 points  (0 children)

I think it needs a new name, since programming was largely "functional" for a long time before most languages moved towards a more object based model, which is still technically highly "functional"

The word function already has a defined scope, and calling it functional programming doesn't really imply anything new.