Steve Yegge ported Rails to JavaScript

Board

One of the first talks that I went to at Foo Camp was called “Google Rails Clone” by Steve Yegge. With a title like that, how could I resist?

Google uses four different programming languages: C++, Java, Python, and JavaScript. Apparently, nobody likes writing web front ends in Java, not even Google who has a lot of web front end code in Java.

In an effort to increase developer productivity at Google, Steve tried to convince the company to adopt Rails (and consequently Ruby) as a programming language. When that fell on deaf ears (Google really does not want to increase the number of languages that must be supported by their infrastructure), Steve decided to do what any other frustrated programmer would do: he ported Rails to JavaScript. Line by line. In 6 months. Working 2000 hours. Steve is a coding stud.

Steve Yegge

It runs on top of the Rhino JavaScript engine that runs on the JVM. He also fixed some bugs along the way, and tightened up security considerably (lesson: working with your security organization in the early stages of a framework, even a port, saves you tons of time and pain later). You can see how Steve became rather enamored with JavaScript, when he proclaimed that it would become the Next Big Language.

Maybe it will be. The forthcoming optional static typing in EcmaScript 4 will also give his Rails implementation a big performance boost.

This is seriously cool. Thanks for sharing the story!

Twitter Digg Delicious Stumbleupon Technorati Facebook Email

38 Responses to “Steve Yegge ported Rails to JavaScript”

  1. Interesting. Another port of rails to JS was TrimPath Junction (http://code.google.com/p/trimpath/wiki/TrimJunction), which I started back in 2005. Turns out it was 2 years too early!

  2. 2000 hours / (6 months == 180 days) == 11+ hours a day!
    wow! where does he find the time ?
    Or was this an official google project with him working on it fulltime?

  3. The Next Big Language on Rails

    John Lam: In an effort to increase developer productivity at Google, Steve [Yegge] tried to convince the company to adopt Rails (and consequently Ruby) as a programming language. When that fell on deaf ears (Google really does not want to increase the …

  4. That’s what the marshmallow story and most recently, his rich programmer food blog post was all about.
    Check it out http://steve-yegge.blogspot.com/

  5. Google Rails Clone

    GoogleのSteve Yeggeが2000時間でRailsをJava Scr…

  6. Google Rails Clone

    GoogleのSteve Yeggeが2000時間でRailsをJava Scr…

  7. Google Rails Clone

    Googleの Steve Yegge が2000時間でRailsをJava Scriptに移植したという話をMSの中の人がしています。 John Lam on Software: Steve Yegge

  8. Great to see similar tech :)
    If you are a .net guy then my project may interest you – it converts your c# and vb.net assemblies to javascript.
    http://jsc.sf.net
    cheers

  9. Did he say why he chose this path instead of using Grails?
    Or use Django? Or WebPy? Or CherryPy? Or any of the other web frameworks for Python or Java?

  10. Morning Coffee 94

  11. That’s interesting. The most innovative tech company is already starting to slow down due to legacy applications.

  12. Scott: Steve said he first considered using Python (via Jython) but that he was dissatisfied with Jython’s momentum. He also said he’d made this decision *before* Google hired Guido and that he might’ve done otherwise if he’d known Guido would be on staff.

  13. Now I’m incredibly curious about the marshmallow story’s background.

  14. Optional static typing won’t necessarily bring performance increases. Look for example at Groovy, where optionally adding static types actually slows down execution. Why? Because it’s still a dynamic language around those static types, and as a result more work must be done to keep confirming that the variables with static types remain safe. There are probably ways to improve this, but there’s always going to be this overhead for some situations.
    Personally I think optional static typing is only useful for two things:
    - interfacing with statically typed languages (i.e. being able to define method signatures et al that require specific types)
    - forcing typing contracts on particular variables (with the understanding that this will slow execution in many cases)
    Don’t look to optional static typing as something to automatically increase performance.

  15. What about Perl6’s optional static typing? At least when I watched Audrey Tang’s presentation, she mentioned that the optional types would improve performance.

  16. @Dean:
    What Charles is saying is that optional static typing will not “just” give you a perf boost. But optional static typing done intelligently can give you that perf boost. I suspect that the Google folks will do it “intelligently” :)

  17. @zproxy:
    Wow. That is a seriously cool project! Thanks for the link – it’s on my stack.

  18. re: static typing
    Static typing has been shown to make for a very siginificant performance boost in the Tamarin VM, which came from Adobe’s ActionScript implementation and is being merged into Spidermonkey, Mozilla’s C-based JavaScript engine. Rhino is Mozilla’s Java-based JavaScript engine, but there were not any immediate plans to implement JavaScript 2 with it. That is, the engine Steve’s Rails clone is running on is not expected to actually get optional static types any time soon. But if Google is using Rhino now and could use the performance boost, then perhaps Google will put some resources toward implementing the new features.
    Does anyone know if/when this Rails clone is going to be publicly available? (I’m not missing a really obvious link on this page, am I?) Right now I’m in the process of moving to Helma , but I’d seriously consider this one instead if it were available.

  19. So what does this really mean? How can JavaScript emulate Rails? Does it handle database ORM, too?
    This post sounds cool and all, but how can JS, a client-side technology, emulate Rails, a (more-or-less) server-side tech?

  20. Hi Rabbit, you can use Rhino (http://www.mozilla.org/rhino/) to run Javascript on the server using the Java JVM.
    99% of the time, the web browser downloads and runs Javascript, but the server can execute javascript code as well, and return the result.
    I’m a big fan of both Rails and Javascript, and am excited to see how this turns out.

  21. If no-one at google likes writing webapps in Java then why did they write GWT? It seems like there are two camps going in opposite directions.

  22. All i can say is…
    Sounds crazy! 0_0
    Though then again, i guess if its all server side (and thus doesn’t immediately bump into the infamous issue of cross-browser compatibility), its not so bad. :)

  23. Rails is hardly a major win for the type of webapp that Google writes. What are they expecting Google to use it for? Writing the next big blog software? lol.

  24. Heya John, thanks for the props.
    The only quibble I’d make with your otherwise solid summary is that lots of folks at Google do like writing web apps in Java. It just didn’t seem practical to me to do a Rails port on the JVM using Java, when more Ruby-ish languages like Jython and Rhino are available.
    Cheers,
    -steve

  25. He told us on his blog: I was in Barnes today, doing my usual weekend stroll through the tech section. Helps me keep up on the latest trends. And wouldn’t you know it, I skipped a few weeks there, and suddenly Ruby and Rails have almost as many books out as Python. I counted eleven Ruby/RoR titles tonight, and thirteen for Python (including one Zope book). And Ruby had a big display section at the end of one of the shelves.”

  26. This looks _very_ interesting.
    I’m curious: does his framework require you to use any particular language on the backend, or is it server-side agnostic?
    Charles Jolley of SproutIt is working on a Cocoa-esque JavaScript framework that sits on top of Prototype.
    Checkout Mailroom (sproutit.com) to see it in action. It’s pretty slick. Should be open-source at some point when it’s mature enough.

  27. does his framework require you to use any particular language on the backend, or is it server-side agnostic?
    Well, yes, it requires Javascript and a JVM. Its the opposite pole to language agnostic.

  28. So, I assume this work was started before JRuby on Rails was an option? Does the fact that you can now run it change the picture at all?
    Or was the point that, regardless of the underlying tech, it’s not desirable to add another programming language to the stack at Google, even if it’s running on the JVM?

  29. Yeah, but look what it did to him physically. Worth it?

  30. JoR – Javascript on Rails. Is it April 1st?

    Im not sure what to make of this one from the Googleplex , its certainly food for thought but

  31. JoR – Javascript on Rails. Is it April 1st?

    Im not sure what to make of this one from the Googleplex , its certainly food for thought but

  32. JoR – Javascript on Rails. Is it April 1st?

    Im not sure what to make of this one from the Googleplex , its certainly food for thought but

  33. JoR – Javascript on Rails. Is it April 1st?

    Im not sure what to make of this one from the Googleplex , its certainly food for thought but

  34. JoR – Javascript on Rails. Is it April 1st?

    Im not sure what to make of this one from the Googleplex , its certainly food for thought but

  35. This is cool. I hope this JS Rails clone gets released on the Rhino open source site, and look forward to being able to try it out sometime soon. It will be interesting to see the traction it gets, esp if used a good amount within Google and improved upon. Exciting news-

  36. Publishing a Blog From a mod_atom Store

    Seth Gordon: That would certainly cover the front page, but thats about it. Fortunately, there are bits and pieces that cover the rest. Ive contributed heavily to Planet, the Universal Feed Parser,

  37. “JavaScript On Rails” And Other Server-Side JavaScript Platforms

  38. big book study guides

    big book study guides