Hacker News new | ask | show | jobs
by leetrout 2067 days ago
I took a rails job by accident- I knew rails was in use but I was interviewed in Go and talked about new things going on in Go micro services. I didn’t expect 40 hours a week of rails / ember JS work and that’s my fault.

I have 12 years with Django and I was shocked there wasn’t the equivalent of the Django tutorial. Everyone says the rails tutorial is good and I’m sure it’s worth the money but no one at work endorsed it (nor provided recommendations for any Ruby / rails tutorials).

Coming from Python, Go, JS/Typescript (react, vue, etc) in my most recent experiences it was really rough. I couldn’t understand some of the rails magic and the docs were horrible compared to Django. Ruby Mine IDE was essential.

I learned how much I love DDL management via code (Django ORM or SQL Alchemy) and how active record did just enough to fool you (which is common in other ORMs).

In the end I left the job for a full time Go position and I’ve missed Rspec every day. The rails (or Ruby in general) toolset really impressed me and I’m using Ginkgo at my current job to get my fix for BDD / specs.

6 comments

It’s really surprisingly difficult to jump between Python and Ruby. And Rails and Django. They are just similar enough that you think the switch shouldn’t be so tough but all the differences really bite you. Whereas jumping into a completely different ecosystem like JS or Go you don’t have the part of your brain telling you “this isn’t that different, you’ll be fine, look for something familiar.”
Same for me between R's data-frames and Python pandas' data-frames, they kind of do the same thing but they're also just different enough to make switching hard, you're constantly stuck in an uncanny valley
FWIW I require all new hires to work through the Rails Tutorial in their first week. Nobody needs the entire tutorial, but everyone needs parts of it, and it's impossible to know what parts in advance. It's a fairly fun and easy way to get an exhaustive tour of the framework, and afterwards people are pretty much fully productive.

I wish there was an equally good Ruby language tutorial, as my experience is that it's a bit harder to master Ruby than it is to master Rails, but mastering the language is far more valuable.

> The rails (or Ruby in general) toolset really impressed me and I’m using Ginkgo at my current job to get my fix for BDD / specs.

This is, I suspect, the biggest win from the Ruby/Rails ecosystem.

Rubyland went hard-core TDD a long while back -- I suspect largely due to the influence of Pivotal Labs -- and the maturity of the toolset and automation really reflects that.

Every time I work in another language, I find myself very much missing both the Ruby toolchain and (depending on the language) the everything-is-an-object approach.

Not to say that Ruby is perfect, but the tooling really is that good, which is pretty amazing given that Ruby isn't exactly the most parseable of languages -- although on that front, I've got a lot of hope for Crystal: https://crystal-lang.org

Would you say Rspec is better than the Python equivalents like behave or pytest-BDD? Curious as I've never worked with Ruby/Rails but I'm aware there are some things that are way ahead of other toolchains (and others that are way behind as you've noted).
RSpec is definitely better, but I've mimicked it this way with pytest because I didn't like each Given/When decorator in pytest-bdd requiring a separate method to setup. It was way too verbose. I want to be able to quickly nest them, like in RSpec.

So I do:

  TestSomeMethod:
      TestWhenDateProvided:
           def test_it_does_not_use_system_date(fixture, ...):
           assert ...

      TestWhenDateNotProvided:
           def test_it_uses_system_date(fixture, ...):
           assert ...
Ah so you’d say the nested setup is one thing that differentiates Rspec.

I’d use inherited test classes for this case, either sharing the setup in the parent and having each child define their own tests, or defining the test cases in the parent and overriding the setup in the child classes.

Seems like the latter might be hard in Rspec? But the former sounds more concise in the Rspec notation, I agree. I think Ruby’s anonymous blocks seem to be the differentiator in the toolset, I’ve not seen a Python DSL that’s as good in that regard.

Define "better". The mocking story and the rspec syntax itself is insanely better than in python. But the actual internals are pretty much comparable in my opinion.
Yes. I would use the tooling inspired by the Ruby tools like factory boy and stick with pytest over behave, personally. I’ve not used pytest-bdd.

In JS mocha or jest are both great.

One thing I found is that using a basic text editor for the first year (or so) of learning Ruby, made sure I understood what the IDE was doing when I eventually switched to it.
I would recommend a chromium protocol based library for golang. Ginkgo is heavy and error prone.
I’m unfamiliar with this. Do you have a specific link with more info?