Ruby for non-Rubyists

Yesterday I spoke to a pleasant mix of Java, .NET, Ruby, Python and PHP developers at Dallas TechFest. My goal when speaking to enthusiast crowds of this sort is to show the light that I’ve found in my programming journeys over the past couple years. This time around I tried to take a page from the inimitable Richard Feynman by structuring my talk into two sets of “Six Easy Pieces”.

The first part starts off with the stance that *programming shouldn’t suck*. From there I talk about the intercontinental railroad, Sapir-Whorf, Pattern Languages, the Gang of Four and flattery. In the end, we have an idea of how to better approach programming so we can have fun doing it.

The second half is partially showing off Ruby and partially a gauntlet thrown down to other languages. The main point is to show a progression of ideas I see in lots of Ruby code, from sensible naming to closures ending up with metaprogramming powering declarative programming and internal DSLs. You can implement the ideas from the beginning in any language. However, the ideas towards the end require a more progressively designed language. I’d love to see non-Ruby implementations of the programs towards the end of the presentation, if only for comparison and Rosetta Stone purposes.

Thanks to everyone who was in attendance and especially those who stopped to chat with me before and after the presentation. Without further ado, please enjoy Six Easy Pieces (Twice Over).

I'll see you at Dallas TechFest

For the past couple of months I’ve been -procrastinating- helping to organize the Ruby track for the Dallas TechFest Dallas TechFest. Its is a language and technology agnostic conference on May 3rd. There are tracks covering Ruby, Java, .NET, Emerging Technologies and Flex. Its a great opportunity to see sessions on your own language of choice while learning what the other guys are up to, all under one roof.

Confirmed speakers for the Ruby track are:

* Jim Hughes
* Yehuda Katz
* Glenn Vanderburg

…and myself. Other presentations of interest to Rubyists:

* Getting started with the ASP.NET MVC framework
* REST: the basics and the not so basic
* Pardon the interruption: what’s the deal with Groovy?
* Developing native applications for the iPhone
* Google Android

I hope you’ll come out on May 3rd, 2008 learn something new, either in the area you work with today, or in a new technology that interests you.

Cost: $0 (!)
Where: Addison Conference and Theatre Center
When: May 3rd, 2008, 8 AM to 7 PM

IIS 7, IE 8, Iron Ruby MEGA-MIX

Not only do you get a Mega-MIX, I’ll try it in haiku form. Because, I’m feeling sassy.

h2. On IIS

Metabase to angle
brackets; FastCGI now,
Mongrel later on

Decoded: they dropped the metabase for XML configuration, they can PHP and Rails apps through FastCGI now and they’re working on something like @mod_proxy_balancer@

h2. On IE 8

Security blah
Many fancy features; ask
Chris for IE validator

Decoded: even more security improvements, lots of fancy new features (see Ajaxian for more coverage), and over beers, Chris Wilson thought it was not entirely implausible to build some manner of Firebug extension that warns you about possible IE incompatibilities in the current page.

h2. On IronRuby

Rails someday; outside
people build test suite; polyglot
code reality

Decoded: they want to run Rails on IIS at some point, some non-MS contributors built them a test suite so they know what Ruby interpreter APIs they need to build but didn’t have to poke around in MRI to figure it out, programming in multiple languages using the DLR on top of the CLR is possible.

Anders Hejlsberg is your new bicycle

Ding Ding Ding! We have a winner. Anders Hejlsberg is quite possibly the most clued-in designer of a mainstream programming language. The work that Anders Hejlsberg is doing with C# is amazingly progressive and forward thinking. He’s putting ideas like lambdas, type inference and anonymous classes in a mainstream languages used by armies of programmers. This, to a programming language nerd like myself, is a big deal.

So what’s the motivation behind all this? Well, he started off by saying that data does not equal objects. We’ve got data in XML, databases and all manners of weird files. Thus begat LINQ (Language Integrated Query) which makes querying data a first class citizen in C#. In doing so, you start to insinuate a declarative language inside an imperative one.

During his quick tour of LINQ, Anders made a point to emphasize his idea that “we over-specify the solution” in our programs, leaving little room for the execution infrastructure to do intelligent things. He shows some imperative code for ordering, grouping and filtering data, basically a rats nest of loops and conditionals. Using LINQ he refactors the code down to a simple, albeit SQL-ish query.

Once you’ve declared just the essence of your program to the implementation, it can do clever things to make it go faster. For instance, there’s a parallel version of LINQ in the works. Your average developers gets this “for free” by expressing his queries in LINQ. Thankfully, LINQ is just sugar for a straight-up .NET API, so the younger generation of developers who have never used SQL, let alone @malloc@ can still play. ;)

When he was wrapping up, Anders made a comment that, in the future, they are looking into making languages more like services. I think this is a strategy that they share with Sun — it’s not so much about Java or C# as the interesting runtime bits they ship with. I’m not sure where this idea will go, but I like the sound of it.

Some other great Anders pseudo-quotes:

* Pure Functional programming is fantastic…the only problem is that it doesn’t work for real applications
* Transactional memory is the string theory of computer science
* Dynamic versus static typing is a pendulum that is currently swung towards the dynamic side. The answer is somewhere down the middle. (I think he’s doing a pretty decent job of dragging mainstream languages towards the middle)
* Languages shouldn’t solve a problem until the solutions is known. Otherwise, you just slap a bunch of crap onto your language.

This was my favorite presentation of the week. I’m looking forward to talking to friends who use C# about the clever programming tricks I use every day in Ruby. And it should prove fun to gang up on Java folks too! ;)

Important ideas in ASP.NET MVC

In a former life, I worked in a Microsoft shop. So I’m not completely foreign to the Microsoft development tool landscape. At the time, C# and .NET were just slightly better than Java, from my perspective as a language nerd. Lucky for me, I haven’t done extensive work in J2EE frameworks or ASP.NET so I have no frame of reference for how they compared at the time.

Given my obvious interest in languages, frameworks and how that affects what programmers build, I enjoyed hearing about the new ASP.NET MVC framework from Scott Guthrie. The most promising thing about this tool, to me, is that MS is guiding people down the unit testing path by default. I don’t know if any other Visual Studio tools are doing this, but it’s a pretty big deal to me. I think that right now only the most enthusiastic programmers do some any form of TDD or BDD. Putting it in the hands of “vocational” programmers has the promise to significantly raise the state of the art in programming. As a side note, it was interesting to observe that 40-50% of the audience raised their hand about doing TDD and 33-50% raised their hand for using an MVC framework.

The framework itself is nothing surprising if you’ve looked at Rails, Django, CodeIgniter, et. al. What was interesting to me is to see how the framework is colored by running in the CLR. On the plus side, you get LINQ and a really good VM. On the downside, you have to use for loops and nullable types (wink, nudge). The rest is pretty much what you’d expect to see when you transliterate an MVC framework to C#, though they did display some creativity in making it decent to look at in terms of code style.

There was a pretty strong message that the tool is cross-platform (works with Mono) and cross-language. You can write a model in C#, a controller in Ruby and a view in Python. Scott even suggested that you could write unit tests in PHP, to which I thought, “PLEASE GOD NO!”

Scott a somewhat typical response, “Hey, I did this in Smalltalk in 1974!” — funny because it’s true. He also acknowledged its not for everyone. Some people need a car and some people need a motorcycle. Even so, the ideas that MS is putting in front of _a ton_ of programmers are progressive and important. That’s the most important part to me.

Open Source and Research at Microsoft

So, as I’ve alluded, I’m at Microsoft Intergalactic Headquarters this week for the Microsoft Technology Summit. The crux of the biscuit here is to invite people from communities not using Microsoft technology and show them what Microsoft is up to.

There’s particular emphasis on what MS is doing in the Open Source Software space. Sam Ramji opened up the event to give us a sort of rundown on what MS is now doing in OSS and interoperability. I was unaware that IIS7 will support PHP, that MS is changing their practices to suit the Samba project or that HyperV will, in part get released as OSS.

Sam mentioned that he is committed to not confusing Open Source and Shared Source. It’s a slight distinction to most people but it really tends to rankle those who know the difference. I think he best summed it up by saying OSS at MS is in year 3 of a 10 year project and to judge it by what they actually do, and not their overtures (big nod to Ballmer rattling sabers about OSS and patent litigation).

Next up, Kevin Schofield showed off some of the work MS Research has been doing. His first point was that research does pay off. Research money into technologies like VLSI, databases, parallel databases and workstations have yielded multi-billion dollar industries. Projects that start out as pure academics can evolve into major players such as Oracle and Sun.

MS Research’s mission is to advance the state of the CS art and ensure that MS has a future. By the latter, he means that MSR is a hedge on the company’s agility. They don’t want to turn a corner and find customers demanding something that MS doesn’t know about.

To this end, they hire the best researchers around and then don’t tell them what to do. In this way, they refer to themselves as the “world’s largest CS department”. However, knowledge transfer is critical. If they don’t transfer technology to the product groups, what they’ve done is useless.

I found it very interesting that Kevin said “tech transfer is a social process.” For this reason, he specifically hires people with good relationship management. People Hacks at work ya’ll!

Geek spring break

For the fourth time, I’m at the annual geek retreat in Austin. Since I went when it was but 300 people, I’m obliged to marvel at how big the conference is getting. I remember when we had to walk uphill, through the snow, both ways, *on fire*, to get to every panel.

This year, I’m going to retire the hoodie I got five years ago wen I first attended SXSW. It’s a big deal, mind you. FYI.

Anyhow, I’ll attend a subset of these sessions, if you’re curious. I’m hoping on “attending” the “hallway track” more often this year. Also, I’m going to take the leap and not bring my laptop with me. Just a Moleskine and my trusty tricorder.

More importantly I’m going to the Austin on Rails Happy Hour and playing at the Rock Band party with The Rural Jurors.

If you aren’t are coming, I will continually lament your absence. Otherwise, I look forward to seeing you there!