Scala: A Prologue (Or The Learning of a Language)

Borrowing an idea from Will, I’ve decided that I will be detailing the progress I make as I teach myself a new programming language: Scala. I’ve heard nothing but good things about it and have toyed around with a couple of (simple!) tutorials. I’m impressed enough to have ordered a book which I expect to receive sometime toward the end of this week. While this is simply a prologue to the actual play, I would like to discuss my motivation for sharing this.

First, I don’t have a particularly good recollection of my first steps taken with any programming language early on in my education or life. The first one I learned–contrary to popular belief–was not PHP; it was Perl. It’s almost embarrassing to admit, not so much because I find Perl to be a terrible language (although it is something of a write-once language), but because most hackers cut their teeth on languages closer to bare metal like C. I’m sure I still have some of my first Perl programs available, and I’d be hard pressed not to blush were I to browse them, all while wondering who the idiot was writing such awful code! I wish I had written a journal during those early days to record my first few steps. Though my memory of that particular time period isn’t great, I do recall some months of playing with Perl and CGI all to print random quotes to a web page. That’s what fascinated me most, and I think that was what spawned my love affair with web application development.

Second, I’d like to record mostly for my own future reference my steps through a language that differs significantly from the ones I currently know. I have quite a few under my belt (Python, PHP, Java, Perl, C#, and VB.NET–though the latter two are virtually identical thanks to the CLR with only syntax placing a wall between them) these days, and I think it’s generally a wonderful idea to have a history available for reference, either for personal fulfillment or as a utility available to others. Since hindsight is often viewed through rose-colored glasses, it should be interesting both to myself and anyone else reading this future work (even years from now) to peruse the sorts of “gotchas” I encounter–and what I find easiest to grasp. If nothing else, it might equip future Scala coders with some tools to combat the inevitable stumbling blocks they’re bound to encounter.

Third, I think this might be a great way to encapsulate my own thoughts on the learning process. Perhaps I could grant some insight on what happens inside a developer’s mind as they learn a new language especially one that exists outside their comfort zone. Scala combines the worlds of OOP and functional programming offering features I’m certain I have yet to understand. I’ve never delved into a functional language before (Python borrows some ideas from functional programming, mind you), and I expect to get caught by a hitch or two along the way. For current Java programmers, my work here may offer some clues as to the sorts of things you should expect to both enjoy and suffer along the road. Not that I wish to imply you’ll suffer through the language; rather, I’d like to hint that there are certain things that might not immediately seem intuitive to the Java developer. Nevertheless, being a JVM-hosted language, Scala presents us with some distinct advantages. There is also a .NET CLR-hosted port of Scala, too, for those of you living in the kingdom of Microsoft. Suffice it to say that there’s a little something for everyone.

Finally, I’d like to offer this as an analog to Will’s project I mentioned earlier. He came up with this idea some months back (it’s still on his blog, in fact), and I commended him on the utility of the notion. It’s such a great idea, I’d like to present my own implementation of it–but from a different perspective. Indeed, this project in particular–this recording of my own experiences–might serve itself to him as a guidebook of should he choose to do any sort of programming and more importantly extend that programming into other languages. Programmers these days don’t get by with a single language alone. I’ve read from sources too numerous to list that the average programmer should take the time to learn at least one language per year during their career. No, they won’t jumble themselves together–though you might notice a couple of conflicts (indented formatting habits while switching from Python to PHP or terminating lines with semi-colons while switching from Java to Python).

Along these lines, it’s important to point out that once you learn a language, the general rule of thumb is that it gets easier to learn others. Perhaps this has something to do with the formation of synapses that make the learning process more streamlined rather than establishing a particular bias toward certain constructs, syntaxes, and idea abstraction. This holds true, I think, for both natural (spoken) language and programming. Those in my circle of peers who know at least one language other than their native tongue have a much easier time grasping new ones, and I certainly know from experience, personal and otherwise, that learning programming languages becomes easier as more and more make their way into one’s skill set.

Scala looks to be a great general purpose language. It even has a web framework called Lift that can operate on any fairly modern servlet container (like Tomcat), so there’s some utility to be had from it outside the domain of generic applications. Its allure to me lies in its management of higher concurrency, which is something that still seems slightly awkward in languages like Python and Java. (To be fair, C# has advantages over Java mostly because it is newer, but there are still other things I like most about Java’s model–many of which Python borrows.) If nothing else, perhaps this coming project of mine will make (or break) your decision to adopt Scala.

Don’t expect this writing style to be formative for my future narration on this topic. Academic-speak and structure is something I enjoy, but I also enjoy writing entertaining works of literature. Thus, when I actually write the Real Thing, I hope it’ll be fun. You may grow to love or hate it. It may even take a month or two–maybe longer–to write in its entirety, but the results will be worth it. I promise.

Until then, stay tuned for the Links of the Week coming Wednesday or later. I have a few things in the queue for this week, so LotW might be delayed. If so, I apologize ahead of time.

Update Links of the Week will probably wait ’til Friday. I’ve been pretty busy, and I’m going to be putting together a tutorial on vBulletin tutorials for my own purposes. I know Will really finds the LotW entertaining; I apologize ahead of time, but I’ve really been a little busy.

Also, I’ve fixed some mistakes in this post and rephrased a few parts to make clear some of my original intent. It still isn’t perfect. I couldn’t finish my updates in Firefox due to persistent crashes, and if there’s something missing, I’ve noticed that Chrome didn’t open the original version of the document when I went to edit it. Weird.