Friday, July 17, 2009

Losing Faith

Lately, I've been going through a lot of frustrations with Ruby (by ruby I don't meant just the language but the whole ecosystem and infrastructure based on Ruby). I am in a finishing phase on several projects. It's a time when the finer details get addressed. When there's no more time to do it later, differently or drop it all together. It's when everything that is supposed to work should actually work. The problem with Ruby is that it's been in this kind of finishing phase pretty much ever since I started using it (2004). If you look at it from far enough it seems like there is everything in it but when you come closer and actually try using it you'll find out that a lot of it is in less then pre-alpha stage (of course labeled as production). No language is an island unto itself. No matter how great the language you probably don't want to create all the basic libraries from scratch.

When I made a switch in 2004 Ruby was fairly new, Rails was fairly new so I expected this kind of problem, but you could feel the change in the air. Pretty much all the industry heavy weights were talking about it - Rails conf had a better key note line up than any other conference around, number of books was written and the whole Ruby ecosystem was created over almost overnight. Sad truth is that many of the heavy weights are still talking about it today but they're yet to do their first project in Ruby / Rails. Despite the explosion like surge in popularity little has changed in terms of actually usable Ruby libraries (actually I have the same feeling about 1.9 as well). This is a stark contrast to some of the uncelebrated languages out there. For example I find myself writing increasingly more and more code in Python. I don't think Python is the next Ruby, but I was quite surprised how easily it addressed things I struggled with for 5 years in Ruby.

An example could be excel libraries. I still use the same excel libraries I did 5 years ago (for export I switched recently to xlwt, for import because of the changes in roo I've been using JXL for years now switching to xlrd). The export is great only it doesn't support much formatting and breaks on spreadsheets over 10MB (actually somewhere over 6MB) and the files sometimes don't work on later versions of MS Office. There's been a rewrite that is able to go over 10MB but still without formatting I would need and with a license that doesn't allow commercial use. Python's xlwt - despite a very crude and unpolished appearance is able to produce a complete excel spreadsheet with all the formatting (numbers, dates) (including page setup) and all that in much shorter time and with less resources (Ruby 1.8 4m 28s, Ruby 1.9 2m 36s and Python 33s). I have quite a few more examples but I really don't mean this as a Ruby - Python comparison. This experience, however, got me thinking if Ruby is right for the job I've been trying to do (ie uncool enterprise systems). There are pretty much 2 things for me in Ruby (okay - 2.5 the 0.5 being RubyMine - I'll write about it in some other post). One of them is expressiveness of the language and the other is Rails. Ruby as a medium is incredibly expressive, reads almost like English and allows to do pretty much anything (iterating/mapping an array in 1 line, etc). The down side - as Robert C. Martin put it - is that it's really easy to make a mess. After several months of going through somebody's else code I couldn't agree more. A nice entanglement of block and yields and procs can challenge most of the PHP spagetti code any day. While this expressiveness is incredibly powerful, many times I opt for more verbose solution - Java programmer's code on Monday morning as Gregg Pollack would say - that I will be able to understand 2 years down the road - or that my junior developer will understand.

The other thing in Ruby for me is Rails. The only thing with Rails is that after the years it's becoming a bit too entangled, while it made a lot of sense initially to bundle everything together (ORM, routing, templating, etc.) initially now it starting to be a reason why Rails slowly falls behind in certain areas (either that or Rails team has simply decided to focus on Web 2.0 start up market and let others handle enterprise problems). As surprising as it may seems the world around has not been snoozing after Rails was created and many people took the best ideas (just like Rails did from J2EE world) replaced what didn't work and the whole industry moved forward. While few years back Ruby and Rails were pretty much necessities now there's a lot of alternatives and in many different language. To channel out my current frustrations I started experimenting with quite a number of frameworks and platforms. After so many years I really know what I want and how it fits with my existing projects and infrastructure. Very briefly -
  • I am looking for a modular framework where I can choose different ORM, different templating engine and so on where each component is developed independently by people who understand that specific area. As each of my project is very different sometimes I need the flexibility to change components. It was a great thing back in my Java times (Spring + Hibernate + Webwork). 
  • I really need an enterprise friendly dynamic language. Life's just too short to be wasting time trying to force a language to do things it's inventors don't consider important. 
  • I need a basic ecosystem of libraries (from XML, JSON, through excel, PDF, OO to image manipulation). 
  • I need a framework that supports TDD out of the box. 
  • I need a platform with (at least some) formal education and certification available. I need it because I employ people and certification really helped me back in Java times. To pass even the first Java certificate required people to study and to really understand the language and they simply took it as an independent measure of their skills. 
  • I need a language with a proper IDE. I use Vim every day - BUT not for programming. I've been using RubyMine for more than a month now and I feel like a blind man that got his eye sight back.
  • I need reasonable deployment option - both scalable and resource efficient. 
  • Increasingly more important - I don't want the language/platform community to offend others
It's almost uncanny how many items point back to Java :-). Actually, it's kind of sad that things I took for granted 5 years ago in Java are still not available in the most celebrated and most wildly endorsed language of today. If you look at it - nothing really substantial changed in the way we do the backend (MC) part of the systems. A lot has changed on the View side, but the models and controllers use the same principles as years back. I've used Python/Pylons quite a lot lately and it scores quite high on a number of areas (only so-so on the IDE, though). It seems much more mature compared to Ruby with more matured libraries supporting the enterprisey stuff (so ostracized in Rails community). On the other hand it's marketing is nowhere near Ruby's - you don't really hear people talking about wishing to work in Python. I am a bit worried about the performance - but that's something I just have to try on a real project. A big issue still remains the education and certification. I went through this with Ruby already - no matter how easy and great and superior the language you still need to spend some time learning and then even more time working in it before you really understand it. While there's quite a number of books on Python not much of training courses (at least not in Singapore) and there doesn't seem to be any certification around.

8 comments:

  1. While Java may not answer all your questions (for ex. modularity is still a problem), it does provide solutions to most points you have raised; specially with the newly evolving languages like Groovy and Scala for the JVM, continuosly maturing IDE support and most importantly a large community supporting the platform.

    ReplyDelete
  2. Hi Peter,

    Well-written posts regarding Ruby and its status in the enterprisey side of the Ruby community.

    One question: I assume you tried JRuby, with its potential to tie Ruby with Java libraries. How was your experience with that?

    Thanks and looking forward to your future posts.

    George

    ReplyDelete
  3. Ruby is still a wonderful language to me. It may not be the best for the enterprise, but I have faith that it will be. I took a look at scala today, and the syntax isn't for me. But if you like Java, and you like running in the JRE, maybe you will want to have a look at scala yourself. Then again, it sounds like your done with the raw, write everything you need yourself, young frameworks :) Good luck in your journey back to java. Shiver.

    ReplyDelete
  4. Hello Peter,
    A very thoughtful post indeed. Please take a look at Groovy/Grails. These are shameless replicas of Ruby/Rails in 'Enterprise Java' world. Not bad. I am looking into it.
    Bharat

    ReplyDelete
  5. Hi Peter,

    My first question is why you haven't written an improved Excel library for Ruby or why you haven't contributed to some of your own enterprise needs?

    Ruby's ecosystem is a JIT community, we develop solutions to our own problems. The reason why we have some great libraries (Rails, for instance), and terrible ones (Excel) is because there's no sufficient need or nobody willing to spend time on solving their own problems.

    Insofar as certification, and most of the enterprisiness that you desire, our community embraces a more creative, discriminating approach to our community and its tools, and often eschew the "tried and true" to experiment with what they believe to be the right way. This experimental nature has produced some great code and ideas as well as practices.

    Certification is, in part, a relic from the same mindset that requires a college degree, even if that degree doesn't ensure a developer has actually learned anything. It's meaningless to require arbitrary academic certifications when experience is a much better indicator of skill. It's nice to know that someone can program, but some simple interview questions and a little pre-hire quiz can reveal plenty. Steve Yegge has some great examples of how to hire effectively.

    I agree that Ruby lacks a proper IDE that many Java developers are accustomed to, but I honestly don't miss using an IDE. It's much like comparing Windows, which tries to do everything, and Unix, which is essentially a bundle of very small, specific tools. Our development environments tend to be much more unix-like. Debugging, however, is certainly where this environment proves difficult and cumbersome.

    Perhaps Ruby isn't right for you; you seem to be pretty enterprise-minded and the ecosystem is much more aligned with an agile and iterative approach to design, development, and building our businesses. In most cases, enterprise systems are just overkill for almost any web application.

    This leaves you with two options: contribute enough back to Ruby to meet your own enterprise needs, or move on. The reason why Ruby and its community rocks is that population that regularly contributes both to the knowledge and to the toolkits.

    Are you a good citizen or a leech?

    This question really goes to anybody, especially myself, nothing personal. :)

    ReplyDelete
  6. Hi Matt,
    thank you very much for your comments and reiterating my point in a more direct and to-the-point manner. You raise 3 important points - let me try to express my thoughts:

    1) Why I haven't written the excel library myself / contribution back to community. Probably for the same reason I haven't written my own Rails (or Excel spreadsheet for that matter). Mostly, because I don't have mental or financial capacity to do that. Because I was able to address the problem in a much more pragmatic way (use Python or Java) and mostly because I believe I've contributed to the community in much better ways than nonfunctioning excel library. In my case this was through RoR trainigs - from prison, through programming competition for the past 3 years to a number of companies. Community needs different types of people and different types of skills.

    2) certification - it's hard for me to argue the value of education and proper training. While I totally agree with experimental nature of our profession I may have a strongly different opinion on where that professionalism comes from. Even musicians and other inherently creative professions believe in the value of training -why is it that we, programmers, believe we were born already knowing everything we need to know? Just go through a couple of my previous posts. Not because I think I can convince you - just to simply agree to disagree. The world needs both artists and professionals. On the hiring note - it is not only a matter of selection, but also matter of further development and growth of your human resources.

    3) Is Ruby the right language for my needs - the point of my post was exactly that - I don't really mind whether Ruby is the best language of them all or not - my question is much more selfish (or pragmatic if you will) - my business is based on enterprise and enterprise systems (whether overkill or not) - and I am trying to find out if there's anything better suited to my needs. I am really not trying to offend Ruby or Ruby community.

    Peter

    ReplyDelete
  7. Ahoj Peto,

    I haven't done any Ruby on Rails programming myself (so I am hardly in the position to judge anything) - I am a long time Java guy, feeling after years that Java is just too much of a hassle.

    We (my partner Roman and I) started working on our next online startup (quite of a few of our previous attempts never became real) and Roman has chosen Python/Django as a language and platform. Since my role is not the development one (I am responsible for business and marketing part), I can't really say too much but Roman has been quite happy with the choice. He has spent some time comparing Ruby on Rails with Python/Django (never working with any of them before) and than chosen Python. From what he told me, Python is the language the gives you speed. Things are simple, you don't need to mess up with everything, wiring stuff together is easy and straightforward, many situations that developers face during work are already solved, so on, so forth.

    But I agree that RoR has much better PR buzz than python.

    If you are interested I can connect you to Roman to share some thoughts.

    Michal, Webovia

    ReplyDelete
  8. I am impressed with how you have thought this through. If more people would actually reason through their decisions like you, it would be far easier to direct them toward languages / solutions that might be best for them.

    It's hard to not be selfish when programming is what makes you money. Although I do think it's important to realize that you didn't really switch to python for the language, but for the libraries. So really, it's the developers of those libraries that you prefer.

    Someone writes the libraries we use. That's very important to remember.

    ReplyDelete