Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I don't understand your bit about "cuteness over familiarity". Can you give an example outside that's not Rails-related (given that Rails seems to be the main source of your concrete complaints)?

Sigils in Ruby actually do have strong and clear meanings. And the difference between symbols and strings is a useful distinction. And contrary to your statement, Ruby's stdlib is far more complete and more internally consistent than what you get from Perl or Python, so I'm not sure what your beef is with that.

It's fair not to like particular decisions a language has made, but from what you say, I'm not getting the sense that you understand the decisions Ruby has made well enough to criticize them effectively. Again, it seems like your experience was colored heavily by Rails, and fair enough if that's the case. But stick to criticizing the actual source of your problems.



Yes, maybe my problem is more with Rails. (Because of monkeypatched APIs, it’s not always obvious to me whether a particular weirdness originates from Ruby’s standard library or is a Rails addition. Arguably this is something the language has also encouraged though.)

Is there any reason to use Ruby outside Rails? Its niche seems to completely overlap with Python and modern JavaScript, and those have enormously more ecosystem support and everything that comes along with it: faster VMs, better tooling, large corporations on committees developing language features, etc.

I view Ruby as a sort of “COBOL of Web 2.0”. A generation of programmers learned the trade with it, and it powers important legacy apps, but I can’t imagine building anything new on it.


I work with Ruby on the web, but rarely with Rails. Apart from the Ruby language itself -- which I love, even though I sympathize with those who don't -- I can't imagine giving up these two libraries by Jeremy Evans:

[Sequel](https://github.com/jeremyevans/sequel) - Sequel is the best ORM I've ever used, in any language. Fast, stable, unbelievably well maintained, and offers great low-level access to the database when you need it.

[Roda](http://roda.jeremyevans.net) - This dynamic routing library is conceptually similar to React Router, in that there is no static list of routes; routing is a function call. But it's faster than React on the server, and has better support for HTTP verb support, database I/O, etc.

As for there being "better tooling" in modern JS, I'm not sure I agree. Babel and ES6 are impressive, and I love writing the code they make possible. But I appreciate being able to write Ruby and know that it will just run. Writing packages for node means choosing one of two incompatible module systems, or adding transpiler bloat.


I came here basically to write this same comment. Can't give enough love to Jeremy Evans and his toolkit, Sequel and Roda are both "gems" of open source (pardon the ruby pun).


Absolutely agree with your statement about Sequel and Roda. Both are true software masterpieces.


Utter nonsense. Whilst Ruby/Rails may no longer be cutting edge Indeed.com/USA currently has 302 Rails jobs by title search compared with 567 for Node, 204 for Django and 142 for Laravel. That's a long way from the “COBOL of Web 2.0” by any stretch of the imagination. Rails also maintained a high score in the review of last year's Who Is Hiring:

https://letstalkalgorithms.com/analysis-of-2018-hacker-news-...

As for Ruby outside Rails, have a look at Metasploit, Puppet, Chef, ROM, Rhoda and dry-rb to name just a few.


Monkeypatching to a large extent fell out of favour with Ruby developers maybe a decade ago, largely because of Rails. It's still being used, but with much more care and it tends to be far more "opt-in" (as in providing the facilities for you to specifically ask for it).

> Is there any reason to use Ruby outside Rails?

Personally I've disliked Rails for about as long as I've used Ruby (14 years). What appealed to me about Ruby then, and still does boils down to:

- Concise while being by far the most readable language I've worked with. The day something beats Ruby on that, I'll consider switching. If they don't beat it on that, they'll have to bring immense other advantages.

- The flexibility the blocks and meta-programming brings and general Smalltalk influence on the object model.

Ruby is in many ways basically a well supported Stalltalk with pretty syntax.

I'd turn it around: I don't see any reasons not to use Ruby for any of the type of work I do.

> faster VMs, better tooling,

The faster VMs would be nice, but Ruby performance is improving fast enough. In some niches it will matter, but you can call out from Ruby to other languages easily enough - you can run JS, C, Python code from Ruby if you need to, so both the performance and tooling is largely moot for my uses, while I can understand it's an issue for some.

The last time I saw a need to rewrite any code in C to speed it up was a decade ago. Of course that depends what you're doing, but for a lot of areas, it's just "fast enough" that there's little need to worry about speed. Premature optimisation and all that.

> large corporations on committees developing language features, etc.

Yeah, no thanks. That's a good reason for me to prefer Ruby as well.


Python already existed when Ruby came out and before rails was a thing. I understand you don't care for the language but the main reason for its creation was to have a completely object-oriented (in the Smalltalk sense) scripting language which python just isn't. Personally, I like a language where everything is classes and methods and I don't have to remember to use a function rather than a method to get (for example) the length of arrays as I have to do in python


I'm learning Java and was surprised to read your comment about ruby being completely object oriented. I always assumed ruby was very similar to Python. I would be interested in learning ruby especially if it is easier for someone with an object oriented background in Java. So, how difficult would coming from Java to Ruby be? And what books or MOOCs would you recommend for the transition?


Yes, everything -- even integers --- are objects in Ruby -- you can say 5.methods and Ruby will respond with a list of methods integers know. I think the best way to learn Ruby is Dave Thomas' classic "Pickaxe Book". This describes pure Ruby, as it predates Rails (not that I have anything against Rails, but a lot of people confuse Rails with Ruby which is a mistake). There is an updated version of the book for sale for Ruby 2.X, but the original is free at http://ruby-doc.com/docs/ProgrammingRuby/ and because most of the changes between versions are minor, it would serve nicely to learn current Ruby.


That's amazing. With integers being objects it's even more object oriented than Java. That's great to hear. The book you linked does I assume no prior programming experience? If so, I would prefer not going over what I already know from Java since both are strongly object oriented. I also hear MHartl's tutorial is good. Would you recommend it fir learning Ruby?


> And what books or MOOCs would you recommend for the transition?

I enjoyed “Eloquent Ruby” when I needed to learn Ruby for my previous job. Highly recommend it.


> Is there any reason to use Ruby outside Rails?

Ruby is a perfectly good scripting language. I use it with love and passion to do the kind of stuff other people use Python, Perl or Bash for.


I use it all the time (and have for at least 9 years now) as a general purpose scripting language. Like, stuff that I could do in bash, but if I do it in ruby it will be 10x more understandable and way more concise to boot.

Sure, I could also do the same stuff in perl or python, but personally I find ruby to be far more expressive.


> Is there any reason to use Ruby outside Rails?

Same reason you'd use any language I suppose. It works as a scripting language, etc. For example, docker-sync, which solves file syncing issues with Docker for Mac (and works on other platforms, but less of an issue there) is written as a Ruby gem.

With AWS recently adding Ruby support to Lambda, my presumption is there's a customer demand there.

Myself, I write a lot of Ruby code that isn't Rails.


It's not the best example, but Ruby is the only language I can think of where an expression (e) fails to parse but ((e)) parses.

I find that it encourages a bad kind of code golf that leads to hard to maintain code.


When does that happen? It certainly doesn't happen for all possible values.


Not all possible values.

f(if x then y else z) does not parse.

f((if x then y else z)) does parse.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: