Prologue to Prolog and Scaling Scala

Seven weeks has been completely thrown out the window, but I have managed to down two languages during our last interlude.  I'm currently in the depths of Erlang, a language I've enjoyed for a long time as a conceptual mystery from afar.  Seeing actual syntax doesn't seem to kill any of the allure.

It is a good thing Prolog and Scala come before however, as concepts in each help segue  into the heavier functional programming languages later in the book.  Scala I had already seen, and fallen in love with.  I've noticed recently however that there has been a bit of a push back against it.  Apparently the Scala typing system that appears beautiful to me, is a pain to others.  Prolog on the other hand I had merely heard of quite simply described as "old".  I knew nothing else about it beforehand.

Turns out Prolog is a fairly interesting language.  It feels a lot like SQL (which I'm not certain would not have been a better choice for this book) with constructs that appear to create a database like table and query over it.  You build up a description of a problem, not logic to solve the problem.  Prolog then queries these rules and gives back a working solution set using a set of pattern matching constructs.  This gives you a great answer to questions that have one unambiguous answer (or a logically defined set of correct answers).  Performance however sometimes leaves something to be desired.

Scala still makes me feel giddy.  It takes so much of the Java boilerplate and throws it out the window.  Functional programming seems to live in peaceful coexistence with object orientation.  It seems like the only downsides Scala can claim all seem to be positives to me.  Namely they are Java compatibility, object orientation (and mutable state), and strong, static typing.  The first two seem to be a question of style, persons who find either addition distasteful dislike it being available for other developers in the language.  Personally, I find that a weak argument.  Pragmatically Java syntax and object orientation are useful tools in some contexts.  Strong, static typing seems to be more about taste.  Rubyists and other dynamic language proponents seem to dislike any static typing.  Static typing does seem to buy you performance and definitely offers refactoring capabilities however.  I think it really is a wash, if you've become accustomed to either, the other will feel alien and wrong.

In the end I don't think I'll be writing a lot of Prolog, but I have gotten a few new ideas about what I can use a SQL database for.  Scala still seems to be the city on the hill for the JVM, but it seems not all programmers are interested in traveling to Zion.  Too bad they can't learn to savor the flavor.