1.txt These days, the functional languages are all the rage. You see more and more hackers from the traditionally vanilla languages trying out things like Haskell or Scheme or OCaml. Breaking away from an imperative tradition forces us to think in a diﬀerent way, which is always a good thing. Recently, I’ve heard a lot about Erlang, especially from curious members of the Ruby community. This article is the result of my quick dive into the language, and will hopefully serve as a starting point for anyone else who’s been hearing the buzz, but hasn’t taken the plunge yet. For this article, I’m assuming you’re familiar with the general ideas behind functional programming, and that you have at least a conceptual grasp of concurrency. I’m also counting on you having at least an intermediate level of experience programming in any language. However, I’m not assuming you know any Erlang, so don’t worry if this is the ﬁrst time you’ve ever heard of the language. 2.txt here are a lot of functional languages out there. All of them have their strong points and their foibles. Some seem wholly academic, while others are as pragmatic as the best object oriented languages out there. Choosing which languages to study is really a matter of ﬁguring out what concepts you want to learn. Erlang is known for an extremely elegant concurrency model. I’ve always been one to cringe at the mention of things like mutex locks, race conditions, and the entire motley crew of conceptual baggage that typically come along with any sort of parallel programming. Joe Armstrong claims in ”Programming Erlang” that because Erlang is designed from the ground up for concurrency, it makes life a lot easier. This, along with the promise of a small, eﬃcient, and well thought out language implementation was enough to get me interested. 1
We’ll start by going through the nuts and bolts of the language, and eventually ramp up to a simple concurrent program in Erlang that implements a basic chat system. Though it’s far from fancy, it will show you how spinning oﬀ a few processes and getting them to communicate is almost trivial in Erlang. 3.txt Behavior Driven Development (BDD) is a hot buzzword in Ruby land these days. The trouble is, it seems that not everyone knows what it means. Those that only have a basic understanding of the concepts wonder what all the fuss is about and whether it is really any diﬀerent than Test Driven Development. These questions sometimes create a roadblock for those who are interested in learning about BDD without all the hype. Of course, the best way to explore any technical concept or toolset is to simply jump in and start poking around, and see what you can ﬁgure out as you go along. That’s exactly what this three part series on Behavior Driven Development using Ruby will do. We’ll start simple and work our way all the way to the BDD deep end. I’ve always been one to think that too much theory up front can be dangerous, so the ﬁrst part of this article will immediately jump into working with the primary BDD tool Rubyists have available to them, RSpec. I’ll cover some of the philosophy and core BDD concepts along the way, but my real intention is to expose you to a tool that you’ll hopefully ﬁnd useful at a functional level. Once you have the basic skills down, we’ll dive into more serious examples. We’ll start working with mock objects and show how you can use them to focus on the behavior of a dependent system rather than its actual state. We’ll talk about how to structure your specs so that they avoid the common anti-patterns present in TDD, and we’ll work on more complex problems. Along the way, we’ll build up a fun little application, writing the specs ﬁrst, in small iterations, to help you get the feel for how BDD works. The third part of this article will provide pointers on where to go once you’ve mastered RSpec and gained an appreciation for BDD. I’ll show you how you can bring some of your BDD concepts back to your unit tests in places where you simply have invested too much eﬀort to re-write everything from scratch in RSpec. We’ll also cover some helpful tools to help beat up your speciﬁcations and make sure they’re testing what you think they are. My hopes are that by working through the examples you see here, you’ll be able to get BDD and see how it can improve your coding experience and 2
get you past common hurdles that folks face who are struggling a bit with TDD. Though we have a lot of ground to cover, it will be worth it in the end. 4.txt The state Education Department says it can now calculate dropouts far more accurately using its new ”Statewide Student Identiﬁer System” in which every student is given a unique, anonymous ID number. With that, schools can track the whereabouts of missing students for the ﬁrst time, and learn whether students are truly AWOL, or whether they are somewhere legitimate. Did they leave the state? Join a homeschool? Die? The new system recognizes 29 kinds of student invisibility, 10 of which are logged as dropouts, including ”expelled.” One stunning fact they learned was that 53,600 students who claimed they were transferring to a new school never actually showed up. Another is that the state now knows for the ﬁrst time that there were 4,609 dropouts who completed all graduation requirement but one: the exit exam, which became mandatory two years ago. 5.txt Rather than have everyone skip ahead, ﬁrst let’s talk about Heath Ledger. He’s the linchpin of ”The Dark Knight,” and he’s terriﬁc. Director Christopher Nolan wanted to make an action movie that was diﬀerent from other action movies - darker, more twisted, more despairing, more bleak - and he has mostly succeeded in this latest Batman installment. He can thank Ledger for a lot of that. ”The Dark Knight” rides on Ledger’s performance as the Joker. So does a lot of audience hope, and that’s another element at work here. There has never been a situation quite like this: Audiences for the biggest blockbuster of the summer are ﬂooding in, not just hoping an actor will be good but also expecting and needing him to be absolutely amazing. They want something profound, to put alongside Ledger’s Ennis in ”Brokeback Mountain.” They want the fabled gift that arrives six months after the loved one’s death.