Live data from Hacker News

Rails has Two Default Stacks

words.steveklabnik.com

61–70 of 93 posts

Re: Rails has Two Default Stacks

#61
post #33

Earlier quoted context omitted.

>beginners get waaay more excited and engaged by Getting Something Up There Yes! That's why... require sinatra get '/hi' do "Hello World!" end ...is so amazing for newcomers. Even the file structure of rails is a bit too much for begineers. Everything in one file is so much simpler for trivial beginner "get excited" apps. Introducing someone to rails, they have to learn MVC, a templating system, an ORM, and more.

It's amazing for newcomers who like elegant code that can't be shipped. I'm that way. Or, rather, I was, and I look back on that time fondly. Other people who get into web development aren't impressed by such things, and would rather see something like rails or WordPress which is shippable right away and then can be built on top of. Some programmers, especially the kind to hang around on HN, would rather not work wit…

> Some programmers, especially the kind to hang around on HN, would rather not work with people who don't understand the entire system they use.

There's a reason for this. I've worked with people that don't understand how things work and don't really want to learn. These people cause enormous amounts of damage in any system that contains architecture beyond php in the webroot and algorithms beyond brute force.

You let one of those people on a large production database, it's game over. They will run queries that miss all the indexes. They will remove constraints because they don't understand why they exist. They will use flat files in place of a database because the database is scary and then not understand why stuff goes missing in the multi-server production environment.

These people are a liability in a project beyond small scale. They are the same people whose wordpress blogs are repeatedly hacked.

Re: Rails has Two Default Stacks

#62
post #59

Earlier quoted context omitted.

I don't like the dsl. While admittedly it is entirely a question of preference, I find it more natural to write some ruby code and then assert(something). As an example, from Hartl's tutorial we have a test dealing with microposts: subject { @micropost } it { should respond_to(:content) } I prefer writing: assert @micropost.respond_to?(:content) I haven't looked at rspec in a while and in the rspec example I don't re…

That rspec example looks like some sort of misguided language skeuomorphism. "If I name this method 'it' and this one 'should' and this one 'subject', I get something that sort of looks like English if you read it out loud while skipping the symbols! Isn't that neat?" Well, no, it's a horrible idea, because in English those words would imply a certain syntax tree, while the actual syntax tree in your DSL is completel…

Thank you for explaining my immediate visceral discomfort on being introduced to rspec and cucumber more eloquently than I could.

Re: Rails has Two Default Stacks

#63
post #60

Earlier quoted context omitted.

I disagree that using Rails Tutorial as a beginner resource is the way to go. In fact, I used that as my first resource for learning Rails! Here are some problems I found with it: 1. It teaches you Git along with Rails. Who cares about source control at this point? Remember: This is for a newcomer to Rails that just wants to learn how to create websites using rails; don't confuse me even more. 2. It teaches you how t…

Interesting. I might be persuaded to recommend something else. What alternatives do you think are better?

I haven't found a good starting point. The two main contenders I've read in non sequential order:

1. Micheal Heartl's Rails Tutorial. 2. Pragmatic Programmers Bookshelf - Agile Rails 3.2 (4th Edition)

Both are a good start but delve far too much into unit testing with the horrific RSpec. When you're learning something new, you don't want to muddle with learning a DSL on top of things.

Re: Rails has Two Default Stacks

#64
post #28

Earlier quoted context omitted.

Out of curiosity, what do you dislike about rspec? While I have more than a few complaints about Rails, rspec certainly has never been one of them.

I don't like the dsl. While admittedly it is entirely a question of preference, I find it more natural to write some ruby code and then assert(something). As an example, from Hartl's tutorial we have a test dealing with microposts: subject { @micropost } it { should respond_to(:content) } I prefer writing: assert @micropost.respond_to?(:content) I haven't looked at rspec in a while and in the rspec example I don't re…

Fair. I can definitely appreciate the DSL argument. Rails has a rickety enough learning curve as it is, and introducing rspec at the outset is certainly debatable.

For what it's worth, I would definitely not consider the rspec syntax in that Hartl snippet to be a particularly legible example. The code provided in another comment is a much better representation of good style, IMHO.

Re: Rails has Two Default Stacks

#65

I seriously wonder why people still use haml over slim. Slim imho is the best templating language around. It should replace haml in this so called 'prime' stack.

Actually, having used HAML for a while, I got really annoyed with it and switched back to HTML. I like the prime stack + plain old ERB.

Re: Rails has Two Default Stacks

#66
post #3

Using Steve's definitions from the article, the tutorial I usually point people to is Michael Hartl's Rails Tutorial http://ruby.railstutorial.org/ which uses the "Prime" stack. I believe I read somewhere that Michael was going to come out with a "37 signals" stack version as well. One message I'd like people to understand when they're starting out with Rails is that it really is confusing, and that being confused an…

I disagree that using Rails Tutorial as a beginner resource is the way to go. In fact, I used that as my first resource for learning Rails! Here are some problems I found with it: 1. It teaches you Git along with Rails. Who cares about source control at this point? Remember: This is for a newcomer to Rails that just wants to learn how to create websites using rails; don't confuse me even more. 2. It teaches you how t…

1 to 3 are useful because you'll be doing them so frequently you can't ignore them.

Getting code to a working public server was a point of revelation for me as a new rails developer. It was hard, but rewarding.

4 can be safely skipped until you're ready for it.

Re: Rails has Two Default Stacks

#67
post #11
post #10

Earlier quoted context omitted.

I agree with you, which is the reason why I think PHP is still way more popular than Rails. Cut-and-pasting scripts from Google searches is a terrible way to make code, but it works and it's a lot easier. I agree with DHH that Rails shouldn't be dumbed down (see his Railsconf 2012 talk https://37signals.com/svn/posts/3171-keynote-by-david-from-r... ). Cooking with Rails is like cooking with a real oven, not an easy b…

I think the fact that the starting point for php is an html page is a big deal. Whether or not its a good thing to replicate that (and things like that) is debatable but its not just about cutting and pasting from Google.

Of course, and that starting point encapsulates much that is good (easy to extend HTML by mixing in some code, quick to get started, zero deployment hassles) and bad (easy to mix content and code, easy to start without thinking about the bigger picture or planning your app, easy to make mistakes like exposing your db password to the world because of a permissions issue say) about PHP.

Re: Rails has Two Default Stacks

#68
post #10

Earlier quoted context omitted.

One message I'd like people to understand when they're starting out with Rails is that it really is confusing, and that being confused and maybe even feeling stupid is normal! But if you care about Rails uptake, aren't those bad things ? People don't like being confused. People don't like feeling stupid. If their initial impression of a system is "this is confusing" or "this makes me feel stupid," many if not most wi…

I agree with you, which is the reason why I think PHP is still way more popular than Rails. Cut-and-pasting scripts from Google searches is a terrible way to make code, but it works and it's a lot easier. I agree with DHH that Rails shouldn't be dumbed down (see his Railsconf 2012 talk https://37signals.com/svn/posts/3171-keynote-by-david-from-r... ). Cooking with Rails is like cooking with a real oven, not an easy b…

> which is the reason why I think PHP is still way more popular than Rails.

language being more popular than a framework! sure :)

bring one framework that is more popular then rails?

google trends proof: http://www.google.nl/trends/explore#q=ruby%20rails,%20symfon... (many people make searches w/o the 'ruby' search term, so rails wins by a larger margin)

some proof here that php is a lot more popular then ruby:

http://www.google.nl/trends/explore#q=ruby%20tutorial,%20rub...

and java more popular then php... and WOW FLASH!

http://www.google.nl/trends/explore#q=php%20tutorial,%20php%...

we a should all use flash, it is the most popular, more so the java!

gosh.. im trying to prove you're comparing apples with bananas and now i find out i should be coding in Adobe Flash (tm).

anyway.. i believe php is only marginally more popular then rails, for stuff that involves "web app development". that's what rails made is for. php is used a lot for ftp-ing scripts to cheap webhosting, something is done a lot less with rails.

Re: Rails has Two Default Stacks

#69
post #44
post #3

Using Steve's definitions from the article, the tutorial I usually point people to is Michael Hartl's Rails Tutorial http://ruby.railstutorial.org/ which uses the "Prime" stack. I believe I read somewhere that Michael was going to come out with a "37 signals" stack version as well. One message I'd like people to understand when they're starting out with Rails is that it really is confusing, and that being confused an…

We've taught hundreds of beginners new to Rails, and we've found that beginners want to learn about all the alternatives - it's like they have to survey the entire landscape before starting. No matter if we're teaching TestUnit or Rspec, someone will ask about the alternative. It's so easy to get side-tracked into evaluating alternatives and just get overwhelmed with the options. What we've found works is this: 1. Be…

> 1. Beginners need a curated stack by someone they trust. "Here, this is the stack to learn from; stop wasting time evaluating and get started."

That's supposed to be what Rails itself IS, right? Isn't that the point of it being "opinionated", it's supposed to BE the curated stack from someone you trust.

If it's failing, that's a problem.

It certainly is frustrating when you're trying to get the actual Rails stack to work and can't figure out why it seems so hard and someone tells you "Oh yeah, despite the Rails documentation telling you to do it that way, nobody actually does it that way."

Re: Rails has Two Default Stacks

#70
post #6

This is one of the strongest arguments I've seen for simply starting with the "default" stack. Move to other stuff when you feel the pain. If you're teaching or just starting off with Rails, don't use the "Prime" stack stuff until you really need it.

One of the things that got me thinking about this was the recent security issues. I was helping people on Skype upgrade their apps, because they were new, and they got into Gem Version Hell. Only pulling in fancy gems when you need it helps when you _really_ need to upgrade, and you're not stuck figuring out why twitter-bootstrap-rails, therubyracer, and libv8 (in this example, obviously, it could be any combination…

That says to me that understanding bundler is REALLY important.

If someone understood how bundler worked, there is NO reason therubyracer, twitter-bootstrap-rails, libv8, or any other gem should get in the way of upgrading (say for example) from Rails 3.2.5 to 3.2.11. `bundle update rails`, then check in your new Gemfile.lock

That should change nothing but Rails and rails' own upstream dependencies (not any of the ones you mention). And indeed it did that for me on a bunch of apps. If you're going up a minor or major Rails version, then your other gems (like say twitter-bootstrap-rails, hypothetically) might not be compatible with the new rails version, and you might have some dependency hell.

But to apply a security release, when you are on a maintained minor release (3.0, 3.1 or 3.2)? If you understand how bundler works, you are HIGHLY unlikely to have any troubles.

Post reply on HN