Live data from Hacker News

Happy Birthday, Ruby

github.com

111–120 of 239 posts

Re: Happy Birthday, Ruby

#111
post #3

> Ruby isn't the most beautiful language out there Huh, I sure think it is. I wonder what the author thinks the competition might be? Ruby has its issues for sure, but aesthetics ain't one of them - far and away my favourite out of any major language.

I'm not sure what language would be more beautiful than ruby, to be honest, and it's not even my favorite language to use. Let's do a mini code challenge in the thread -- implement fizzbuzz in the most beautiful way you can, in the most beautiful language you know:

[deleted]

Re: Happy Birthday, Ruby

#112

Earlier quoted context omitted.

So, I'm old, and have done lots of stuff in lots of languages in frameworks. For about a dozen years, Rails was my go-to toolkit. I've written a couple dozen production applications with it. Unfortunately, Rails has really fallen out of favor lately. Even a Rails-specialty shop I worked for briefly has pivoted to using ASP.NET. I've played around in that stack, and found it lacking. (EF just doesn't compete as an ORM…

I have heard a number of things like chess and go and poker described as easy to learn but impossible to master. Rails is not like this. Rails is more like bridge where you have to learn the rules as well as this whole bidding system that fills a book before you can actually play the game. There is no real magic in Rails, and once you learn the tricks yourself it becomes the most pleasant and productive ecosystem to…

> There is no real magic in Rails

For most parts of Rails, I agree. There is one very important one where I don't: ActiveRecord's internal behaviors are opaque enough at most levels where you care about your database to be fairly called "magic". Having to reverse-engineer ActiveRecord to make my database stop puking and to generate a make developers who know Rails but not databases not get upset that now the solution is insufficiently "Rails-y" (whether or not it is correct and whether or not it is faster than the "Rails-y" method that's causing them problems) is not great.

Re: Happy Birthday, Ruby

#113
post #3

> Ruby isn't the most beautiful language out there Huh, I sure think it is. I wonder what the author thinks the competition might be? Ruby has its issues for sure, but aesthetics ain't one of them - far and away my favourite out of any major language.

I'm not sure what language would be more beautiful than ruby, to be honest, and it's not even my favorite language to use. Let's do a mini code challenge in the thread -- implement fizzbuzz in the most beautiful way you can, in the most beautiful language you know:

Ruby the Ruby way:

  module FizzBuzz
    def to_fb
      s = ''
      s 

Re: Happy Birthday, Ruby

#114
post #32

Earlier quoted context omitted.

> Ruby is the very least favorite of all the programming languages I've had to use regularly over my career. > Its syntax strongly favors cuteness over familiarity How do you define regular? I use both Ruby and JS almost daily, and have previously used Java and python for several years. I find ruby a joy to use and have no issues with 'familiarity'

If I used Ruby daily, I'd probably be used to it. Right now it's something I have to touch 2-3 times a week to implement specific features in a fairly large Rails codebase, and it always feels jarring to make the switch from the familiar JS/C++/Obj-C spheres of syntactic overlap.

Sounds like PHP is perfect for you.

Re: Happy Birthday, Ruby

#115
post #8

After 25 years it seems Ruby is in gradual decline these days? You will find one ruby related post at HN after reading 500 of Javascript and/or Python posts here for example.

Its mostly dead. Except in certain shops that use a SVN monorepo.

Re: Happy Birthday, Ruby

#116

Earlier quoted context omitted.

The problem is that "modern python" really includes Python 2 in addition to 3. You can't practically ignore it the way you can ignore ruby 1.x. Yes, things are very slowly moving to python 3, but there is a reason most systems have python 2 and python 3 and even now it isn't uncommon for /usr/bin/python be python 2.

The fact Python 2 has been well supported because the community cares does not make it modern, nor recomended. Just like I wouldn't call php 4 modern, nor recommend it over php 5 or 7. And the reason you don't see that for ruby or node is because their community said "move or die". And many, many projects just died. I've seen the graveyard in the corporate world.

[deleted]

Re: Happy Birthday, Ruby

#117
post #72
post #39

Earlier quoted context omitted.

Check out Crystal - Its statically typed, compiled, and a near one to one implementation of Ruby. https://crystal-lang.org

Is it backwards compatible with Ruby?

To jump onto the other reply. No, it's not and while Crystal has syntax similar to Ruby, it is different enough that you cannot approach it like Ruby.

It looks like a duck, but it does not quack like a duck. This is not a diss. Crystal is good.

Re: Happy Birthday, Ruby

#118

Earlier quoted context omitted.

I'm not sure what language would be more beautiful than ruby, to be honest, and it's not even my favorite language to use. Let's do a mini code challenge in the thread -- implement fizzbuzz in the most beautiful way you can, in the most beautiful language you know:

(defn fizz-buzz [n] (map #(cond (= 0 (mod % 15)) "FizzBuzz" (= 0 (mod % 5)) "Fizz" (= 0 (mod % 3)) "Buzz" :else %) (range 1 n)))

Sincerely, truly a thing of beauty. After writing Lisp code, I don't even understand what people mean when they talk about beauty with respect to programming languages. It's like there are rivers separating the aesthetics of Algol-like languages and an ocean between them and Lisp.

Edit: Here is a Racket equivalent

  (define (fizz-buzz start finish)
    (for-each (λ (i) (println
                      (cond ((= 0 (remainder i 15)) "FizzBuzz")
                            ((= 0 (remainder i 5)) "Fizz")
                            ((= 0 (remainder i 3)) "Buzz")
                            (else i))))
              (range start finish)))
  (fizz-buzz 1 101)

Re: Happy Birthday, Ruby

#119

Earlier quoted context omitted.

pluralization seems to be somewhat orthogonal to the "no standards" issue you raise; one could have introduced standard rules to help with that 'wild west' and still left out pluralization. pluralization brings with it runtime overhead and edge cases (which can be dealt with with more runtime overhead, of course).

I'm curious, where does pluralization of table names bring runtime overhead? AFAIK, they are stored in the model and not generated every time they are needed.

It does bring cognitive overhead, when it's not explicit

Re: Happy Birthday, Ruby

#120
post #80

Earlier quoted context omitted.

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 consis…

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 e…

> 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.

Post reply on HN