This Blog Has Moved!

My blog has moved. Check out my new blog at realfreemarket.org.



Your Ad Here

Sunday, August 17, 2008

Programming Ruby on Rails is like Playing Mao or Mornington Crescent

Ruby on Rails developers are like people playing Mao or Mornington Crescent. Rails is allegedly a super-awesome framework, but nobody can tell me the details of how it works.

According to Google Analytics, my "Ruby on Rails Sucks!" post is surprisingly popular. I'll make another post on the subject.

I've heard a bunch of people say "Resource X for Rails is awesome!" I looked at the Rails resources, and they're all incoherent gibberish. I googled for websites on Rails and my employer bought allegedly the best Rails book ("Agile Web Development with Rails"). None of the resources I read were suitable for an expert programmer looking to get started in Rails. Most of the cool features of Rails are undocumented magic behavior.

There's a stereotype among Rails developers that "People dismiss Rails without giving it a fair chance." My explanation is "Experienced and skilled developers are able to tell that Rails is garbage after a brief inspection." The only reason I spent so much time on Rails is that I was forced to at work.

Java/beans/spring/jsp is horrible. You have to edit at least 5 files to get anything done (dao database access class, data wrapper class, controller class, xml configuration file, plus jsp file). Rails allegedly eliminates this, but the other restrictions are too much.

Restrictive development frameworks are crutches for incompetent people, rather than productivity enhancers. If you have a restrictive framework, that's a way to superficially get productivity out of clueless people, as they generate framework-compliant code. Rails and Java/beans/spring/jsp are overly restrictive development frameworks. A highly skilled developer wants flexibility and not restrictions.

I never imagined a framework worse than Java/beans/spring/jsp, but Rails is astoundingly bad. I can't imagine someone creating a framework that bad if they were actively trying. It's almost like a sick joke, except the Rails developers are serious.

"Let's make a framework that's impossible to learn. We'll hype it until it's super-trendy. Everyone will want to hire us. Nobody else can encroach on our turf, because the language will be incomprehensible to outsiders. We'll have job security forever! HAHAHAHA!!"

Writing out an SQL query and parsing out the result set is not the big hassle that Rails makes you imagine. ActiveRecord seems cool, but it's a huge overhead and places huge restrictions on what you can do. Like the rest of Rails, ActiveRecord is completely undocumented. (There is literal documentation, but it's incomprehensibly equivalent to no documentation.) You can override ActiveRecord with find_by_sql, but then why bother using Rails? If you need to join multiple tables, then ActiveRecord can't handle this cleanly.

My boss is delusional about how the Rails project is going. Really, it was a 1 month project. We've wasted 2 months on Rails, it'll be at least another 3 months, and even then it might not work. It's a small startup, and this type of error is a classic "startup killer" (using the wrong development framework). The main owners are bringing in someone else to shake up the development group, so that should be the end of the Rails fiasco.

This aspect of human/alien behavior has me confused. Does my boss sincerely and genuinely believe that the Rails project is a smashing success, even though there isn't a single line of working code after two months? If he genuinely believes Rails is awesome, that helps him be a more convincing liar. Or, is he aware he screwed up, and keeps backing up his lie instead of abandoning it? I can forgive making an error, but I can't forgive lying to cover it up or being totally out of touch with how things are going. At this point, my boss is guilty of gross dishonesty or gross incompetence, or both.

As another example, Congress and the President are totally out of touch with the way things are going in the USA. They control the USA's resources, but don't technically own them. Therefore, the incentive is for them to cover up problems, instead of confessing their mistakes. The President and Congress sincerely believe they're heroic leaders, because that makes them more convincing liars. Do you expect the President and Congress to come out and explicitly say "The income tax is immoral. The Federal Reserve is immoral. Maybe having a strong central government isn't such a good idea."?

Is this an aspect of the Principal-Agent problem? My boss controls the development team, but he is not an owner of the business. My boss controls resources that he doesn't own, and therefore it doesn't matter if they're squandered. In a large corporation, such gross incompetence can go on for a long time. My boss' bosses have realized things aren't going well. My boss' bosses are the owners with most of their savings invested, so they're motivated to do things honestly.

Would my boss be so eager to advocate for Rails if it was his own money being squandered? If you want to waste your own money on a Rails project, that isn't immoral. If you're wasting other people's money on a Rails project, then it becomes a problem. A corrupt economic and political system encourages such behavior.

The bizarre part is that my boss seemed reasonable before the Rails project. He changed from reasonable to an insane alien in a short period of time. I've been on enough disastrous software projects to know the symptoms. I've been screwed over by smarter and more dishonest people, so the blame won't be deflected to me this time. The other programmers are developing a "Stockholm Syndrome" behavior, sympathizing with management/Rails instead of saying that it's awful.

If I had DHH working for me (the guy who invented Rails), then I'd consider using Rails for a project. DHH developed Rails because it matched exactly what he needed at the time. Unless you're DHH or one of the Rails core developers, using Rails is a mistake. Rails is not user-friendly or accessible to an experienced developer. I can pick up php quickly, because it's well-documented. I can learn C# or ASP.NET quickly, with both Microsoft's documentation and books/websites written by others. For Rails, there's no coherent resource for an experienced developer to learn quickly.

If DHH saw how my boss was using Rails, he'd probably say "What are you ***holes doing? Why are you raping my baby like that?" With experienced management, perhaps a Rails project could succeed. Rails is a very bad idea when nobody on the team has used it before. With php or Visual Studio, I'd expect a typical programmer to pick it up from available documentation. That's not possible with Rails.

Here's another example of my coworkers misusing Rails. Rails supports database migration scripts. Whenever you change the database, you create a new database migration script. You then type "rake db:migrate" and Rails automatically updates the database for you. Rails automatically keeps track of what migration scripts have been applied. One of the other programmers made a database change. Instead of creating a new migration script, which is the correct Rails way, the programmer edited an old migration script. However, I'd already applied this script to my database. Now, I'm completely out of synch with the database. I have to unbuild and rebuild my local database to get the correct version again. In this manner, one of Rails' neat features becomes a nightmare when people misuse it. My coworkers are not experienced Rails developers, but relatively intelligent. Such a big screw-up is an indication of a defect in Rails or its documentation, and not specifically that programmer's fault.

I don't see any efficiency gains from Rails. I can put a website together more quickly in php or Visual Studio than with Rails. If what you want deviates substantially from the auto-generated scaffolding, then the efficiency gains from using Rails are negligible/nonexistent/negative.

I really do like the open source development model, but Rails is not a good example of a successful open source project. Rails is an example of successful hype, and not successful software. My boss has totally bought into the hype. He says "**** Microsoft! We're using Rails! We're not paying to support a corrupt corporate monopoly!" Wasting two months of programmer salaries costs a lot more than Microsoft licenses would cost.

On the scale of evil corporations, Microsoft ranks low. I rank the financial industry as the greatest evil. The profits of Citigroup, JP Morgan Chase, Goldman Sachs, FRE, and FNM are literally backed by the full power of the State. The structure of the financial system guarantees their profits. If Microsoft makes a couple of bad decisions, then they could lose their OS and Office monopoly. With software, there are genuine economies of scale. Even in a free market, I'd expect a small handful of people to write the basic tools that everyone else uses. Even in a free market, Bill Gates could choose to closed-source his software, via trade secret contracts with his employees.

One of my favorite stories is that Bear Stearns was employing a bunch of Rails developers before it went bankrupt. You cannot conclude from one datapoint that only idiots use Rails, but it's an amusing anecdote. I conclude that only idiots use Rails based on my objective analysis of the language and framework. If you strongly disagree, then why are you wasting time reading this?

My analysis of Rails is objective. Before I started using Rails, I was thinking "Rails is a popular development language/framework. It would be a nice resume item to have." I really tried to learn Rails, but after a few days it was obviously hopeless. After seeing Rails crash and burn, for what was a relatively simple project, I can't defend using Rails for anything. They hired an experienced Rails consultant, who couldn't produce a single line of working code in a month. The consultant actually seemed to be of above average intelligence, and the other developers here have above average intelligence, so the defect must be with Rails. "Rails sucks!" is my impartial unbiased objective conclusion. I'm not making this story up to discredit Rails. I'm really involved with a huge Rails cluster****.

There were three critical mistakes on the Rails project.

1. Using Rails was a mistake. Unless you're already a Rails expert, you shouldn't use Rails. Even then, I'd be reluctant to use Rails unless my project exactly matched what Rails provides. For our project, several critical back-end server tasks could not be written in Rails or Ruby.

2. Rewriting the entire database all at once was a mistake. My boss over-normalized the database and picked a stupid design. Polymorphic tables seem cool, but overusing them is a mistake and adds lots of overhead. The database rewrite was forced by the decision to use Rails, because Rails insists that things are done its way. Your primary key must be auto-increment integer. Tables and join fields must be suitably named. These behaviors can be overridden, but it isn't worth the hassle.

Some of the back-end server tasks could not be written in Rails or Ruby. This means that the preexisting Java code must be retrofitted to work with the new database design. This effectively doubled the size of the project.

3. My boss was delusional regarding how much progress was being made. He was focusing on the scaffolding, instead of writing something that runs. It might seem cool to spend 2 months writing scaffolding, but at some point you need a working application. If they tried to get a working application quickly, then they would have noticed the defects in Rails and in their approach.

Instead of admitting his error, my boss is loudly talking about how brilliant he was to decide to use Rails and how spectacularly successful it is. When I point out that the project is a disaster, he says that we merely have a difference of opinion. His opinion is that the project is successful and my opinion is that it's a disaster. All truth is relative, and all opinions should be equally respected. In the area of software development, either your application runs or it doesn't. If I claim your project is a disaster, you should be able to disprove my claim with a working application, or at least a single feature implemented correctly.

In this case, there actually is a working prototype and model. There's the Java/jsp/swing/beans garbage, which at least runs. They had an exact specification of what they were trying to implement. I estimated it to be a one month project. They've wasted two months, with nothing to show for it. It'll be at least another three months, and even then it probably won't work. At some point, my employer needs an application that works to raise more money and show their customers. My employer has a bunch of eager customers but no product, which is a very bizarre problem for a startup to have. In the area of financial software, connections are critical. The owners used mock-ups and powerpoint presentations to generate interest for their product while it was vaporware. Even if I said "Screw this! I'll start my own competing business!", when I called potential customers, they would say "Who are you?"

The Rails project was a disaster. Unless you're already a Rails expert, you're a fool to do a project with Rails. Php is better than Rails. (They needed something done quickly, so I got permission to do it in php. I finished it in a few days, even though I had never used php before.) Visual Studio is definitely better than Rails.

If Rails is such an awesome language, then why can't it attract anyone who writes decent documentation?

The Rails development community has a "evaporative cooling" effect. The best developers, like Zed Shaw, are getting disgusted with Rails and leaving for other things. This leaves behind a bunch of mediocres and incompetents. Why do Rails developers find jobs? Most companies are run by mediocres and incompetents! Hiring a Rails developer is hiring someone who can almost write software, but without any independent thinking skills or free will. A Rails project is very attractive to an incompetent manager, because there's a large pool of completely unqualified people to choose from. Then, blame for the inevitable disaster can be easily deflected to one of the incompetents you hired.

I'm so annoyed with Rails. I'm eager to try the exact opposite. According to the hype, the opposite of Rails is Microsoft Visual Studio, ASP.NET/C#. I've used Visual C++ before, but not the latest .NET version, nor C#. ASP.NET seems like a nice way to combine WYSIWYG web development and custom widgets. At work, I'll suggest Microsoft Visual Studio after Rails is scrapped. Php is also worth considering, although php isn't suitable for the back-end server tasks. With ASP.NET and C#, that would cover both the frontend and back-end server tasks. It's not a hard project. I'm pretty sure I could finish their whole website by myself with Microsoft Visual Studio in a month. (I might even get the chance to prove that claim!) According to Microsoft's tutorial, ASP.NET supports model/controller/view, but not in the braindead crippled way that Rails does it.

My boss will probably write "Managed successful Ruby on Rails project" on his resume and have 10 clueless schmucks lining up to hire him. They deserve what they get.

Rails development is like playing a game of Mao or Mornington Crescent. The insiders insist it's awesome, but they refuse to explain the rules.

5 comments:

propertarian said...
This comment has been removed by the author.
Anonymous said...

WT-the-F?

I don't even use Rails, but you want to use ASP.NET over it? You're a Visual Studio "auto-complete completes me" turd.

By the way, you've completely misinterpreted Zed's Rant on Rails. I guess he needed to make it a PowerPoint presentation for it to get through your skull. Maybe some bullet points will suffice:

* The so called "don't hurt the Rails community" peeps are actually just concerned about making money.
* They don't mind that Rails is becoming the VB of the Web.
* More generally, idiotic web startups are sucking up all the smart people in this world, leaving no one to do disprove String Theory.

Norman said...

I read your post a couple of days and it has been bugging me ever since.

It would be easy to dismiss it since I am a big fan of Ruby on Rails. However you do make some very good points.

I have also got and read Agle Web Development with Rails (2nd and now 3rd Edition in PDF). Everything is in there but I have struggled to make a lot of progress for the time I have invested. I will keep persisting and hopefully have a break through at some point.

Regarding the Rails documentation I have found it is there but it is very hard to "self discover" anything. Once you pick up something from a tutorial or book then you might find the documentation expands on it but it is pretty sparse in areas (at least compared to the Microsoft .NET docs that I am used to).

Anonymous said...

"Ruby on Rails developers are like people playing Mao or Mornington Crescent. Rails is allegedly a super-awesome framework, but nobody can tell me the details of how it works."


If you can't go over the 15 minute tutorial which lays out all the basics and how they work together, the problem is not Rails. It is you!

Just because you refuse to step out of the tiny box that you know and try to understand the larger world doesn't mean there is anything wrong with the outside world.

Stop being proudly ignorant and go get some education.

LittleoftenAnnie said...

hi fsk i was like wondering if u can compare this to c c ++ delphi etc?

This Blog Has Moved!

My blog has moved. Check out my new blog at realfreemarket.org.