Why is Ruby on Rails all the rage at the moment, and why do a lot of .NET people seem so defensive?
Undoubtedly, there is a buzz in development right now, things are changing rapidly, possibly more rapidly than they have for a good number of years. New languages are sprouting up all over it seems, with PHP and Python gaining massive popularity, F#, Erlang and Haskell suddenly being talked about as mainstream, Javascript evolving beyond that thing that makes "onClick" work in your browser, and Ruby (and especially Rails) becoming "flavour of the month" for web development. Ruby is even starting to invade the .NET mainstream space with evolutions like Rake, Cuke4Nuke and Nu muddying the divide that there once was. We even have IronRuby to make Ruby run on .NET
And yet, many .NET people seem defensive, as though their safe world was being invaded by a parasite.
I find this quite odd. As a developer who has been around for far too long, I have seen more than my fair share of languages and platforms come and go, none of them was perfect, and I would venture to say none of the ones we have now are either.
It would appear that a large proportion of the uncertainty is in the C# development 'community', though that may be as I don't really frequent circles that use VB.NET (and I'm fairly sure they are still busy being defensive about C# and probably haven't noticed that's *so* last year :) Somehow the introduction of new ideas is rocking the C# type safe world.
Some people seem to be concerned about Ruby itself, some seem to have concerns about the lack of a statically typed safety net, and some seem to think that "the Enterprise" needs something more professional than toys like Ruby and Rails.
To The Static Typing Stalwarts
Yes, it's nice to have that compile time checking that static typing gives you, it gives us all a warm sense of fuzziness knowing that the compiler told us that this code would run just fine when we dropped it onto our web server.
Yes, we appreciate the great benefits that this has for things like Intellisense and for easily discoverable APIs, and even for automated documentation.
And yet, none of these things seem to bother the Ruby (and PHP/Python/Javascript) crowd too much. Why is that?
I would suggest that the static typing benefits a language like C# brings are illusory to a large degree.
The compiler isn't telling us that this code will run correctly at all, it's actually just telling us that the CLR won't throw our code out before the application even starts up - but correctness is so much more important than that. The safety net static typing provides us with is just one part of the equation, and possibly the least important part - we really should be enforcing correctness upon our code.
Correctness is verified by good automated testing, and static typed languages start to come back and bite us here - we trade that compile time security blanket for a much harder experience testing our code. Sure, tools like NUnit, xUnit, Rhino Mocks, Moq, SpecFlow, StorEvil et al ease away our pain, but still our application code is littered with constructs that are pretty much there to support SOLID (or SOLID is required due to the constraints of type safe OO languages), and they become most obvious when we start testing in languages like C# (I am *so* over Interfaces, IoC, Covariance, Contravariance and Generics !
The testing experience in Ruby is a world apart from in C# and .NET, it is just easy and simple ... so simple in fact that it is almost harder to not write automated tests in Ruby - and that's how it should be. In C# testing is often convoluted, complex, fragile and just plain hard work - I can't think of the last time a C# developer described automated testing as fun ... and yet, in Ruby, it just seems like FUN!
And yes, Ruby without automated testing leaves you open to all kinds of runtime errors that C# just wouldn't - so in Ruby, you just make sure you test, and not only test your code will run, but also test it will run *correctly* - there is no safety net, but the trade off is you are ensuring correctness of code, not just compilation of it.
Intellisense, sure it's nice, but as RubyMine and even Visual Studio (under Javascript) demonstrate, you can do some form of Intellisense in dynamic languages, you just can't always be certain what may or may not be available - but this is getting better. And honestly, is discovering which method you are meant to call though typing "." all that great an idea anyway? Shouldn't you as a competent developer know *in advance* what you wanted to call, rather than guessing it as you type?
To The Enterprise
Sure, Ruby doesn't have the track record that C# has, nor does it have the exposure, or market reach, or backing of a company like Microsoft.
But, is that what is really important?
I would bet that a large part of the appeal for statically typed languages in the "Enterprise" is actually a need to deal with a much lower skilled developer base overall. Compile time safety means that your developers don't have to be top notch, the compiler can make up for their weaknesses (and in the case of C# and .NET, Visual Studio 'drag and drop' tooling is trying to make up for a lot of the rest)
Enterprises tend to see dollars and cents, not people and value. So anything that lets them hire cheaper developers to churn out more product must be good.
Again, I would argue this is a false economy. Sure that team of 30 developers may give you a warmer fuzzier feeling inside than a team of 4. And sure, the quantity of code those 30 can type out will probably be much more.
But this misses some real issues around productivity and value - a 'good' developer is 10x as productive as an 'average' developer, and more importantly, the 'average' developer will never be able to create the same quality level as the 'good' developer, even given a near infinite amount of time. No matter how much time a hobbyist painter spends with oil and canvas, he will never create a Leonardo. And as a Jackson Pollock will amply demonstrate, sometimes less is more.
So are you measuring bodies or productivity? Surely it is the end result that matters, not the comfort factor of people looking busy.
And, when you get a good developer, and let them have the freedom of a dynamic language, they can spend less time fighting compile time safety and language constructs that exist almost solely for that type safety, and more time concentrating on business logic and the end product.
In fact, the best argument for why Ruby is not suited to the Enterprise is ... the Enterprise probably already has a large investment in one platform and one core language (or maybe two), and the cost of retraining all those developers, support staff, renegotiating supplier contracts, etc etc is just disproportionately expensive. Lethargy is rife in the Enterprise, and monoliths take a long time to move - sure it's easier for startups to hop on new technologies and run with them, and often it's why they quickly challenge the status quo. This isn't really a technical issue, this is a political and management one.
Maybe Ruby and Rails will gain traction here, maybe not. Things like functional programming are certainly starting to grow roots in financial services, and things like Javascript are prevalent in web apps in the Enterprise so maybe dynamic programming in things like Ruby isn't so far off. It just takes one small faction to show how well they solved a particular problem with a new language or platform to plant that thought.
So Should We All Switch To Ruby Now?
Of course not, and maybe this is what the defensive people in .NET miss. The Ruby people aren't saying "you guys have it all wrong, convert now", they are just saying "hey, I found a really cool way of solving this problem".
Ruby is about choice, it's another tool in your arsenal. As are Javascript, PHP, Python, Erlang, F#, Java, Groovy, C++ and a host of others.
There is no "one right path", so let's all stop pretending there is.
We don't need to be defensive about any one language or platform, unless we are so unsure of our abilities as developers that we cannot learn and adapt - and if that is the case, maybe a new career is a better idea?
As my recent presentation at DDDSydney said ... My Objective Today was to make you think ... "Maybe There Is A Better Way" - because it would just be depressing to think we are already doing things the best possible way.
Posted
07-31-2010 2:55 AM
by
Jak Charlton