Friday, June 29, 2012

Universities should teach the functional programming paradigm first


I am very angry because nobody ever told me about Lisp and functional programming in 16 years. I have a BSc in computer science, a lot of experience in the IT sector and my (crappy) university only taught me Java. All the stupid companies I have worked for used programming languages only a bit better than Java, but they used them just like Java. We should do more to let people know what's good and bad in programming and enlarge the Lisp community!

I admit the step from ALGOL-like languages to Lisp is not an easy one, but once done, one should be a fool for wanting to backtrack. The problem is most people (me included) stick to the principle of least action: only make a big effort if you really need it. This is fine, but in a case like this you really don't see the need for a better language and you are not prodded to learn it, until you have battled with bad programming languages and made a big effort trying to implement good software using them, while coping with their limitations and blindness as much as possible.

This is why it would be better to teach people functional programming directly, rather than making students used to imperative programming only. That is a bad practice if used as the only paradigm and it is subsequently difficult to get rid of it!

You professors, you should know that better than me. Why do you compromize and follow the current fad in programming?

Remember that your students are those who are going to make the computer business. They are the future, the ones who have to know better in order to innovate. So, the better you prepare them, the better this market will be. If it sucks, it is also because of you.

2 comments:

Anonymous said...

Functional programming sucks. It's lauded by academics that don't write production code. I have been programming OO for 15 years and now I am learning Scala (in an OO class, no less) and also learning that no sane person would ever use Scala to write production code. The OO paradigm is simply much more logical than the functional paradigm. No one uses functional programming because it's not effective; it's merely an intellectual curiosity. The Scala language in particular is like programming an entire application with a Regex. Just because it's more concise doesn't mean it's better. I once coded an entire application (for fun) with a series of strung-together groupings of logical ANDs and ORs. It turned dozens of pages of code into about half a page of code. All functions and combinations of functions can be expressed in mathematical terms, if you want to express them that way. It's simply a terrible way to logically express an idea through application programming code.

Farmboy said...

Have you ever tried Lisp, Scheme, Haskell or Clojure? For instance, for years I have been looking for a way to modularize HTML. But no OOP language like Java or PHP offers the way to do it with the degree of simplicity and flexibility I need. It was a piece of cake with Lisp. You can have a look at my project here: http://ninuzzo.github.com/hyde I see you got the impression that functional programs are just a bunch of messy code, but well-designed ones aren't. Every function can be tested independently and the absence or at least the confinement of side effects at a lower grade (not under classes but single functions) makes your code fully testable and easy to understand and reuse. I hope you can see it. Of course, just like OOP, FP can be used badly. E.g. I have seen many overcomplicated OOP frameworks. If you conceptually believe that everything is and should be an object, well, this looks like a dogma. Experience taught me that most of the times no single programming paradigm captures well all the aspect of a problem. I think the reason for the still quite low acceptance of FP in the industry is that this paradigm is as important and powerful as it is not easy to use. It requires a change of mind, especially if programmers have been educated to think in an OOP-only way. But really, FP and OOP can be used together, as I said no single paradigm is the best for most problems, but usually a wise combination of many paradigms provides the best solutions, in terms of software quality, which is what we want and the only think that matters. It does not matter how you achieve it, but it's important that you achieve it.