Live data from Hacker News

An Ode to Ruby

blog.yboulkaid.com

121–130 of 204 posts

Re: An Ode to Ruby

#121
post #64

Earlier quoted context omitted.

What was cool was Rails, IMHO, and Ruby was the surprise inside it. I've had my own personal Advent of Code these holidays, coding a small API for a personal need. Ruby (Sinatra) took one morning to full deployment in Heroku. Then I tried Crystal (Kemal) and it took me a couple of days to figure out how to map JSON to Crystal data structures. Then I rewrote it again in Rust (Rocket). Two weeks till I figured out, wel…

Surprised you didn't try Elixir? What about Sorbet?

I would love to try elixir, but JetBrains still does not have an IDE for it. I'm addicted to their IDEs.

I did try the community made plug-in for elixir, but had trouble getting the debugger to work which was a show stopper for me.

Re: An Ode to Ruby

#122

I love Ruby - Rails has been my day job for the past decade and my life is so much more pleasant when working with it than the odd time I've ventured off into things like Go or Java. For personal things, my bread and butter is Sinatra and Sequel and that's a great combo as well. My only real issue with it is differences in building native extensions on macos vs linux, usually need to set different compiler flags in t…

So what's the upside for you with Sinatra? I'm embarrassed to having been doing Ruby for 8 years and never touching it. Just never saw the need - Rails in API mode seems adequate.

Sinatra is small (the main part is about 2k lines). That's the main upside and/or downside depending on your philosophy. As someone who likes to know what goes on, I love Sinatra, but Sinatra does force you to pull in other code as needed yourself - you don't get handheld the way you do with Rails.

If you need the kitchen-sink you might as well use Rails. But often you might need only a tiny fraction, and Sinatra is small enough to read. If you need a "halfway house" between Sinatra and Rails, Padrino layers nicely on top of Sinatra and you can pick and choose which parts of Padrino you want to use.

My preferred stack is Sinatra + Sequel as the ORM, but if I need something "quick and dirty" I might throw Padrino on top as it's lightweight and unopinionated enough it doesn't get in my face the way Rails does.

The caveat is that if your team is used to Rails chances are they'll hate you if you make them use Sinatra and they don't share a dislike for big frameworks.

Re: An Ode to Ruby

#123

Earlier quoted context omitted.

So you come from the Node ecosystem and your main complain about Rails is that the project has a lot of dependencies and files? lol

I hear your point but the quantity of files produced by initializing a new rails project is very large, larger than an equivalent node project with server and framework. These aren't transient build artifacts either, they will live in the repo and may occasionally need attention.

Except with node you have to roll everything yourself, so jumping between different projects is a nightmare (each one a snowflake)

Roll your own session management, auth, ORM, db migrations, html templating, CORS, cross site scripting protection, the list goes on and on.

Re: An Ode to Ruby

#124

Earlier quoted context omitted.

Having tried both Node and Rails, Rails was a horrible experience. I hated every minute of it and will ignore any job listings including it. Your whole project is in a billion files and everything works by "magic." There is so much complexity and different flies that it sucks to work with. Meanwhile with Node you can start with a simple index.js and work your way up.

So you come from the Node ecosystem and your main complain about Rails is that the project has a lot of dependencies and files? lol

When you create a project it makes like 100 files that are all automatically executed somehow. Nothing really includes them, but you know it works. These files arp part of your project, but they is also a bunch of rails stuff so it blurs what is and isn't a dependency for your project.

With node projects they typically keep all of their dependency neatly under node_modules/ and you can clearly see how things are included and how things work.

Re: An Ode to Ruby

#125
post #65

Earlier quoted context omitted.

Having tried both Node and Rails, Rails was a horrible experience. I hated every minute of it and will ignore any job listings including it. Your whole project is in a billion files and everything works by "magic." There is so much complexity and different flies that it sucks to work with. Meanwhile with Node you can start with a simple index.js and work your way up.

FWIW It seems to me your comment about Rails is a more general comment re: frameworks. Learning a language/runtime takes some effort but much less, IMHO, than learning a framework. Doesn't matter if that is Rails, Django, Ember, Angular, iOS SDK, Android SDK, React+Redux+???, and so on.

I don't think so out of your list I've used the Android SDK along with a react and redux stack and I didn't get the name kind of feeling. With those you start out with a mainly clean project and everything makes more sense to me how it works.

Re: An Ode to Ruby

#126

Managing different projects with different Ruby versions with rbenv has been the bane of my existence the past couple weeks. Why isn’t this experience fleshed out better by now?

Use rvm with .ruby-version (and optionally .ruby-gemset) files in each project. RVM hooks into the cd command so it's automatic. For CI scripting you use "rvm (path) do (command)."

rbenv also automatically swaps versions based on .ruby-version files. I believe it accomplishes this by wrapping the ruby binary with a script that checks your project directory; it doesn't touch cd.

Re: An Ode to Ruby

#128
post #122

Earlier quoted context omitted.

So what's the upside for you with Sinatra? I'm embarrassed to having been doing Ruby for 8 years and never touching it. Just never saw the need - Rails in API mode seems adequate.

Sinatra is small (the main part is about 2k lines). That's the main upside and/or downside depending on your philosophy. As someone who likes to know what goes on, I love Sinatra, but Sinatra does force you to pull in other code as needed yourself - you don't get handheld the way you do with Rails. If you need the kitchen-sink you might as well use Rails. But often you might need only a tiny fraction, and Sinatra is…

Sinatra and the Camping microframework were an enormous help for me when I first started learning Ruby. Being able to read a minimal implementation of routing (for example) helped dispel a lot of the magic that I got hung up on in Rails.

Re: An Ode to Ruby

#129
post #40

I think Ruby might be the antithesis to Java. For all that I despise Java's ridiculous boiler plate, I always know exactly what's going on. In Ruby, I feel like there are unknowns in every file. I hate Java, but Ruby makes me miss Java.

> For all that I despise Java's ridiculous boiler plate, I always know exactly what's going on Not my experience at all when doing Spring Boot, talk about magic. Rails looks dead simple compared to that.

Perhaps I've only had to deal with sane Java codebases - I feel like magic is not the norm in Java.

Magic is built into the Ruby language, what with everything being "message passing" under the hood.

Re: An Ode to Ruby

#130
post #12

Earlier quoted context omitted.

"I still can't think of a better language for scripting." Python I find equally if not more simple. Would you agree?

Python forces you to wrestle with its'/Guido's idiosyncracies. It wears them on its sleeve almost like a badge of honor. You may enjoy them, but I don't. Lack of Tail Call Optimization is a huge red mark for me, personally. Ruby, on the other hand, is literally meant to delight you with its choices/options/expressiveness and I find that it absolutely delivers on that promise.

[deleted]
Post reply on HN