Why Software Engineers Need to Learn Functional Programming

I have just returned from ICFP 2010, were I gave a talk at the Erlang workshop. I admit that many of the talks were too theoretical for my taste – “A sophisticated type theory looking for a programming language” was a repeating theme. Nevertheless, my conclusion from the conference was: There is a big gap between software engineers and functional programmers, and there shouldn’t be. Here are some talks that should draw the attention of the SE community:

Continue Reading

In Praise of Elitism

I haven’t posted here for a while – It’s been a crazy couple of months. Now, that I have a few more publications and a newborn baby, I can go back to posting.

I’ve encountered a few interesting posts recently, following Zohar Arad’s The Thinker Fail post on Newsgeek. Summing it up, Israel, once praised as “The Start-Up Nation”, is in trouble – We’re dragging behind as the web technology progresses. Causes:

  1. The government, and hence the army, are biased towards Microsoft products (see Michael Eisenberg’s post). Therefore, the plethora of army-trained programmers are biased towards .NET technologies.
  2. The universities and colleges teach web programming using .NET or Java.
  3. The world, namely the silicon valley, has moved onward to open-source web technologies, like distributed cache and HTTP load balancing (thanks again to Michael Eisenberg for pointing that out).
  4. Bottom line, Israeli students are not up-do-date with the technology required for building a scalable web application.

Zohar Arad claims that this is in part the fault of Israeli higher education, that puts too much focus on mainstream technologies. Please read the last sentence again: It is a cry from the hi-tech trenches for the universities to focus less on technologies, more on theory and methods, and let (even force) the students to study the rapidly-changing technological stack by themselves. After teaching students OOP and web programming for over 4 years now, I couldn’t agree more. However, it is not entirely the fault of the universities. Students often cry to high heavens when a lecturer switches from good-old mainstream programming languages to something else – Be it a functional programming language, a scripting language, or even just an open-source application. If it is outside the comfort zone of Eclipse (or visual studio) and Windows’ next-next-next installers, it’s too hacker-ish for many students’ taste.

Continue Reading

A Bad Case of Geek Humor

I haven’t written here for a long time (suffered from a bad case of deadlines), so let me brighten things up by unfolding one of the most severe cases of geek humor that I encountered.

The Erlang standard library includes Mnesia, a distributed database library. It is a most useful application. To make it even more useful, it includes the Table Viewer (TV) – A Tk application that shows the content of Mnesia tables.

When I opened it, I was surprised to see that one of the options is “Error Messages in Haiku”:

Continue Reading

Radioactive Code

“It takes 10 years to study, train and specialise in order to be a M.D that prescribes radiation therapy to people. It takes 3-4 years to do a Bachelor’s degree in order to be a programmer that codes the machine that blasts peoples with radiation.”  I often open my OOP course with this sentence, trying to motivate SE students to take their programming skills seriously. A couple of days ago the New-York Times published a gruesome proof why that sentence presents a real problem. Apparently, software and configuration errors in linear accelerators (the machines that blast patients with radiation) caused numerous injuries and several death cases. Now it’s official: Bad code kills.

Continue Reading

Curried Predicates in Prolog

Prolog is not a functional language – Not yet, at least. Sometimes, that’s a shame, especially when you want to use meta-predicates such as “forall” or “findall”, and use a predicate with partial arguments as the goal – As you would have done in functional programming languages.

Luckily, that specific scenario is actually possible – In SWI-Prolog, at least. The “call” meta-predicate, and its derivatives, may take a functor and extra arguments as parameters. Then, the extra arguments are concatenated to the arguments of the functor, and the resulting functor acts as a goal.

If this is all Prolog-Chinese for you, here’s an example:

Continue Reading

Erlang: Strong Buy

I’ve returned last week from EUC’2009. My conclusion: If programming languages were stocks, and if I were a market advisor, I would put a “strong buy” recommendation on Erlang. If you have some spare “programming language money” (that is, the time and patience to learn a new language), put it on Erlang. It would be worth your while. Here are some reasons why:

Continue Reading

I’m Speaking at Erlang User Conference

Mayer and mine work on self-application in Erlang is going to be presented on the Erlang User Conference 2009. Here is the full teaser:

Most servers and clients in Erlang are implemented as named procedures in named modules.  Similarly, processes communicate via named messages.  This exposes and fixes a great deal of information about an Erlang application: The names of the modules, procedures, messages between servers and clients, etc.  This talk explores how to gain anonymity through the use of anonymous higher-order procedures.

To spawn a process on a node, one must either to use a module name and a function, or to pass an anonymous procedure.  In order to use a function from a module, the module file must be available on the remote node.

For a server to receive many messages, the spawned function must be recursive. Recursive functions are typically implemented in Erlang via a name in a module. Running such a server requires that the client be aware of the names of the module, function, and messages.

Functional programming languages (such as LISP, Scheme, and Erlang), permit recursion to be replaced with self-application, which means functions that are applied to themselves.  This is a classical technique from functional programming.  In Erlang, this technique adds flexibility, anonymity and security.  Specifically, we demonstrate how to

  • Spawn a fully-functional server without requiring shared modules or access to  the file system.
  • Have client-server groups that take the message names as arguments.
  • Use random and constantly-changing message names.

See you there!

2 comments so far, add yours

A Lesson from Budapest

No-one is more dangerous than the supervisor of a failed system, who abandons the system, but keeps the loot: A position of power.

I saw that quote on the 1956 anti-communist students’ rebellion memorial in Budapest. (read: Buda-pesht. There is no such city as “buda-pest”. It’s a transliteration error.)

Without mentioning names, I can think of several engineering and programming practices that can fall into this category: Mistakes that are too collosal to admit; Practices that give power to the supervisor but no merit to the practitioner.

In the spirit of Tom Gilb, any development method should by itself be subject to development. Keep that in mind next time someone declares “the ultimate programming methodology” or “the last programming language we’ll ever need”.

(Btw: COBOL has just celebrates its 50th birthday.)

2 comments so far, add yours

Prolog Hacking

“Prolog” and “Hacking” are not two terms that are usually found in close proximity. In a matter of fact, most hackers I know do not consider Prolog as a programming language. Prolog is just that thing you learn in a principles of programming languages course, that demonstrates “what are declarative languages”. Afterwards, you forget about it and go back to program in some imperative language, just as Kernighan & Ritchie intended you to do.

You couldn’t get it more wrong.

Continue Reading

My IDE is too big!

I thought that my trustworthy Dell laptop with 2 GB of RAM will serve me throughout my Ph.D, but that was before I had to develop an Eclipse plug-in. A single instance of Eclipse Galileo modelling edition chews up 360 MB of RAM just for starters. Running another instance in debug mode doubles the weight, at least. Pile upon that a couple of UML2 documents with their fancy editors, et voila! Half of the RAM is gone.

Why is that? Even the notoriously hoggish IntelliJ IDEA 8 doesn’t take that much RAM. I don’t know for sure how comes Eclipse became the new memory hog in town, but I have a guess: It has something to do with EMF.

EMF stands for “Eclipse Modeling Framework”. It’s the underlying layer that enables all those nice property sheets and graphical editors. Basically, it adds highly-detailed reflection to Plain-Old Java Objects (POJOs) by generating a massive amount of code. This reflection is needed for auto-generating all that fancy GUI, but it requires supporting data structures – And that shows up on the system monitor.

(Btw, if you’re willing to pay the price for reflection, why not use a language that have native reflection, such as Python, and get rid of those code-generated monstrosities? Just a thought.)

No solution this time. It is a ranting post.

Leave the first comment