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.

5 comments.
***

Routing v0.2.2 Released

I’ve released Routing v0.2.2. This version fixes a few outstanding issues and reduces the number of notices encountered if error_reporting is set to E_ALL. You can also read the changelog here.

No comments.
***

Links: August 20th

I have a wide selection again for you today. I meant to post the Links of the Week yesterday but ran into two problems: 1) I was busy and distracted for most of the day and 2) I think this picture speaks for itself. I wasn’t motivated to sift through all those tabs!

Academia

Ket Fenwick has a piece titled “Why People Won’t Read Your Thesis“. He does raise some interesting points, although I can’t really say I agree. First, writing in academia at the graduate level–as I understand it–is to effectively prove that your understanding of a particular subject is not simply extensive but also well-researched. Conversational tones are OK for blog posts and informal writing; I can’t say such a tone is appropriate for academic papers or even documentation. Simply put: Some writing styles are more appropriate for certain disciplines than others. I propose an alternative. If you’re particularly passionate about a given subject and you’re a graduate student, write a book! If it’s important enough such that the average person should know about it, then it’s worthwhile to write material in the writing style of your choice to convey just how important your research is. Academia isn’t going to change. (A little warning about the link: The author’s writing style feels a little awkward and “bumpy” which I think serves to dispute his intent.)

News: International Relations

Ever wondered what other countries think of our political debates? For one, when it comes to health care, the British media is firmly on the side of–wait for it–our media. Although The Independent provides solid numbers, the numbers themselves are largely meaningless without context. Furthermore, since every site I’ve found that provides access to the WHO/OECD data requires a subscription, it’s difficult to gain more data for further study. Whether you’re for or against health care reform, you have to confess that articles like this one are decidedly biased in favor of a system more like Britain’s.

News: Stupid is News

Unsurprisingly, a Virginian woman was arrested when she posted a picture of an officer’s house. The Slashdot summary is biased in favor of the woman, of course, and while this is publicly accessible information, I think it’s important to understand that this woman was going out of her way to post it. The reason certain information in the public eye isn’t a danger is because it typically requires work to acquire. Frankly, I find this ordeal stupid; she got what was coming to her. Were these not officers, I’d imagine she would’ve been charged with stalking! Oh, what a queer world this is.

Along these lines, a judge has thrown out tickets given to citizens who received them for running red lights, declaring the camera program as illegal in Santa Ana, California. Whether you agree with them or not, the tampering performed by the city to increase ticket revenues is a disgrace and endangerment of the public.

News: Tech in the Media

Ever wondered what drives those late-night click fests through Wikipedia or Google? Slate explores why, and it may be a far more basic drive than you think.

Python

Brandon Bloom has an interesting writeup on why he dropped Django. I often wondered how useful Django was for general purpose web projects considering it was originally written as a publishing platform for a newspaper. Not to mention there are many competing frameworks available. Personally? TurboGears is the nicest, but being as TG2 is still stabilizing (IMO) and the documentation is a bit lacking, moving to a Python-based framework is something I’m holding back on. I was originally going to rewrite an ancient project to work under TG2 but chose PHP because of its ubiquity. I’m also reminded of why I dislike PHP so much…

Programming

Don’t know the difference between dynamic versus static languages and strongly versus weakly typed? Here is an excellent post that provides some examples of each. In unrelated news, I’m sick of arguing that Python is a strongly typed dynamic language. It’s amazing how many people don’t believe that.

Any idea what makes a programming language successful? It might not be the relative popularity, power, or expressiveness of that language. Instead, take a look at these pictures comparing the lead developers/inventors of each language. See a pattern?

Here’s an interesting blog post detailing “better arguments” in favor of (or against) programming languages. If you have a favorite language to love or hate, this is a worthwhile read, and you might just think twice about complaining that a certain language is “slow.” In the words of a famous meme: maybe you’re doin’ it wrong?

Speaking of PHP which I rail on somewhere in this list of links (where’s Waldo?), here’s a list of 30 best practices for beginning PHP developers. Most of these are pretty obvious, but if you’re just getting started, you really should read this. PHP is an easy language to learn, but it can also result in poor, insecure code if you don’t know what you’re doing. The point that should be listed as #1 is at #16: Never, Ever Trust Your Users. This is true–don’t ever trust input to be correct.

Is Scala reaching a tipping point? I think so. I just started getting interested in it about two to three weeks ago and finally got around to ordering a Scala book. Now, all of a sudden, I’m hearing about nothing but Scala! It integrates well with Java, runs on the JVM, and sort of reminds me of Python-mates-with-Java.

Science

Bone-setting glue might make those screws and plates a thing of the past.

SETI is finally performing real science. Okay, that was harsh. Let me try again: SETI’s search for intelligence outside our own humble abode is being used as a dual-purpose detector and thus far, they’ve made some pretty important discoveries (no ET yet).

Hunter (Trekk) linked me this one, too. I never realized that shampoo bottles can build up a dangerous charge and shock you.

Why do more leaves turn red in the US and yellow in Europe? It might have something to do with a protective mechanism from the last ice age–and insects.

Yes, this is science (even though it’s tech!). If Twitter were 100 people, here’s what it would look like. I could spend hours on informationisbeautiful.net. David McCandless also has a book coming out in February that looks really good. Put it on your wish list.

Technology

Tired of those smug Twitterers (twits?) peddling links to a variety of URL shorteners? I have found a solution. It’s called hugeurl. It does exactly what it says.

Aussie police discovered the merits of passwords when their database was effectively trespassed upon. Why not “cracked?” Simple: They didn’t have a password for their MySQL root user.

In case you missed it, there was a vulnerability in many XML implementations earlier this month. Make sure your libraries are up to day.

Danny Dover has a really good post for SEO (Search Engine Optimization). It’s a cheat sheet for web developers. Actually, he’s got a whole mess of them. I’d link them all, but you’d see a solid sentence of red. Instead, I’ll suggest you start here. It’s a worthwhile read and has made me consider redoing a significant part of this site–except for the fact that there isn’t anything terribly important here! If you have a major web-based project, web application, or simply run your business on the web, you really need to read Mr. Dover’s posts. No, really. You should.

Along a similar thread, here’s a list of 30 web developer cheat sheets linked from DZone.

Oh, and here’s another list–this time it’s of the 16 “most essential” Firefox addons. I use “essential” loosely here. I don’t use most of the addons listed here and there’s several important ones missing. Among them are: NoScript, Flashblock, WebDeveloper, Firebug, and Session Manager. I also use FoxClocks, Stylish, and TabCounter for the LOLcat factor. Yeah, that meme needs to rest. Anyway, maybe I need to make my own list of essential addons?

The Dreamliner has been delayed with even more trouble.

The web versus the desktop. Why is this a neverending debate? Tobias Svensson explores this topic in depth.

Ben Huh (yes, that’s his real name) is puzzled by the success of LOLcats. I am, too.

Weird and Unusual

Hunter (Trekk) linked this one to me. Ever heard the Mario Bros theme played by an RC car? Now you have.

Here’s an adventure in flying (don’t try this). If you wondered what would happen if you were to fly without a government-issued ID, read on!

No comments.
***