views:

995

answers:

10

I've been doing some simple rails Apps lately. I know ruby quite well, but when I started doing things "the rails way" I noticed that some things were done "just because" and It's hard for a (rails) newbie to know what does the code do.

Has rails missed the point and turned into some kind of 4th generation language? I mean, you HAVE to do some things (that you dont need to understand) in order to develop rails websites, and the alternative is to explore the source code to figure out what does what.

I've also seen that people were paying cash to anyone who could do good rails tutorials... We are talking about a framework that puts simplicity in the first place, is it necessary to PAY for good tutorials?

Dont get me wrong, I believe rails has brought very good ideas to the mainstream (like convention over configuration), but has this oversimplification ("just put this line of code and ... it works!") reduced the simplicity the framework was trying to achieve?

Thanks.

+4  A: 

I found Rails very easy to work with. You might want to pick up Agile Web Development with Rails. It was a great help to me in learning the "Rails way." I used it more as a reference than a tutorial, but it walks you through creating an app and explains what is going on. FWIW, I picked up Rails more quickly than ASP.NET (which I'm still learning) and knowing Rails has help immensely in learning ASP.NET MVC.

tvanfosson
++ On Agile Web Development. Its both a tutorial and a reference, with lots of good info. I've been programming in Rails for 7+ months and still refer regularly to that book. The PDF verision is very useful.
Tilendor
+4  A: 

As with anything, I think the Devil is in the details. Yes, it's extremely easy to get a site off the ground and hobble the pieces together to make something that works, but to come up with a well designed and robust system requires deeper design and thought. It's very easy to start making bad OO decisions, like breaking the law of Demeter because things are just so quick to put together. Rails is that easy. Great Rails isn't.

Hates_
+10  A: 

The problem with convention over configuration is that you need to know the convention. At least with a configuration file you have something to read when getting started... Once you know the convention, it goes much faster, but you have the learning cliff to contend with in the meantime.

Tim Howland
Isn't that a bit like saying that the problem with cars is that you have to know how to drive? The Rails' conventions are hardly a cliff - there are only a handful of them.
John Topley
OK, I'll agree that cliff is a bit overstated- but I found I got nowhere until I started to understand the framework in terms of it's conventions. The original question seemed to me to be exactly that- it's hard to drive until you know the rules of the road, and good driving instructors cost $$$.
Tim Howland
+20  A: 

I think it's a matter of perspective. From a broad perspective, the Rails community has held up the framework as something that is that easy. But the truth is, it is not. In fact, the more I work with Rails, the less of a fanboy I become. I don't think this is Rails' fault, but I think a lot of people have gotten the impression that writing a Rails is app is somehow akin to waving a magic wand (and I myself have sipped that kool-aid).

Rails does deliver on many promises though, as it provides a lot of functionality that requires little to no configuration. Things such as ORM, model relationships and validation are trivial to set up, and leave a lot more time for things such fine-tuning application logic and focusing on design. Rails code is also really, really easy to re-factor. Rails absolutely lets you get a lot done with little code.

Where I get frustrated is when I want to walk off the beaten path. I might want to achieve 'very specific functionality X' but I can't find out where to start. I find the deeper I get into the framework, the sparser the information gets. Parts of the API are woefully under-documented. This forces me to rely on third party plugins, some of which have no documentation, and are not well maintained. I am pretty much stuck with a blog post telling to me to copy this code or that code into my app, and things will just work (thankfully, they usually do).

Some of my troubles might be my related to general inexperience (still making the transition from designer to programmer), but I often feel that while Rails provides excellent tools for building websites, it does not, at least on the surface, provide great tools for building other tools. It has the potential, but you really have to dig deep.

Bryan M.
A: 

Agree with Tim Howland

Know your convention first

-Ed-

Ed
If you agree just voting the answer is fine. Your answer is noise
Pablo Fernandez
+2  A: 

I believe "know your conventions" is not the problem. I know that if I do X then I have Y working. But what does X do ?? Rails seems like a black box to me, and ironically when It speaks of "convention over configuration" the whole process of building a Rails app is more like configuration than programming.

I had this strange exception a while ago when following an example of Jruby on Rails (Ola Bini)....

CreateProductCategories is not missing constant ProductType!

This happened because the rails versions were different, but the point is... everything is fine, until you slip the golden path, and the black box doesn't help you anymore, and THEN you realize you have no idea what you were doing the whole time and start begging for help in forums / mailing list (and then you find out that most people don't know what they were doing or why, just that it worked).

Anyway, it's good to know that I'm not crazy and some people have faced this kind of problems. Thanks to everybody.

PS: English is not my natural language so if you find grammatical errors, please edit them.

Pablo Fernandez
+1  A: 

Pablo you might want to look into Django which is being developed by a group that has chosen to focus on providing top quality documentation as a priority.

srboisvert
Where there is a rails discussion, a Django fan is sure to be found.
Matt Briggs
I'm a rails developer Matt. I am just not a zealot about it. One size doesn't fit all.
srboisvert
+8  A: 

Is Rails a Black Box?

Rails does have some 'magic code' where you just write what a tutorial says to write, and stuff magically works, however it's not at all a black box.

  1. By definition a 'black box' is something you can't look inside. Therefore you can't have a 'black box' open source project. Here's the rails 2.1 stable source code, take a look

  2. If reading source code is not your thing, most of these 'magic features' are well documented and explained on many websites and blogs (and if they aren't, you can always ask here and I'm 100% sure you'll get a good response)

  3. Remember that if you're still at the tutorial stage, any tutorial is going to have a lot of 'just put this line of code in', because they are trying to get concepts across, not dig down into the inner workings of everything. Every other framework on the planet, not just rails, has 'magic' in their tutorials

Orion Edwards
Im not doing any tutorials, in fact I'm reading Simply Rails 2 and I've read RESTful Web Services, which has a full chapter about developing a rails app. I mentioned the tutorials because some people are actually PAYING CASH for well writen tutorials
Pablo Fernandez
+1  A: 

I agree with Bryan M.

So much black magick and spooky things going on, thousands of lines of code, meta-meta programming all over the place.

But to be fair Rails tought me so much like spec driven development, REST and good Ruby understanding.

Right now I am on a point where 20% of the time is smooth and the other 80% I spend struggling against Rails conventions. I feel so much more productive when I write pure Ruby.

At some point Merb seemed like an option, next proyect I going with Rack/Sinatra and CouchDB.

+2  A: 

I have some small knowledge about how rails internals works, and I really hope that the work that Katz is doing for rails 3.0 is going to make rails internals much more easy to understand, and specially much more documented. AFAIK, he has been creating some well defined interfaces among the "modules/layers", for example all the ORM share a common interfaces, so you will be able not only to replace the ORM, also to understand easily the interface that communicate rails and the ORM.

Against the mainstream opinion, I think rails is a very difficult framework, much more than pure php. Relay on a framework that you don't understand have some consequence, and learn rails internals is not easy, even for seasoned rubyist.

In the other hand rails ecosystem move extremely fast, and that add another layer of difficulty, In the last month I added at least 3 o 4 gems and the month before I change completely my work flow adding cucumber to my process. but, I guess that is the price that I'm paying for being on the IT industry.

Pedro