Live data from Hacker News

An Ode to Ruby

blog.yboulkaid.com

111–120 of 204 posts

Re: An Ode to Ruby

#111

Earlier quoted context omitted.

Productivity. Also you can short circuit a lot of what you said with Crystal lang (for speed) or Ruby on Jets (for ease of deployment, serverless, etc). At Arist (YC S20), we were able to fully rebuild our app in Ruby on Jets, pass a pen test, get SOC 2 compliance, all in under 12 months. This frankly would have taken years if we couldn't lean on the Rails ecosystem, and our Appdex score is 0.999 typically, and we ar…

Thank you. I sometime read that too much "magic" and abstractions can quickly get in the way when doing something complicated that is not covered by a heavely opinionated framework. Is this nonsense in your estimation, or is this something to look out for?

This is very true if you don't actually understand and/or couldn't implement the magic yourself. As someone who has had to implement CSRF protection, cookie management, etc., from scratch in other languages/frameworks, it's just a pure productivity boost when I use something rails-based.

Where you can really get into trouble is if you take rails things for granted, and then go to a framework in another language. For example, you could have been brought up on rails and just take for granted that cookies are encrypted by default, and not realize that your supposedly server side cookie secrets stuff in express is being set in plain text.

What I like about rails, though, is it tries really hard to stop you from doing something stupid. Strong Params is a great example of that. You have to really fight ActionController to get it to do something actually unsafe. By that same token, properly configured rubocop will catch 100% of potential SQL injection vulnerabilities.

Re: An Ode to Ruby

#112
post #12
post #6

It's too bad Ruby isn't seen as 'cool' anymore, it's just so easy to be productive in it. And now MJIT, YJIT and TruffleRuby are making some very impressive performance gains. Rails is also better than ever and I still can't think of a better language for scripting.

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

Python is entirely unreadable to me. Not in the sense that I can't but in the sense that I have to put effort into it in a way I don't have to with Ruby. Part of it is undoubtedly that I'm very picky about syntax and formatting and Python has made a lot of choices that are pretty much the opposite of what I want, but I just can't get used to reading Python code.

Re: An Ode to Ruby

#113
post #30
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?

Personally I think writing Python is like writing maths, writing Ruby is like writing English. Depends which one you prefer.

Whether or not it is true, that would certainly explain why I prefer Ruby so strongly over Python.

Re: An Ode to Ruby

#114
post #37
post #36

Earlier quoted context omitted.

Ok, that's a nicer result (obviously I don't write Python lol) but still seems inconsistent to me (putting the function before the array) considering Python is an OO language and most people are going to be writing methods for classes where you call methods with dot. I just remember list comprehensions from Coffee-script and not going to lie, I hate them. It's like reading backwards.

Python is a multi-paradigm language, of which OO is one paradigm it supports.

Ruby is a strongly OO language, which arguably also has better support for functional programming than Python.

Re: An Ode to Ruby

#115
post #28
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?

Nope. Can't stand that Python uses built-in functions for basic things like list, map, fold, etc... instead of methods on base classes. Here's a super basic example. Add one to an array [1,2,3] and print results. Python: print(list(map(lambda x: x + 1, [1,2,3]))) Ruby: print [1,2,3].map {|x| x + 1} So much more readable, easy to write, etc... Ruby keeps it consistent by making pretty much everything an object and you…

> Even Haskell has dot notation to chain functions since it's just so much easier to read and write...

Are you referring to function composition?

Re: An Ode to Ruby

#116

I am a newbie to Ruby. I hadn't touched it before a few months ago, after coming to Shopify. But I really think Ruby is a fantastic language, I would much rather program in Ruby than in Python, JS or Java right now. It reminds me of small talk and is just nice to write. And Rails, wow Rails is such a good web framework, there's no surprises, and its opinionated nature makes it really easy to come up to speed in even…

> It reminds me of small talk

That's not a coincidence. Ruby is heavily Smalltalk-inspired syntax with a dash of Perl and Awk thrown in (notice all the "$"+single character bits, as well as a look at the "-n" command line) wrapped in nicer syntax.

Re: An Ode to Ruby

#117

Started a new job in the past year and it's 50% rails, 50% react. Thought I would chafe after returning to ruby after ten years of nothing but JS and TS, but I quite like it. I only wish there was slightly less magic and a bit more declaration. It always weirds me out that Ruby just finds stuff without me having to 'import' or 'require' it. I have a love/hate relationship with much of the DSL stuff too (more 'magic')…

> Ruby just finds stuff without me having to 'import' or 'require' it. That's either bundler (which `require`s every dependency you specify unless you tell it not to) or the Rails autoloader[1] (which goes hunting for a file that might define the constant, which also allows hot-reloading to work). Ruby itself requires you to `require` everything. [1]: https://guides.rubyonrails.org/autoloading_and_reloading_con...

thanks!

Re: An Ode to Ruby

#118

Earlier quoted context omitted.

Elixir with Phoenix and Liveview.

I'm a Rails dev at $JOB, currently flirting with Phoenix, and while I think that both Elixir and Phoenix are really solid and even quite enchanting, I don't think they're the best choice for someone's first contact with webdev. Most people are more comfortable with imperative languages and Elixir only adds to the initial friction of not knowing the proper webdev lingo and concepts.

> Most people are more comfortable with imperative languages

Unscientific poll with possibly a biased sample: more people find functional easier to work with. But telling, the difference is more pronounced among bootcampers and informally educated programmers than formally educated programmers https://twitter.com/DNAutics/status/1459348334007787526.

Not to mention that Elixir is basically "mostly functional but you don't have to faff around with monads or anything to do imperative".

Re: An Ode to Ruby

#119
post #93

Earlier quoted context omitted.

Crystal was overall a pleasant experience, which I cannot say for Rust. Although it was probably my fault: 1) for being "rusty" as a programmer myself, and 2) having zero experience with Rust. I want to believe that once you get over the learning curve in Rust development speed becomes much higher. Surprisingly, Crystal seems to be much leaner in runtime size than Rust, with similar performance (although the use case…

I've heard it described that Rust allows you to write programs in a specific way. If you try to write them in any other way, you're going to have a very, very bad time, and fight the borrow checker every step of the way. But if you embrace that way of writing programs, it makes it pretty easy, you get really good error messages, and as a cherry on top your program will be provably sound in a way pretty much no other…

The real cherry on top is that you can put "written in Rust. Modern. Fast" on your project description.

Re: An Ode to Ruby

#120

Earlier quoted context omitted.

My latest job is at a place where we have an extremely 'old-school' Rails app. The vast majority of UI is server-rendered HTML, Javascript (at least that we wrote, we do use Turbo) is very, very minimal, and we're just one very large service. The previous place I was at was a microservice heavy (the count of services was almost on par with the number of developers) React and Node based application. I'm orders of magn…

I'm not surprised. I have a theory that there's a perverse incentive for startups to make their work more expensive and therefore more complicated. It's related to this quote by Paul Graham about funding: "VCs don't invest $x million because that's the amount you need, but because that's the amount the structure of their business requires them to invest. Like steroids, these sudden huge investments can do more harm t…

> For those that aren't VC funded I think that a lot can be explained by cargo-culting; "If startup X is using Node/React/Redux/microservices and they just scored a 20m Series A then we'd better do it too"

Part of it is also from employees: "everyone else is using Node/React/Redux/microservices, if I can push my company to do it I will have more relevant skills for the market". I often hear that for k8s too.

Post reply on HN