Ruby on the Enterprise
- Published February 8th, 2007 in Ruby
I started coding in Ruby one year and a half ago. I did so to learn the utterly amazing Rails framework and I got immediately hooked up to a powerful 100% object oriented language. Ever since, I did a couple of projects over Ruby on Rails and Ruby proved to be a quite adequate choice for the job. It’s especially suited for very agile projects and developing fast prototypes.
More recently I’ve enrolled in a quite large project. This was my chance to check whether Ruby was Enterprise-ready or not. The project, a management simulation game called IMAGE (I’ll provide some more info about this later on), is expected to have a million lines of code, divided between classes, interfaces and methods… a lot of methods.
To what concerns to Rails, it has proved to be an excellent choice. Thanks to ActiveRecord we were dismissed from writing endless repetitive SQL queries for more than fifty tables. Hibernate could be an option but it’s way too heavy.
Regarding Ruby, it’s a very nice language for very fast development. We’ve noticed that we can easily read and understand code from the other team members (and so we can promote collective code ownership). Also, it requires less to none comments for the code to be understandable. For those familiar with Python, you know what I’m talking about :-)
Nonetheless, a project of this dimension requires good and stable development tools to assist digging into tons of classes and methods. Unfortunately, Ruby does not have those (at least as far as I know).
Textmate is a quite powerful text editor but lacks IDE features. It does include code snippets but not true auto-complete. Pressing Esc to find similar names is as far as it goes. And it’s only available on Mac OS X and we have a very heterogeneous environment with Linux and Windows.
Radrails, an IDE ironically based on Eclipse (that, as we know, is made in Java/SWT), is also a good option but it does not play up to its parent, Eclipse. It also lacks auto-complete and refactoring tools.
So, considering the IDEs/text editors available to code in Ruby here’s what’s lacking for them to become true coding assistants:
- True, glorifying code auto-complete
- Refactoring tools
- Debugging utilities
- GUI builders (not relevant to web development though IMHO)
Sure though that when speaking about Enterprise there’s a lot of ground to cover. There’s several topics like reliability, scalability, security and lot of other ilities. I’ll try peaking at them in the due time. In the meantime, I can point you to a very succinct but interesting post that puts PHP, Java and Rails (Ruby) side by side.

Comparison is interesting despite the fact of disagreeing in a few points. I don’t think PHP’s scalability is stronger than Java. But I do agree that development speed is way faster with Ruby and that Java has the best development tools available. I also recon through experience that Ruby has a very high level of maintainability due to its clear and perceptible syntax.




Mário,
The graphic you’re showing, where does it come from? On what facts was it built on?
Pedro,
I was trying to put the reference right here but Wordpress is removing the < / a > tag and screwing this up. I’ll show it to you in a minute.
Have you tried RoRED IDE (http://www.plasmacode.com/) for Rails Development in Windows?
I’ve tried several editors and stuck with this one! Quite good, but still not final… Has project-code-completion (not ruby yet, but will have).
Try it!
“Also, it requires less to none comments for the code to be understandable. For those familiar with Python, you know what I’m talking about :-)”
Nope. Please enlighten us. :)
Python code should be as readable as Ruby* code. If it isn’t, the problem is the programmer, not the language. If you need to comment code to make it understandable, the code is bad, rewrite it.
Now, I’ve seen plenty of examples of people trying to be clever in Python, I’ll give you that. The language is flexible enough to allow for all sorts of weird idioms that nobody else understands. And the world is full of micro-optimizer types that think “cleverising” code to gain a couple of miliseconds is a good idea. Eh, if they wanted highly optimized code, they should never gotten into Python in the first place…
And the fun part is very well know Python books actually encourage the use of clever tricks. For instance, “Dive into Python” has a whole section dedicated to the “and or” trick, which is ugly, has a bunch of problems and isn’t actually _needed_ in the real world…
Carlos, I said precisely the same. I just stated “For those familiar with Python” because most of the Python code I’ve looked through contained as few comments (because they are not needed) as within Ruby code. I was not saying that Python was the contrary!
Ok… OK then :)
“I don’t think PHP’s scalability is stronger than Java.”
Believe me, it is. As a language, I strongly prefer Java, and tried to the limit using it as the foundation for the sites I develop. However, one must concede that PHP sweeps Java into a corner. At least on Linux, Java has two serious flaws:
1) The JVM is just not performant enough. It does not compare to the speed it shows on Solaris.
2) It has piss poor memory management. Up to the ridiculous point of never releasing memory to the OS. This means that a particular VM is constantly using the peak value of memory. Combine with the excellent Linux disk cache (whose performance the JVM hampers) and Java is tossing away a performance boost that PHP gladly uses to race away. On setups where the VM coexists with a database, the memory hogging behavior worsens the scenario even more.
Hi there Mario.
I’m a TextMate fan too but sometimes need a similar (read: as good as) product for Linux because some times my girlfried steals my mac (shh designers…) and the time it takes me to (re-)learn how to make good use of Gedit is not acceptable.
However i’ve recently started using Komodo Edit (for mac and linux) and it seems to be a preety good tool. Have you tried it yet?
“The JVM is just not performant enough. It does not compare to the speed it shows on Solaris.”
I find this a bit hard to believe… Are you sure you are using the server VM on Linux? I’m not sure, but I think it’s the default on Solaris, but everywhere else it’s only picked up by default if the box has more than 2Gb of RAM _and_ two or more CPUs.
RE someone’s comment above: “If you need to comment code to make it understandable, the code is bad, rewrite it.”
You see a lot of this bandied around and it is wrong. I’ll tell you why.
I am a PeopleSoft developer, yes real enterprise stuff but I’m not putting it over anyone, PeopleTool/Code has a lot of catching up to do with most languages, I mostly hate it. I’ll get to that.
The thing is with Enterprise code there is a lot of business logic, well it’s all business logic really, 100%. When the programmer writes the logic as code they can make a mistake, there is a LOT of complex, interacting, dynamic, sometimes poorly analysed (correct spelling in the queen’s English) business logic.
Sure we can understand the code the programmer has written but what was the logic SUPPOSED to be, in plain English/German whatever? What were you trying to do when you stuffed up (which is why I am now fixing your code), and for god sakes don’t make it so I have to spend 30 minutes digesting this massive SQL statement, complete with views that have their own massive SQL statements, just tell it to me in a simple comment man! Be reasonable, your poorly thought out, illogical, inconcise code is hard to follow especially when you use hundreds of unneccessary variables that all look the same: $AP_EP_RO & &AP_IP_RO & &AP_IP_RA.
So there you have my reasons for absolutely hating code with no comments. It is quicker to modify, debug and extend (usually poorly written, it’s the real world) code if it contains comments. They aren’t too hard to write are they?
So yeah PeopleCode/Tools (www.oracle.com) Put it this way, they have just introduced colour syntax highlighting. Need I say more? … But the framework, oh the framework, where you will use 50 lines of code in Rails, PCode will use 0, and have industrial strength security, cross-browser support, scalability, web services, WYSIWYG design tool… the list goes on.
But yeah, please comment your code so we know what you were trying to do/doing without having to lookup general designs, make phone calls to functional experts or digest hundreds of lines of rubbish/code.
MJ,
Commenting out code is always a good policy. I think that what Carlos said applies only to small applications.
Huge blocks of code which otherwise can not be splited up definitely need a comment introduction. Actually, it makes no sense at all not including comments: there’s no penalty on the application whatsoever since they’re ignored by the compiler (although they may influence an interpreter because it will have to ignore the lines in runtime).
Pray for the comments! :-)