Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rail's 'Gotchas' and learning curve - will it ever stop? [closed]

I've been developing a new rails project for a few weeks, and while I am amazed at the awesome plugins and some of the really great features in the frameworks... I am a little disappointed too. And I am worried.

I think I made a mistake.

Should I press on, or go back to what I was familiar with? (Java/Spring)

  1. It seems that unless you are looking for "simple examples", googling for the exceptions to the rule, special cases and so on really hampers productivity and is increasingly becoming the norm for me.

  2. Documentation and examples from the main site, blogs, screencasts, etc. are mostly out of date. For every 5-10 examples that are out there, 1 of them is actually correct.

  3. Doing anything new that should "just work" almost never does. I try and following documentation and examples, but my results seem to vary and I discover problems never mentioned in the documentation and examples. This seems to happen all the time actually.

  4. My experience with trying out CoffeeScript and it's integration with Rails was a disaster. Not being able to see what the problem is whenever a "compiler error" occurs is beyond frustrating.

  5. ActiveRelation is really awesome, until you need to make a query that joins 7 tables. Then it starts to break down. I think it's possible that you can get that 7-table join query done in Hibernate quicker and finished reliably the first time you are learning it.

  6. Testing is actually really hard in Rails. There's just too much "Magic" going on. Since Ruby is dynamic, I have no idea what I need to call to test something appropriately. There always seems to be exceptions to the rule.

    For example, Devise works like you would expect... until you want to test Devise in helpers. It just won't work, so you have to invent the Devise-generated methods in your tests to make the tests pass. You don't need to do this for controllers.

    There are some blogs that teach how to test using Rails, but they are extremely trivial and not very helpful. Some of them are just bad actually. I found how to effective test validations in a far superior manner than many of the blogs I found for example. I just find that I am often on my own when it comes to testing.

  7. Why does images and stylesheets not work properly when you switch to production for? This is insane. Tons of people ask this if you google it... yet the framework doesn't "just work".

    I am scared to death to deploy this application eventually. The production version doesn't seem to work anything like the development version would. Scary.

  8. For some reason, after adding jquery-rails and devise, the authentication token wasn't getting passed during ajax requests. I had to add the 4 lines of javascript code to make it work. This took me 5 hours. In Java, because you have proper sessions, you never even need to think about this type of stuff.

  9. Tests run really slow. I have about 780 tests, and it already takes much longer than a Java project which has 1800 tests.

  10. Testing the application in the browser is really slow. It takes like 1/4 of a second to render some of the pages... and there isn't even that much ORM action going on! Even for pages with 1 database query, it takes 100-200 milliseconds. This is crazy.

  11. Documentation is often out of date. For example, trying to override things in Devise was a pain because the documentation actually told me to do the wrong thing. Only after hours of googling and waiting 48 hours on another forum was I able to have someone tell me what I needed to do. All I wanted to do was have the login form reject a user where User.enabled was false. That's it. It turns out, I was overriding "active?" instead of "active_for_authentication?" - which was an error in the RDoc's.

  12. The ORM behaves in really strange ways that are not intuitive at all. Inserts/updates work differently when you are associating new objects. It also doesn't cascade like Hibernate would... which makes me suspect that it's not tracking dirty objects? If it is... then why isn't cascading set by default? Things like this are hardly good defaults. Isn't Rails supposed to be great at good defaults?

After 2 weeks, the number of "gotchas" hasn't really slowed down. I am really worried and scared. I know Java isn't immune to gotchas and problems, but I generally ran into problems about 2-3 times a month - not 30 in one week.

I am almost thinking the lack of agility when using Java/Spring is not much of a burden now when you consider how stable, fast and predictable the platform is. You maybe write a bit more code, but you know exactly what's going on... you never really deal with silent failures... and things do tend to work a lot more reliably.

I am starting to question using Rails for this new project.

like image 446
Fire Emblem Avatar asked May 21 '11 15:05

Fire Emblem


People also ask

What happened to learning curve?

Defunct. Learning Curve (LC) was the first company to produce and own the Thomas Wooden Railway brand as well as Take Along and Interative Railway toys. It was purchased by RC2 in 2003 for $116.7 million and became a subsidiary of it. RC2 was sold to TOMY in 2011.

What are the limitations of the learning curve?

Disadvantages of the learning curve modelCannot accurately predict future curve – The learning curve recognizes current skills but cannot predict the future with complete accuracy. Misleading data – The learning curve is influenced by variables such as time, previous experience, quality of training, etc.


1 Answers

Best thing you can do is get hold of the 'Agile Web Development with Rails', when I started out a few years back, reading and working over the examples in this book really helped me understand how things should work, it also acts as a great reference that you can dive into whenever you want to read up on certain topics.

The latest version seems to be: http://www.amazon.co.uk/Agile-Development-Rails-Pragmatic-Programmers/dp/1934356549/ref=sr_1_1?ie=UTF8&qid=1305991885&sr=8-1

like image 145
Scott Avatar answered Sep 19 '22 18:09

Scott