Profile cover photo
Profile photo
Mark Beeson
Everything I know, I learned from Hiro Protagonist.
Everything I know, I learned from Hiro Protagonist.


Post has attachment
So, when I was in second grade, our teacher brought in a computer, and we were all taught Logo. FORWARD 100 RIGHT 90 FORWARD 100 etc etc. I was what, maybe seven years old.

Fast-forward to today. Someone has created a new kind of kids' programming environment, called Kojo -- -- to help kids learn programming, math, art, etc etc.

Here's the kicker. Kojo is written in, and uses as its primary language, Scala. This is so beyond crazy that I have a really hard time fathoming it. There are kids out there learning to write in a language that we're using to write multi-million-dollar web applications in, and that we've only started learning ourselves.

Cue the gigantic flaming WTF.

I mean, just stop and think about that for a minute. 8 year olds working in the same language that you're working in, and probably A) learning it faster, B) learning a better style because they aren't hampered with years upon years of programming baggage, and C) getting more comprehensive knowledge of computers, logic, and programming at an age when you were just barely managing simple imperative, interpreted statements (if you even had access to a computer).

Imagine a kid, at, oh, 10 -- with a working knowledge of Scala -- debugging and refactoring a web application that you -- in your thirties -- have written. Imagine that kid even looking at a BASIC program; what would they possibly think? Where do you go, as a pre-teen, after you've nailed down functional programming? What could you possibly pick up in high-school or college-level courses?

I can only begin to understand the massive technological shift that's about to be dumped upon the world.

If you are a Java coder, you really, really, really owe it to yourself to learn Scala. Yes, there is an initial learning curve -- what language doesn't have one -- but you will find that, consistently, you are able to cut down your lines of code by 50 to 90 percent by moving to Scala.

The functional style of Scala, combined with Options, and the backwards compatibility with Java, make it an extremely powerful choice. I couldn't imagine going back to Java now. Once you get over the syntax hurdles, you'll find that Scala code comes much more naturally. It will only get more and more popular as time goes on.

For example-- let's say I want to write a method that takes a List of Person objects and returns a new List of only people who are over 21.


public ArrayList canDrink(List people) {
if(people == null) return null;
ArrayList<Person> ret = new ArrayList();
for(int i=0;i<people.size();i++) {
Person p = people.get(i);
if(p != null && p.getAge() > 21) ret.add(p);
return ret;


def canDrink(people:List) = Option(people).getOrElse(List()).filter(_.age > 21)

...that's it. No null checking (the Option and getOrElse call takes care of that for you). No object creation and funky iteration-- the language is taking care of all of that for you. This code will compile down to nearly the same bytecode, and will run just as fast as the equivalent Java code.
Wait while more posts are being loaded