I wish I had prepared better that evening so I could join the group for pizza after the presentation, but that is my only regret.
The following is what I learned from the presentation and beyond that are a few of my own thoughts on the value and future of Scala.
Scala is a functional language built on the Java Virtual Machine. Like Groovy, Scala can use existing Java objects easily, and Java can use Scala functions with a little bit of work.
What's so cool about functional languages and Scala? That's really the big question. The strength of functional programming is that every operation in a functional program can be thought of as a mathematical function. You can think of it as an implementation of Lambda Calculus, at least that's how I'm going to think about it until I find it doesn't work.
For example: The operation 1+2+3+5 be thought of asIn functional programming functions enjoy the same status as objects. Or another way to think about functional programming is, everything is a function, values can really be thought of as functions that returns a value.
theValueOne plusTwo plusThree plusFive
which gets evaluated to
theValueThree plusThree plusFive
which gets evaluated to
which gets evaluated to
What's the advantage of functional programming and what are the advantages of using Scala? One simple advantage of Scala is it's a new language that was conceived within the context of how programming languages are used today. What do I mean by that? Marten Odersky, the principal designer of Scala took careful index and consideration of the idiosyncrasies of the Java language and improved upon them. There are many restrictions and constraints in the Java language that we just accept because we've grown accustomed to them.
Java's a maturing language. Like people, maturity isn't all win. Like with people, programming languages pick up some undesirable traits over time. Older, wiser, and more capable, yes--but Java's starting to develop a gut, it's butt is sagging, and some of the new features are like the type of outpatient cosmetic operations that seem to be so popular with the over forty crowd.
Languages created on the Java platform are more like genetic engineering than cosmetic surgery. Designers can take the pieces of Java DNA and work them into their new language, they also have the opportunity to leave out the strands of Java DNA that they don't want. Only time will tell whether a bunch of Frankensteinien monsters come from this experiment. I'm inclined to believe that the LDL reducing ribeye steak is around the corner.
With new languages we have a great set of opportunities. First, we can see how languages are being used and develop features to accommodate those usages, e.g., XML is a first class citizen in the land of Scala.
We also can see areas where a programming language can be improved. For example, Scala has implicit typing. Consider String s = "I'm a String" verses s = "I'm a String". Is there any doubt as to what the type of s is? The Java language seems to think so, that's why we need to explicitly declare the type of all objects.
There is enough Syntactic Sugar in Scala to rot your teeth out.
That's all well and good, Groovy does the same thing. Correct. What does a functional language provide that other languages don't? Scalability. Consider this: a functional language composes functions by passing functions as arguments.
This is like a certain hot topic debate where a group of people rhetorically denounce a theory because it is not a fact. Ken Miller has an eloquent explanation for why a theory is more useful than a fact. To cut that 2 hour lecture to the chase I'll paraphrase: "A theory is more powerful than a fact because a theory can be utilized to derive facts."
A function in a functional language is like a theory. We pass theories around and then apply them to values to derive facts. For example: we may employ the theory of gravity to derive the time that it would take an object to drop 100 feet or 10 feet. If you think about it, most theories are compositions of other theories. Data points are applied to those theories to derive results.
Functional programming is no different. We define functions that are composed with other functions in a process called function currying.
The application of a value to the curried function is independent to currying the function. That is to say, we can curry functions without transforming any data.
As such, thread safety and concurrency are not issues in the functional programming world. That is where I see Scala making the biggest impact. When the Java platform can be used to perform distributed and concurrent computations then we will see a fusion of Java's ubiquity and the power of parallel computing on a scale that the Java community has never seen.