Live data from Hacker News

New to Ruby? Tips for the new Rubyist.

jasimabasheer.com

21–30 of 65 posts

Re: New to Ruby? Tips for the new Rubyist.

#21
OT and hijacking this thread:

1. Who is actually new to Ruby?

(After Ruby or rather the popular RoR is there almost for a decade everyone should have made some experiences with Ruby, so I am wondering if there are many new Rubiest)

2. What new language/stack did you start to learn recently?

(for me: Node.js)

Re: New to Ruby? Tips for the new Rubyist.

#22
post #4

I would like to get some advice from experienced Ruby hackers. Currently I am picking up Ruby through rails, which I am assuming is fairly common. I want to know the downsides to this and what people did to supplement their ruby knowledge beyond Rails. I eventually would like to write my own gems, contribute to open source, and so forth. I am absolutely not satisfied with just consuming Rails.

Probably the biggest downside is that you'll incorrectly assume that some parts of Rails are actually part of Ruby. Then you'll miss them when they're not there and possibly feel a small amount of sadness. Oh the humanity! :)

The big one is ActiveSupport. There are many extensions to common Ruby objects like String, Enumerable, Hash, etc. For example. In Rails, you'll use something like this quite frequently:

    some_string_var.parameterize
The parameterize method is part of ActiveSupport::Inflector. As you start to write Ruby outside of Rails, you'll come across occasions where you'd really like to use ActiveSupport methods like these, but fortunately, RubyGems and Bundler make that easy.

EDIT: My last paragraph isn't clear enough that you can use ActiveSupport outside of Rails by simply adding the gem to your Gemfile and requiring it in the relevant location. The downside is that you create a dependency. If you are writing ad hoc scripts, this can be an annoyance, but if you package all your scripts as a Gem using something like Thor, dependencies won't be a problem.

Re: New to Ruby? Tips for the new Rubyist.

#23
post #21

OT and hijacking this thread: 1. Who is actually new to Ruby? (After Ruby or rather the popular RoR is there almost for a decade everyone should have made some experiences with Ruby, so I am wondering if there are many new Rubiest) 2. What new language/stack did you start to learn recently? (for me: Node.js)

As a Python guy I never had any reason to need to learn Ruby. And even now that I'm playing around with it it's purely out of professional curiosity.

Re: New to Ruby? Tips for the new Rubyist.

#24
post #4

I would like to get some advice from experienced Ruby hackers. Currently I am picking up Ruby through rails, which I am assuming is fairly common. I want to know the downsides to this and what people did to supplement their ruby knowledge beyond Rails. I eventually would like to write my own gems, contribute to open source, and so forth. I am absolutely not satisfied with just consuming Rails.

Probably the biggest downside is that you'll incorrectly assume that some parts of Rails are actually part of Ruby. Then you'll miss them when they're not there and possibly feel a small amount of sadness. Oh the humanity! :) The big one is ActiveSupport. There are many extensions to common Ruby objects like String, Enumerable, Hash, etc. For example. In Rails, you'll use something like this quite frequently: some_st…

Any gem can use ActiveSupport as a dependency, just like Rails does

Re: New to Ruby? Tips for the new Rubyist.

#25

I'm in the middle of picking up Ruby primarily because there was a GitHub project I wanted to fork and modify for my purposes that happened to be written in Ruby.The biggest problem I found is that the Ruby (or maybe the Rails?) community by and large provides shit instructions on how to get something running. I checked out a handful of projects and they all said things like, "Just deploy the normal what you deploy a…

I think the genesis if this problem is due mostly to the fact that programmers from a PHP background are used to not thinking about their server stack. That is changing though.

In languages like PHP, it's possible (again, this is becoming less common) to run an ad-hoc PHP application by simply requesting the URL to the file. For example:

* Drop myapp.php in to your httpd doc root

* Request http://myserver.tld/myapp.php

* Great success!

Rails doesn't work this way at all, and I don't know of an equivalent in the Ruby ecosystem. There is ERB, but no one runs a bare server that just maps myapp.rb to a URL; e.g., http://myserver.tld/myapp.rb. There's always some sort of router in between. Sinatra is probably the most basic Ruby app framework in common use and it still has a router. There are good reasons for this. In Ruby, everything is an object, so if you're writing good Ruby code, you need a way to map URLs to your objects.

Rails is somewhere between Java and mod_php in terms of application infrastructure complexity. The most important distinction is that you have an app server that is separate from your web server, and you have to do, at least, some basic configuration (even with Passenger). Many PHP devs never put any thought in to their server stack. PHP is part of their base Apache install on whatever shared host they're using, and everything "just works".

I'm trying really hard not to paint PHP devs in a bad light. All of this arrises from the circumstances you "grow up" in. There are plenty of PHP stacks that distinguish app worker processes from the web server, so please understand I'm not claiming some kind of superiority. To the contrary, the Ruby community recognizes the complexity penalty taken here, and is making efforts to develop easier ways to jump in to Ruby on Rails development.

This seems like a good topic for a blog post. I might write something up.

Re: New to Ruby? Tips for the new Rubyist.

#26

Earlier quoted context omitted.

I'd highly recommend The Well Grounded Rubyist by David Black http://www.manning.com/black2/ if you want a good intro to Ruby, I found it a much better intro than the Pickaxe

His previous book Ruby for Rails is just as good an introduction to Ruby.

In fact, "The Well Grounded Rubyist" is a "reworking" of "Ruby for Rails". The author mentions this relationship between the books in his "about this book" section at the beginning of "The Well Grounded Rubyist".

Re: New to Ruby? Tips for the new Rubyist.

#27
post #21

OT and hijacking this thread: 1. Who is actually new to Ruby? (After Ruby or rather the popular RoR is there almost for a decade everyone should have made some experiences with Ruby, so I am wondering if there are many new Rubiest) 2. What new language/stack did you start to learn recently? (for me: Node.js)

> Who is actually new to Ruby?

I suspect your comment is being buried for the pretentiousness of that question. Plenty of people are still new to Ruby, because you absolutely do not need Ruby to have a successful development career. Not to mention the population of individuals who are completely new to programming.

Re: New to Ruby? Tips for the new Rubyist.

#28
post #14

Earlier quoted context omitted.

Really? Eloquent Ruby is one of the best Ruby books I've read - Russ Olsen is one of the best and most well respected technical writers out there. Design Patterns in Ruby is also excellent.

I had this discussion already (see the link). Maybe it's a matter of taste but I think this book has some severe weaknesses and thus, I wouldn't recommend it.

No offence but perhaps you bought the wrong book? Eloquent Ruby is about style and design patterns, it's almost about the philosophy of Ruby code, best practises, aesthetics and the author's experiences.

Books like that are fundamentally about taste and style and technique; they can't really be "wrong". You might disagree with the author and think you have a superior approach but to say that randomly googling the topic led you to a "better" explanation tells me that perhaps you were looking at the wrong book in the first place.

Re: New to Ruby? Tips for the new Rubyist.

#29
post #19

I'm in the middle of picking up Ruby primarily because there was a GitHub project I wanted to fork and modify for my purposes that happened to be written in Ruby.The biggest problem I found is that the Ruby (or maybe the Rails?) community by and large provides shit instructions on how to get something running. I checked out a handful of projects and they all said things like, "Just deploy the normal what you deploy a…

Michael Hartl's Rails Tutorial addresses this right away. The first chapter is called From Zero to Deploy, where he demonstrates how to set up a Ruby/Rails programming environment and deploy rails apps to Github and Heroku.

I cannot recommend this enough. Even this lowly darkside Perl hacker was able to make sense of it and use Hartl's example to construct a useful app.

Re: New to Ruby? Tips for the new Rubyist.

#30

I'm in the middle of picking up Ruby primarily because there was a GitHub project I wanted to fork and modify for my purposes that happened to be written in Ruby.The biggest problem I found is that the Ruby (or maybe the Rails?) community by and large provides shit instructions on how to get something running. I checked out a handful of projects and they all said things like, "Just deploy the normal what you deploy a…

If the project you are dealing with is a Rails project, please go through http://guides.rubyonrails.org/ , it gives simple instructions to get started
Post reply on HN