The Edge of Innovation

April 11, 2008

If you are a programmer that deals with web applications and you keep up with the latest trends, then there is no doubt you will at least have heard of Ruby on Rails. You might be at the level where you have read about Ruby on Rails and played with it a bit, but you really haven't immersed yourself the Ruby/Rails way. Maybe you know how to build web applications with Java, .Net or PHP, and you think "Rails is nice, but there's nothing Rails can do that you can't do in X".

If you are in this camp, it may be because you aren't willing to adapt your ways to Rails. To really understand the benefits of Rails, you have to not only learn Rails, but learn the best practices followed by good Rails programmers, like Skinny Controller, Fat Model, REST and Behavior Driven Development. You don't see the true benefit of Ruby until you start to fully embrace concepts like these. The only way to learn concepts like these is to read blogs, listen to podcasts, talk to other Ruby programmers at work, user groups and conferences and most importantly, you have to actually write code that reflects what you have learned. You must put aside your preconceived notions about what is right and what is wrong and surrender to the flow. You must unlearn what you have learned.

So if you haven't experienced this transformation first hand yet, and someone asks you "What is the biggest advantage to Ruby on Rails", I would be willing to bet your answer would be productivity. This is the way I think many people involved with technology, who don't fully grasp the Rails Way, perceive Rails. They believe, with some cynicism, that because of the dynamic nature of Rails, you can develop applications faster. They'll also probably say the downside is that Rails can't scale.

But anyway, I'm hear to say that productivity is the most over-rated benefit of Rails. The real advantage to Rails is that it is written in Ruby, which is a very powerful language that will change the way you think about programming. It's funny, I've thought to myself a number of times about how interesting it is that Ruby fundamentally changes the way you think about programming and that "Thinking in Ruby" would probably be a great book. But ironically, Bruce Eckel, the author of the "Thinking in..." line of programming books, seems to be happy with Python and not willing to give Ruby a chance. Who knows, that article is a few years old now, so maybe he's changed his attitude towards Ruby since then. I know mine has.

It's hard to quantify the advantage that "Thinking in Ruby" brings. The simplest way I can state it is that you will look at problems differently and come up with better solutions, solutions you may not have thought of if you were programming in other languages. The way I support this claim is by looking at some of the web application development innovations that have come out of the Ruby community.

The first is Rails itself. Rails has been copied, ported, attempted to be ported or talked about being ported to almost every other mainstream language you could think of, including Groovy, PHP, JavaScript, Perl, Java and .Net. This phenomenon is unique to Rails, I can't think of any other web application framework that can say that. If not the whole framework itself, parts of it such as convention over configuration, migrations and embracing REST have influenced the way web application development is done in almost every language.

Another example is HAML. HAML is a truly new and different take of the problem of generating HTML from a combination of dynamic code and HTML. It is a new idea and it has been ported to PHP, Python, and .Net. Whenever you have a framework or library that is being ported to other languages, it shows that the framework being ported contains new and good ideas about programming. In other words, it is a contribution to the paradigm of web development and a clear sign that the original language that the framework was implemented is at the edge of innovation.

Another example is Behavior Driven Development. This example is even more interesting because the idea originally started in Java with the JBehave framework. Even though the idea for behavior driven development started with Java, the idea didn't really take off until it was implemented in RSpec. They are fairly similar in terms of syntax. Here's an example from the JBehave website:

public class CheeseBehaviour extends UsingJMock {
    public void shouldRequireTheUseOfMocks() {
        // given
        Mock cheese = new Mock(Cheese.class);
        Sheep sheep = new Sheep((Cheese)cheese.proxy());

        //expect
        cheese.expects(once()).method("squelch").withAnyArguments();

        // when
        sheep.eatCheese();

        // then
        verify();
    }
}

and here it is converted to RSpec:

describe Sheep do
  before do
    @cheese = mock(Cheese)
    @sheep = mock(Sheep, :cheese => @cheese)
  end
  it "should squelch when it eats cheese" do
    @cheese.should_receive(:squelch)
    @sheep.eat_cheese
  end
end

For whatever reason, JBehave really never took hold in the Java community, but RSpec has in the Ruby community. RSpec has been ported to .Net, PHP and Groovy. All of those projects describe their code as a port of RSpec, not JBehave. Again it is Ruby influencing the wider web application development community.

Post World War II, the center of the art world was New York City and it was there that the modern art movemement was born. New York was where innovation in the art world was happening. In that time period if you wanted to be a serious artist, you had to go to New York to experience the movement first hand. Today, I believe the Ruby community is leading the way in innovative techniques for web application development. There is certainly innovation happening in other languages like Python, Smalltalk and Erlang as well, but I don't think any one other language/community is doing as much as Ruby. As far as I can tell, languages like Java, .Net and PHP are doing nothing to innovate web application development. They are simply lagging behind, playing catch up and trying to figure out how implement new features pioneered in the Ruby community and others as closely as possible, given the limitations of the language. So if you are a web developer, I suggest you ask yourself this question. Are the languages and frameworks you are working with leading others to come up with new ideas? Are the languages and frameworks that you are working helping you come up with new ideas? If not, embrace Ruby and someday you will discover an elegant solution to a problem, one that you may not have without Ruby.

A language that doesn't affect the way you think about programming is not worth knowing. -- Alan Perlis

Posted in Technology | Tags Javascript, RSpec, .Net, Python, Ruby, Java, Rails, HAML, PHP | 0 Comments

The Web Application Framework Candidates

February 14, 2008

The web application framework race is heating up, so let's take a moment to meet some of the candidates.

Java

George W. Bush

The current leader in the web application framework space, has a declining approval rating from the general public, but still maintains support from members of the static typing party.

Rails

Hillary Clinton

One of the leading candidates from the dynamic typing party. This candidate has experience that proves she can bring change.

Merb

Barack Obama

A candidate from the dynamic party who is quickly gaining support, running on his campaign of hope. Has a stance similar to that of Rails on many of the campaign issues.

Django

John Edwards

Another strong dynamic party candidate, but having a hard time stealing the spotlight from the two dynamic party candidates, despite running on a strong platform.

Grails

John McCain

The leading candidate for the static typing party, particularly among moderate static typers, but having a hard time gaining support from conservative members of the static party who claim that he is too dynamic on some issues.

Scala

Ron Paul

A candidate that appeals to some members of both the dynamic and static typing parties, quickly gaining notoriety on the web for his support of once unconventional ideas like functional programming.

Posted in Technology | Tags Django, Merb, Scala, Python, Ruby, Java, Rails | 4 Comments

Scala, Clojure and Lisplets

December 22, 2007

As a result of reading Steve Yegge's latest blog rant, I have discovered a few new interesting things. Steve's rant is very anti-Java for all the right reasons, but falls apart when it gets to the "So here's what I'm going to do about it" part. He's switching to another language, one that runs on the JVM, but not Lisp, Jython, JRuby or Groovy, but for apparently no good reason, JavaScript. Not that JavaScript is a bad language, but I see reason why you would choose that over Lisp, Python or Ruby, and he fails to offer one.

The good thing is that through the comments of this post I learned about a few things, either directly or indirectly. Some of these thing have been around for a long time, but hey, I'm just learning about them.

First, there is a ground swell of support for Scala. I checked out the docs on their site and does look like a very powerful, expressive language. It seems to have many of the features of Lisp without being a Lisp dialect. It is syntactically Java-ish, but unlike Groovy, which really for some reason just seems like much-needed syntactic sugar for Java, Scala feels lieke a completely different language. In other words, and not that this is saying Groovy is a bad thing, but Groovy really isn't conceptually different than Java, where as Scala is, with things like case classes, for example. This is a language I'll have to look into some more.

There is also a mention of a new List-dialect for the JVM called Clojure. Clojure creator Rich Hickey (you need a blog Rich) recently gave a presentation on Clojure at LispNYC and the audio and slides are there. Clojure has a bunch of interesting ideas in it which he explains in the presentation. Clojure has a literal syntax for vectors (a.k.a arrays, lists) and maps (a.k.a Hashtables, Dicts) in addition to the traditional lisp lists. It is not quite a purely functional language, but strongly encourages it, making it the default programming paradigm over object-orientation. I've been wanting to check out Haskell and Erlang to get familiar with the functional programming paradigm, but Clojure might be a good way to get some exposure to that as well.

Another thing I found is Lisplets, which was created by Rich Hickey as well a few years ago. It is a Java Servlet that packages up the entire environment of an HTTP request, request parameters, cookies, session, etc, into an S-expression that is then handed off to a Lisp interpreter that listens on a socket. Lisp then reads the s-expression, does whatever it does, and then returns data to the Servlet which gets sent to the client. Mod_lisp is based on a similar concept. I think it's kind of interesting to think of web development in this manner, with a definitive layer of abstraction between the processing of request into a data structure, and then processing the request based on that data structure.

Posted in Technology | Tags Lisplets, Scala, Java, JVM, Clojure, Lisp | 0 Comments

The Importance of a Common Development Philosophy for a Team

September 25, 2007

I try to stay out of language wars, because they just aren't productive. One thing I have found interesting is that a year ago or so, it seemed to be the Ruby guys picking fights with the Java guys saying "Ruby is better than Java, Rails is better than J2EE". Lately, it's Java guys saying "Java is better than Ruby, JEE/Seam/Struts 2.0/RIFE/Wicket/Some yet to be invented Java framework is better than Rails". I get the sense that most Rails guys have just moved on from arguing with Java guys about this, although some still have a hard time resisting the temptation. It's a hard temptation to resist, because I hate to see people say things about Ruby that I disagree with, and I'd hate to see more people believing the anti-dynamic languages, anti-Ruby FUD. Maybe FUD is a little harsh, but I'm sure other people consider my support of Ruby to be FUD.

I really liked Dion Almaer's response to another "Java is better than Ruby" post:

Quite frankly, at this stage of the game all I care about is having a small team of developers that I respect and enjoy working with.

That's where I'm at too. It's more important to be on a team with developers that you respect. But it's more than respect really, it's more like sharing a common development philosophy. I can envision a scenario where there is a Java developer that I respect, but that same developer just hates Ruby. In that case, we're not likely to be on the same page in terms of the way we think a certain solution should be architected, and that being the case, it's not likely to be a productive situation for either of us. I think for anyone involved in a position of hiring developers, this is a key factor to try to be able to evaluate. First, what is the philosophy of my development team, and then when interviewing candidates, will this developer fit in with the team well. I'm sure there are a lot of factors that contribute to this, but here's a few I can think of:

  • What is your preferred development platform?
  • What is your preferred method of unit testing?
  • What are some of your favorite features of language x?
  • What are some of your favorite features of framework x?
  • Which database platforms have you worked with, and which do you prefer?

I think anytime you can put together a team of good developers who are on the same page with most of these answers, that team is going to be productive.

Posted in Technology | Tags Ruby, Java | 0 Comments

Java vs. Ruby

September 21, 2007

Hilarious.

Posted in Technology | Tags Ruby, Java, Rails | 0 Comments

<< Newer Articles   Older Articles >>