16 ms·
I Love Ruby
- kreutz 3y agoI love Ruby too. I wish they fully embraced types. Sorbet is not fun to use.
- revscat 3y agoGood lord, no, it is not. I tried Sorbet on a small personal project and rather quickly abandoned it. It made the code ugly and was a pain to maintain. The fact that Sorbet has not seen adoption outside of Shopify is also somewhat telling. It’s disappointing, because Ruby needs this. Modern tooling has moved in the direction of typed languages, and Ruby’s tooling has suffered comparatively. Outside of RubyMine it’s still difficult to get “jump to definition” to work consistently, and in 2023 this is a rather embarrassing strike against the language.
- xutopia 3y agoSorbet is the worse part of using Ruby professionally. It's actually so far removed from developer happiness if feels completely foreign to long time rubyists. I wished there was types build-in the language though... I see the value in that.
- claudiug 3y agosame
- zakshay 3y agosame!
- deleted 3y ago[deleted]
- xal 3y agosame
- aato 3y agoCame here curious to see if you'd post; was not disappointed.
- brink 3y agoAfter 10 years in Ruby, I moved onto Rust four years ago, and don't plan on really looking back. But with that said, I'm glad you love Ruby! There are certainly things to love. Personally, I just can't do without a good type system anymore. I think Rust has spoiled me. I do miss Ruby's powerful reflection features though.
- TOGoS 3y agoSame. I used to love Ruby because it just matched the way I thought, and the standard library was layed out in a way that was consistent and easy to remember (one reason I never got into Python was that, while batteries may be included, the naming conventions are all over the place and I found every step of using them surprising). I fell out of love with it when 1.9 broke all my string manipulation code. The Rails crowd pushed the 'magic' stuff way farther than I was every comfortable with. I rarely made use of reflection, but even so find my old programs buggy enough due to mishandling of edge cases that I just don't really trust it anymore. TypeScript/Deno has mostly taken its place for me, though I don't find it quite as ergonomic for little system admin tasks as Ruby was.
- graypegg 3y agoI think I have a few "most favourite" technologies that all max out some principle or idea that I like. The author here really hits on exactly why Ruby is my favourite "get things done" language. Rust, Typescript, and Crystal are all things I've worked with, but nothing gets out of my way like Ruby. It feels like sketching? It's very expressive thanks to it's prose-y syntax, but also metaprogramming + reflection like you mentioned really makes forming an idea while developing possible, at least much more possible than most other careful correctness-ensuring paradigms. There's nuance to these things, and nothing is the best really. But I think satisfying a borrow handler or a type checker does slow down that flow for me. I'd pick up a brush if I know what I'm making for sure, but a piece of chalk if I'm just wanting to get something working. Personal taste of course!
- tlrobinson 3y agoAgreed, when Ruby became popular it was primarily competing against languages with verbose and rigid static type systems like Java. That is no longer the case, and the benefits of safety and developer experience provided by a good type system outweighs the cost.
- deleted 3y ago[deleted]
- tines 3y agoI know it's not the point of the article, but, as a code reviewer, this: > Well written ruby code can often read like natural language. Features like predicate methods even give up punctuation. [...] This is often why ruby programmers don’t like comments. In most cases, the language makes comments unnecessary. churns my stomach. Good comments are rarely about saying what the code does, they're about explaining _why_ the code does what it does. Regardless of how comprehensible ruby code is, it doesn't change the need for comments. If I had a nickel for every time I gave a commit a -1 review because it had too few comments or the wrong kind of comments or lacked a "why" commit message, I'd be a rich man.
- pmgei48t 3y agoout of curiosity how many ruby codebases have you worked on?
- stickfigure 3y agoWhy do you ask that? I worked in Ruby at Pivotal, with lots of people who espouse the "comments are just lies waiting to happen" philosophy. I agree with the parent, it's wholly misguided. Good comments save many, many hours of rediscovery by people who are new to the code - which includes the original author after walking away for a few years. If I had to guess, the anti-comment attitude comes from consultants who re-implement the same CRUD webapp on Rails over and over. Sure - no surprises, no comments, fine.
- pmgei48t 3y ago'cause i have no trouble reading ruby code without comments and neither do most rubyists in my experience
- stickfigure 3y agoReading code is easy. What's hard is to read the mind of the programmer who wrote it. The reason we argue about Chesterton's Fence is that Chesterton was too damn lazy to leave a comment.
- narven 3y agotry Crystal lang (https://crystal-lang.org/ https://crystal-lang.org/)
- mathverse 3y agoThis. I dont really need true essence of metaprogramming craziness of Ruby. I need Ruby-like, dev happiness, readability and performance. Wish Crystal would catch up and get some attention.
- sinkwool 3y agoKotlin is very ruby-like and performant, check it out. If you don't mind using JetBrains IDEs, I'd give kotlin a try.
- deleted 3y ago[deleted]
- whytheswposts 3y ago[flagged]
- desireco42 3y agoI for one appreciate this post. I love Ruby too and it brought a lot of joy and pleasure in my life. I am mostly not using it today but it is OK, I still love it.
- soulbadguy 3y agoIt's interesting how different languages resonate so differently with each of us. I have tried a bunch of languages, and got pretty deep into ruby at one point in time when rails was the main web framework i was using. However ruby is probably my least favorite language. Most of the features which actually make ruby unique are exactly the one that turned me away and toward something like F# when i want funtional goodness, C++ when i feel adventurous and scheme/racket when i want dynamic language fix. > Ruby is probably the most expressive programming language on Earth I wonder if there is a generally accepted quantifiable definition of programming language expressiveness. Here the author seems to equate it to closeness to natural languages. In my experience, ruby code is easy to write, but hard to follow without being familiar with the code base and it's idom. A lot of the information required to understand it is passed through implicit context.
- philomath_mn 3y ago> I wonder if there is a generally accepted quantifiable definition of programming language expressiveness In my opinion, expressiveness is used as the catchall, je ne sais quoi whenever someone likes a language and needs another bullet point to put in the "Pros" column.
- jjgreen 3y agoIt has a certain je ne sais quoi but I don't know what it is.
- Spivak 3y agoI don't think that tracks because the reason people like Go is due to it's lack of expressiveness. It feels like expressiveness is the quality of a language to allow the programmer to change the behavior of the language constructs themselves. Python __getitem__ would be a good example allowing the programmer to control [].
- haolez 3y agoOn the other hand, I find it extremely difficult to follow C# code. It's a lot of type gymnastics and dependency injection noise that makes it hard to understand where's the actual business logic.
- samsquire 3y agoIt's positive and uplifting post and it is that too when a language works with how you think and is expressive and productive. It's unsatisfying to work against a learning curve if you are hitting obstacles. A language is one possible notation of thought. I like to be productive with my thoughts. I tend to do proof of concepts in Python then port to C or in Java directly. I remember learning about Ruby when posted on digg and there was a new tool coming out all the time.
- robertlagrant 3y agoI've no opinion on Ruby, but I don't really understand this article. People like familiar tools, and get good at them - agree. But a lot of languages can be written in fluent ways, and I didn't really find the test example that easy to read. I wouldn't say "end end end" at the end of describing the test out loud, for example.
- akprasad 3y agoI'm glad that the author enjoys Ruby! As someone with limited Ruby exposure, these quotes stood out to me: > The language is meant be joyful to use. [...] Everything else that Ruby is stems from this value. This is important and underrated. I think many programmers have a bias that working on a difficult problem entails using a "real" programming language with sharp edges. I had some version of this bias for a long time until I started exploring the most recent generation of systems languages. > Well written ruby code can often read like natural language. I see where the author is coming from, but I find a healthy dollop of symbols to be very helpful for reading and understanding code at a glance. > Feeling recognition in the language you’re programming is so powerful. This is the feeling I had the first time I used Python, and later Rust. It's a wonderful feeling! > [As] Kent Beck said at RailsConf in 2020, “Software design is an exercise in human relationships.” Especially true given all of the components involved in supporting a language: compiler, docs, standard library, third-party libraries, package managers, frameworks, formatters, profilers, ...
- rapsey 3y ago> This is important and underrated. I think many programmers have a bias that working on a difficult problem entails using a "real" programming language with sharp edges. I had some version of this bias for a long time until I started exploring the most recent generation of systems languages. All languages have some mantra that everyone repeats and that is the Ruby mantra. Personally I find Rust to be joyful because the type system, project and package management is so good and the end result is efficient without any extra effort. What I find joyful is getting things done well.
- woodruffw 3y agoThe blog post (and Ruby's) emphasis on programmer happiness really resonates with me: other than Rust (which induces programmer happiness for fairly different reasons), I've seldom run into a programming language and ecosystem that tries so hard to make programming mirthful. (Does that make Ruby a good programming language? That's unclear to me; what's clear is that I have fun writing it.)
- drewcoo 3y ago> I've seldom run into a programming language and ecosystem that tries so hard to make programming mirthful. Perl felt like that in the 90s. Ruby (not Rails) seemed like it was trying to do a better Perl - better OO, better functional style, better syntax, etc. Both of them inspired a lot of things in other languages. And lots of people groan and complain about both of them today. From what I can tell, a lot of complaints are from people who don't really like to code. Expressiveness means choice and that means thinking about coding instead of just following a "one way to do it" pattern over and over. Thoughtful coding, making something unique and making it easier than other examples, is also the kind of coding that LLMs can't do - they only munge together mediocrity out of what exists.
- jes5199 3y agowhen Ruby was up and coming, people compared it to Perl a lot, but I never saw the similarities. I guess they both have first-class regexp. But ruby has very standard semantics, almost interchangeable with Python and Javascript in most cases. Perl… like, I would have to look up “how to access a nested array” because its sigils, arrows, and types form such an alien system
- mech422 3y agoIIRC, the comparisons were because Ruby was supposed to be a fully object oriented 'perl-like' language. Even the name was a nod to its Perl based inspiration.
- vidarh 3y agoRuby shares command-line options with Perl, the use of sigils, many of the single character globals. Besides Smalltalk Perl is probably the biggest influence on Ruby, but the Perl influence is more superficial.
- atomicnumber3 3y agoI love Ruby too. It's a great language, and as a language I like many things about Ruby a lot more than python. In particular, chains of functional operations like: arr .map{|o| ... } .reject{|o| ...} .reduce(init_acculm){|init_acculm, o| ...} are super super clean and expressive. Very similar to what I like about Java streams. And the library ecosystem is great, I like how it shares spiritual similarities with python where libraries are very "no nonsense" (you don't need extensive configuration and builders and researching a million configuration items etc etc... looking at you, Java) and you typically just import and go. Rails, of course. I keep picking python over ruby though, for things I'm going to have to actually maintain. And I typically pick Java over python if I smell I'm going to care even an iota about performance. (Often I don't, though). But ruby vs python, I keep coming back to the divergent opinions they've taken on gradual typing. I like that python3 lets you include the types as part of the program, part of the grammar. Ruby relegates them to a separate file. I guess the intent is that it's more for libraries, like how js libs will ship typescript type files? But I don't like that, I want types for myself. Sorbet exists, of course, but I don't like that it's a) a gem and b) still not a first-class part of the grammar but is instead just operating "in-language". I know it works and e.g. Stripe uses it to great effect (I worked there) but I just don't like it, personally, and I find that python3 with its built-in type hinting tends to get typed more readily than ruby where it's a much further reach away. But I really love ruby. I hope it improves its type-hinting story because I like most other things about it. But I was pretty unenthusiastic about python prior to it getting its type hinting built-in, so apparently this is a big deal for me.
- woodruffw 3y agoBlocks and `yield` are a killer feature; I regularly pick Python over Ruby for similar reasons as you, but I consistently find myself missing those two (and all the things that get built out of them, like the `Iterator` APIs). Python is a lovely language, but context managers often feel like a shabby substitute for what I can do with `yield` in Ruby :-)
- endgame 3y agoThis is basically how I feel about true first-class functions when I have to wrangle ruby and care about blocks, procs, and lambdas.
- thegabez 3y agoNo language is more fun to write in than Ruby.
- bakuninsbart 3y agoI think the point about expressiveness is exactly what makes ruby so divisive: It is great when you are deep within the ecosystem or do exactly what the ecosystem expects you to want to do, and an absolute pain if you want to do anything non-standard. The supports_feature-method is probably defined somewhere 5 abstractions deep. If you are lucky that is, it might also be part of some library's weird meta-programming of supports-* that no LSP can point you towards. I've never worked in an ecosystem that celebrates implicitness as much as ruby does, and it is driving me nuts. The fact that finished code looks great and reads well doesn't balance the scales in my book.
- pqdbr 3y agoIn my experience this is almost never the case. #supports_feature? would be defined right there where you'd expect - in that Subscription model. Even tough you can reach for metaprogramming (like define_method or method_missing), that's really not how the entire ecosystem of guides and tutorials will point you. Anyways, when in doubt, just plug a debugger and call "@subscription.method(:supports_feature?).source_location`, and generally that's all it takes.
- mplewis 3y agoRails is the biggest Ruby project and it’s heavily based on metaprogramming. Even Rubymine has trouble finding the canonical definition of a named method sometimes – it has to guess. I love Ruby but I totally understand this criticism.
- sodapopcan 3y agoRails is a library, though, the advice applies to application/business code. Metaprogramming is extremely useful for making really simple-to-use libraries. If your business logic is full of metaprogramming, that's more of a problem, especially in this day of age where it's common for developers are only sticking around at any given job for 2 to 3 years.
- Fire-Dragon-DoL 3y ago
- chihuahua 3y agoIt is mind-boggling to me to see all the low-value features that Ruby has, but no enums. So every time an enum is needed, there's some ugly code that tries to emulate an enum. The guiding theme for Ruby appears to be "let's give people a huge number of ways to write unreadable code" and it reminds me of JWZ's classic rant about PHP, "a fractal of bad design."
- jjgreen 3y agoI disagree, but thanks for reminding me of that article, just splendid https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/ https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/ You couldn't really find that many quirks, edge-cases and foot-guns in Ruby, could you?
- chihuahua 3y agoFor me, it's not so much that there are quirks and edge-cases, but rather that Ruby seems to have a lot of clutter (e.g. "unless", punctuation as part of function names, etc) while useful features are missing.
- jjgreen 3y agoFair enough, a matter of taste. Personally I'm a fan of "then" which I guess would give you the horrors :-)
- sensanaty 3y agoI always find talking about Ruby fascinating, because it's so divisive and for good reason. It's one of those things where you either love it or hate it. The first moment I saw a question mark denoting a boolean, I fell in love with Ruby right then and there, but I also perfectly understand why people hate that. Same with stuff like `unless`, whenever I use a different language I'm always tempted to make a small utility class with all the Ruby niceties like `unless`, and that's another thing I can completely understand not liking.
- hu3 3y ago
- makeramen 3y agoI actually dislike that Ruby reads like natural language. The complex logic in large systems would take many paragraphs to describe in english but is often much clearer and more succinct in code.
- mattgreenrocks 3y agoRuby’s a great language, but the cult of personality is really strong there, especially in Rails. And that ultimately led me away from the ecosystem. I’m not looking for heroes to worship, just good tech.
- andrei_says_ 3y agoWhat are some symptoms of a cult of personality? I use Ruby and Rails and I know that DHH and Aaron Patterson are somewhat famous but don’t know much about them and certainly don’t make any decisions based on their existence or fame.
- mattgreenrocks 3y agoBoth of those individuals have made fantastic contributions. My beef isn’t with them. It’s with the community that insists that DHH’s software design edicts are The One True Way. Instead of software design being a thing you can use to make your life better, we are to believe that Rails Is All You Need. And think at the time it was the framework to use, so it attracted a lot of people who believed software dev should be “do what the thought leader says.” No idea what it’s like now, but it truly felt like people saying those things out of tribal affiliation more than technical acumen. And that is a recipe for stagnation. That said, I still respect the tech and the creators a lot. I just don’t share the values at all.
- vidarh 3y agoThere's plenty to Ruby outside of Rails. Many of us hardly touch Rails - even in the web space there is a wide range of other frameworks. I tend to agree there's much cruft in the Rails space, but I also hardly ever interact with the Rails crowd.
- impulser_ 3y agoMaybe this is just my experience, but the thing that sucks a lot about programming to me it that the most enjoyable programming languages are often the ones with the smallest job market. My job as a programmer would be infinitely better if I could spend it programming Elixir all day, but there is basically no Elixir jobs compared to Typescript, Python, and Java. But instead I hate my job working in Typescript all day solving problems that I wouldn't have to if I could just use Elixir. Ruby use to an exception to this, but almost no one is building on Rails anymore compared to how many people build on React, and NextJS. I'm talking about full stack application market, this is probably different for Rust users for systems, and Python for Data/AI.
- briantakita 3y ago> But instead I hate my job working in Typescript all day solving problems that I wouldn't have to if I could just use Elixir. Before I focused on iso js, I worked with EventMachine & even a little bit of Erlang. Would love to hear more about an alternate timeline if I stuck with Ruby & went down the Elixir route. --- I used to work with Ruby & switched to js before TS to build isomorphic libraries & apps. TS has been beneficial imo though figuring out type inference for library code is a steep & time consuming learning curve & takes experience to figure out the edge cases. In the end though, having type inference work in library code is worthwhile for quickly developing apps. Re: expressiveness, the js/ts ecosystem suffers from mostly using camelCase, which has variable casing depending on the position of the name segment...which makes project wide searches for composed abstractions less reliable. I distilled the "tag vector" name convention to address this issue. Granted, Ruby having `?` & `!` available is as a terse & explicit expression of intent is nice. > almost no one is building on Rails anymore compared to how many people build on React, and NextJS. I got burnt out on Rails after the 3rd consecutive upgrade project for large codebases. I think the dominance of React has been detrimental to the js ecosystem as its bloated with the api being complex & unintuitive. It also took the JS framework guys a decade to figure out the MPAs are the way to go. I hoped people would have figured that out sooner. I got tired of the complexity & size of the reactive state management & ui libraries & recently wrote my own (rmemo & relementjs). I working on a vite alternative called rebuildjs with an Elysia/bun based app library called relysjs. I loved how many Ruby community (other than Rails) had a commitment to create simple libraries. It seems like js framework communities have this drive to lock developers into their complex manifestations. Sorry about the long comment. I have to get back to a major version update to ctx-core (general purpose contexts & utility functions) addressing type inference...which will make developing apps with these libraries more reliable & effective. https://www.briantakita.me/posts/tag-vector-1-tag-vector-convention https://www.briantakita.me/posts/tag-vector-1-tag-vector-con... https://github.com/ctx-core/rmemo https://github.com/ctx-core/rmemo https://github.com/relementjs/relementjs https://github.com/relementjs/relementjs https://github.com/rebuildjs/rebuildjs https://github.com/rebuildjs/rebuildjs https://github.com/relysjs/relysjs https://github.com/relysjs/relysjs https://github.com/ctx-core/ctx-core https://github.com/ctx-core/ctx-core
- deleted 3y ago[deleted]
- marcrosoft 3y agoTake ruby vs go. Ruby can write expressions that resemble a sentence so you can skip commenting and it looks nice. Go is verbose and less English like. Which is easier to understand what the code actually does? Go may take a little extra time to digest but it is infinitely more clear what is going on. If you don’t need to debug the ruby code or optimize it ruby wins because it is easier to digest and reads like English. It is a trade off like many things in software.
- PH95VuimJjqBqy 3y agoThis is actually one of the reasons I dislike cucumber so much. They try so hard to make it read like English for non-tech people but to really understand it you need to understand the underlying regex being used.
- eliseshaffer 3y agoHello! I'm Elise, the author of the post. Figured I'd jump in and say that in addition to Ruby, I really like Cucumber. But I think the non-technical people focus really cuts a lot out. For me, Cucumber gives the whole team(tech and non-tech) a shared language for what the software does. I don't use it much anymore, because most companies seem to have moved away from it. But, I do miss it and wish we had something similar that could encouraged that level of shared understanding.
- djur 3y agoI spent several years working on production Go code and I never found it particularly clear or intuitive to read or debug compared to Ruby. This seems like a "your mileage may vary" situation.
- shaftway 3y agoI don't know Ruby at all, and maybe some familiarity with the language would help, but the biggest example code makes absolutely zero sense to me: RSpec.describe Ticket do context 'when the ticket is closed' do it 'emails the requestor with a confirmation' do ... end end end I have no idea what's going on here. I get that there are some blocks of code, though it was the indentation that told me that; "do" and "end" feel super verbose and bleed into the important parts of the code for me. Why is Ticket capitalized? Is this a variable? An object that we're about to work on that's coming into scope? `context `when the ticket is closed'` feels like it's setting me up. Is this an if block? Or is it some fancy way to set a listener on a property? Is this setting up a callback that'll persist across runs of the program? Or is this just a method named with spaces that could do anything? `it 'emails the requestor with a confirmation'` has got to just be a method name. But what is "it"? What was "context" in the previous one? And why does "emails the requestor with a confirmation" need to be a block? What happens in there? Is this just setting up some kind of call stack like thing that provides context all the way down? None of this is intuitive. And the impression that I get is that the author is calling methods with spaces in their names and unclear block semantics "expressiveness".
- binary132 3y agoIt’s a unit testing DSL for setting up a tree of preconditions / setup.
- jabbawookiees 3y agoTicket is a class do ... end is how you create no-argument functions similar to () => { ... } in JavaScript. There's some technical nuance but that's the spirit of it. In Ruby you can call methods without needing to place parentheses. So this roughly translates to the JavaScript code: RSpec.describe(Ticket, () => { context('when...', () => { ... }); }); This specific code describes a test that uses the RSpec testing framework. In RSpec, "context" and "it" are just functions that you call to describe chunks of tests and individual tests respectively. Some Rubyists would say that the combination of these syntax rules (do-end and optional parentheses for function calls) allow you to make "domain specific languages" (DSLs as they're known in the community) without needing to write your own parser. I think it's pretty plain to see the impact in expressiveness if you look at the equivalent Python unittest suite. The Python equivalent would have classes that inherit unittest.TestCase and methods named like test_when_ticket_is_closed. In Python land, classes and method declarations are repurposed because the syntax is what it is. In Ruby, you can practically make your own faux keywords by abusing do-end to accept nested blocks.
- nickysielicki 3y agoI had to write some ruby at work recently and wasted a few hours on a bug caused by the following footgun: irb(main):028:0> value = false or true => true irb(main):029:0> value => false That really makes me want to write it off entirely. It’s hard to think of a situation where this is the right behavior.
- jameskilton 3y agoYou want to use "||" like most languages, not "or". They have different precedence rules.
- sinkwool 3y ago`and`, `or`, `not` have much lower precedence than `&&`, `||` and `!` . I would just avoid `and` and `or` in general. For some more explanation see https://graceful.dev/courses/the-freebies/modules/ruby-language/topic/episode-125-and-or/ https://graceful.dev/courses/the-freebies/modules/ruby-langu...
- djur 3y agoRubocop forbids the use of `and` and `or` in a value expression for this reason, and I believe several style guides used with Rubocop ban them entirely. I like them but have come to accept that they're more trouble than they're worth (in a shared codebase with lots of contributors, at least).
- mberning 3y agoIf that is enough to turn you off it’s probably for the best.
- matthewowen 3y agoIn python empty string is false. In ruby 0 is true. And yes, ruby has both or and || but they mean different things. I’m not saying that it isnt valid to criticize these things: first time use of a language matters, people work in multiple languages, it is good to be intuitive. But in practice, these things aren’t problems for people who work regularly in these languages, so I personally find them to be quite low salience. I recognize that this is sort of similar to the claims the hypothetical user of php makes in “php is a fractal of bad design”, but personally I find think the issues are of a different nature.
- kazinator 3y agosupports_feature? contains gratuitous punctuation. A question mark is useful on predicates when they are nouns. For instance type tests. Here is why: widget(x) looks like a constructor: it's making a widget out of x. If we add a question mark: widget?(x) then we know it's a test whether x is a widget. We have other choices there like is_widget(x). "Supports feature" has a verb and object. The verb is not in imperative form; it's in a statement form. A question mark is not required.
- graypegg 3y agoI think this is a normal ruby pattern though. A ? prefix is just a best-practice habit to indicate a method returns a real TrueClass or FalseClass instance. You’re always running Ruby statements in some scope, so there’s always an object you’re running methods from. That makes your constructor and reflection examples a bit odd for Ruby. Constructors would be a method on a class, normally the Class instance method #new: Widget.new(x) Checking if y is a Widget would mean calling a method on that instance, normally the Object instance method #is_a?: y.is_a?(Widget) I think that’s adequately distinct.
- deleted 3y ago[deleted]
- skgough 3y agoI always understood the question mark to mean that the method returns a boolean value, eg. the include? method on Arrays returns a bool.
- manicennui 3y agoRuby is still very popular in Chicago.
- erados 3y agoGood to hear that as a Ruby developer.
- mberning 3y agoIt’s a shame that Ruby doesn’t have the cachet it once had. People are missing out. It’s still a fantastic language and Rails is still the goat web framework. Perhaps we’ll see a renaissance in the future. I still prefer to do all my tinkering and playing in Ruby first.
- UncleOxidant 3y agoI really fell for Ruby around 2001 after liking Perl for about 5 years but then deciding that OO Perl was just seemed like a hack. Ruby was my favorite language from about 2001 till about 2010 or so. Then I found strongly typed functional languages like OCaml and F# to be more to my liking. And Python not Ruby was used in most of the jobs I had during the 2010s. It seems like Rails really caused Ruby to fall out of favor around 2010 so it's interesting to see some positive Ruby articles here lately. Looks like there's been a good amount of performance improvements as well as new language features added over the last decade - perhaps we're seeing a bit of a Ruby revival?
- RagnarD 3y agoI've programmed in both Ruby and Python. I like both, but ... It should never be forgotten that the ultimate purpose of programming languages is to make specific usable programs. It's sort of fashionable to ignore performance but in reality it's always an issue of some kind. And the fact remains that the price paid for Ruby and Python's features is severe performance degradation. That's improved over time but as far as I know it remains a real problem. One shouldn't let admiration for language features supersede user experience and resource utilization.
- eropple 3y agoThe vast majority of web code is waiting on a database, written in something eye-poppingly optimized, to push a string back to the client that asked for it. It's "pick things up and put them down" plumbing and the delta between a Fast Language and a Slow Language will usually be swamped by connection latency. There are of course places where it isn't appropriate to use a Ruby or a Python, sure. So don't. There are plenty of others where sniffing at them on the grounds of performance is making up a guy to get mad at.
- RagnarD 3y agoThere's more to the world than web oriented programming, and more possibilities for Ruby than Rails.
- eropple 3y agoOf course there's "more". I frequently write code that's going nowhere near a web server. My Github projects from my Ruby days is zero percent Rails, even--and it's a bunch of not-web stuff for which performance also wasn't an issue then, either. This isn't even some kind of well-actually gotcha, it's firmly a mainstream, obvious thing.
- deleted 3y ago[deleted]
- musicale 3y agoI liked Ruby when I first encountered it because it felt like a scriptable Smalltalk that plays nicely with friends. Then I accidentally learned Python one afternoon and never thought about Ruby again. I'm sure Ruby is better than Python in dozens of ways, much as alternate keyboard layouts are better than QWERTY (and Rails is probably better than Django.) And I'm still mad at Python for setting fire to billions of lines of 2.7 code that people had written. But I'm still using Python.
- vidarh 3y agoPersonally, the Python syntax is a sufficient reason why I will never switch to it over Ruby.
- hurtbird 3y agoWhy? Can you give a few examples?
- vidarh 3y agoSignificant indentation alone is sufficient. I loathe it.
- musicale 3y agoIt's the python litmus test, basically. I think a large number of people (including me) can live with it (and maybe even appreciate the vertical space improvements) while a different but still large number of people (like you) can't stand it (and perhaps find it to be an intolerable source of programming errors.)
- vidarh 3y agoI think if it was just that I might have eventually tolerated it, but it's a really big one which meant I approached every other part of Python with much lower tolerance for anything else which didn't just perfectly match what I want...
- jupp0r 3y agoI hate Ruby with a passion (it's also the language I mostly use in my day job currently). It's not necessarily the language itself, which is a reasonable language, it's the patterns that are common in the ecosystem: 1. Use of inheritance for code sharing. It makes it extremely hard to reason about any piece of code I am looking at. Where does the `param` variable come from? Is it injected by any ancestors of the class I'm looking at? Who knows, I have to use the debugger to find out. I cannot reason about the code without it. Of course you can use Ruby while preferring composition over inheritance, it's just rarely done by the community. Other modern languages like Go and Rust wisely leave out inheritance for code sharing in their object model and arguably have much more readable (albeit verbose) code. 2. Global mutable state is everywhere. Not sure if it's Rails architecture that encouraged using global state as request local state (until they found out that this makes concurrency hard), but Ruby codebases are full of global mutable state. It's everywhere and again makes it hard to reason about dependencies between objects and how they interact with each other. Again, this is nothing that the language forces people to do, it's conventions. 3. Overuse of meta programming. Ruby's metaprogramming is really well done in my opinion. The problem is that lots of people want to use it and do so in places where it doesn't provide enough value to justify the costs. It's an authentication library. It doesn't need it's own DSL.
- 38 3y ago> Go and Rust wisely leave out inheritance for code sharing in their object model Bad news buddy: https://gobyexample.com/struct-embedding https://gobyexample.com/struct-embedding At first I loved it, then quickly realized as you did that it makes code essentially unreadable.
- masklinn 3y agoThat is very much not inheritance. It’s literally just sugar for delegation: calls which delegate to embedded structs execute in the embedded struct’s context. And the embedded struct has to be part of the struct definition, it can’t be snuck in by reopening the class and include-ing new bits.
- ajmurmann 3y ago
- rochak 3y agoI don't.
- mgz 3y agoRuby one love
- oglop 3y agoMaintaining Ruby is a nightmare. Trying to escape that hell now. I do like Ruby for my own projects. But I hate working on Ruby with others. It becomes more messy faster and then all that supposed “getting out of your way” goes out the window and you have to know about 9 objects, one of which is an iceberg which will need to quack at some point. Overall, it obliterates a programmers ability at local reasoning in code, which is where I really want speed.
- Cthulhu_ 3y agoIs that due to Ruby the language or the developers and/or their culture? I mean I personally believe maintainability is a combination of the language itself and the culture around it; Go is a great example of a language and culture aimed for readability and maintainability, eschewing cleverness. That is, the language is limited in how much cleverness you can write, and the culture is opposed to people trying.
- jwestbury 3y agoIt's both, really. Even if we limit this to dynamically-typed, interpreted languages, Python is far more maintainable that Ruby both because the language and the culture take a stance of "there is one correct way to do something." In many cases, you can do things multiple ways in Python, but the language design is intended to make one approach preferable for a specific problem. Ruby is heavily influenced by Perl, with a focus on being enjoyable to write. And let me be clear: I loved writing Perl, back in the day. If I still used Perl, I'd still love writing it. But part of why Perl is so fun -- and why Ruby is fun! -- is that it's expressive and flexible, and you can do a lot of things you really shouldn't. This leads to people writing code that was fun to write, but will be difficult to maintain -- and the language's foundation rests on this concept, so the culture is (subtly?) encouraged to embrace it.
- jwestbury 3y ago> Maintaining Ruby is a nightmare. Trying to escape that hell now. The problem with maintaining Ruby is that Ruby is heavily influenced by Perl.
- cryptos 3y agoI agree with the author that "developer experience" is underrated in many programming languages or frameworks. But at least for me Ruby is by far not the number one in this area. While the syntax looks nice at a first sight, lack of type information and meta-programming can make working with this language tough. And there are other factors to pick a programming language, runtime performance for example. I guess that this and the absence of static typing are the reasons why Ruby fell out of fashion. For me Kotlin is the sweet spot in programming language. You get a concise, readable language with world class tool support, static typing and the excellent performance of JVM + everything available in the Java ecosystem.
- jstummbillig 3y agoThe hours I have sunk into making vscode a rails ide are substantial.
- JelteF 3y agoWere you successful? I spent a lot of time too, but never got "go to definition" to actually work well.
- felipeccastro 3y agoYes, with Solargraph. It uses type inference most of the time, and when it can’t guess the type, you can add YARD comments. Intellisense also works well (autocomplete).
- ansonhoyt 3y agoCheck out VSCode's "Ruby in Visual Studio Code" page [1]. Ruby LSP already does quite a bit and started gaining go-to method abilities last month [2], though it isn't complete quite yet [3]. It's build on Prism, so promises to be more robust than past attempts. Shopify has been moving fast on improving things here. The Rdbg integration works great too [4]. Just add a `launch.json` and VSCode can hook into the very nice capabilities Koichi Sasada has been adding to the official `debug` gem. [1]: https://code.visualstudio.com/docs/languages/ruby https://code.visualstudio.com/docs/languages/ruby [2]: https://github.com/Shopify/ruby-lsp/releases/tag/v0.12.4 https://github.com/Shopify/ruby-lsp/releases/tag/v0.12.4 [3]: https://github.com/Shopify/ruby-lsp/issues/899 https://github.com/Shopify/ruby-lsp/issues/899 [4]: https://marketplace.visualstudio.com/items?itemName=KoichiSasada.vscode-rdbg https://marketplace.visualstudio.com/items?itemName=KoichiSa...
- hschne 3y agoInteresting that the discussion here focuses so much on the actual language. I think the language is fine, but the thing that really makes me stick with Ruby is the ecosystem and the culture it fosters. The article also makes that point. I have yet to see a programming community (around a language) that is as encouraging and nice as the one around Ruby.
- dcchambers 3y ago> I have yet to see a programming community (around a language) that is as encouraging and nice as the one around Ruby. Agreed 100%. It's like the opposite of the javascript community where I feel like the leaders of various camps are constantly trying to tear each other down about the best way to do things as they fight for developer mindshare/marketshare. Maybe I just see too much JS drama on twitter. Anyway, the Ruby community is so wholesome and a breadth of fresh air in the modern tech world.
- vinc 3y agoI started with PHP many years ago for my side projects while at the university, then I switched to Python, but when I graduated there were only PHP jobs available so I took one because I had to. I was not happy with PHP, it was a pain to use it. I never want to hear again about WordPress or Drupal. I discovered the Ruby community at its peak around that time and fell in love with it! I started a new project at work with Rails and all my next jobs were Ruby jobs. I experimented with Node when it came out but I think I'm burn out with everything related to JavaScript at this point. And the Ruby community, while still great, seems to be dying out locally. Meanwhile I've been doing some Rust side projects for almost a decade, and it looks like this will be my next language. Time will tell. I still love Ruby though, I wish it was more popular, it's such a nice language.
- anonyfox 3y ago[dead]
- verelo 3y agoVery similar experience here. I started in .net but ended up Working in php, although only recently did i switch to ruby for a personal project. I’m loving ruby, and paired with nextjs / react for a front end this has to be the best working environment I’ve ever had the opportunity to use. I wish I’d been doing this for work prior but I’m glad to be finally doing it at the ripe old age of 37.
- Ilikeruby 3y agoI mean, I like ruby.
- germandiago 3y agoI want to like Ruby but what I found annoying about it and Rails is that many things were magic and implicit (in Rails) and consistent style is difficult to maintain. Python looks much more uniform in this sense and it is very powerful. Maybe not as good for DSLs, yes, but for general coding it keeps itself very understandable.
- claudiug 3y agoIm doing a lot of python now, and I found the python code abs mess. it should be only one way, that is a joke. ruby is way more consistent here . check fastapi, sqlalchemy, or any ML library, what a mess...
- germandiago 3y agoReally? How? I mean, I find regular Python quite structured, uniform and easy to follow. Also very explicit (except when you start to do some __getattr__ magic and so on. That part is messy. But most ot the time you find for loops, comprehensions and unsurprising code.
- cies 3y agoI always wonder what languages authors of such articles had exposure to.
- donmb 3y agoWe love it too and so far we could solve any problem with it.
- devoutsalsa 3y agoI like my Ruby code. I usually hate other people’s Ruby cuz too much magic.
- aidog 3y agoI really love ruby too. I hope I can find a job writing a lot of ruby every day.
- globular-toast 3y agoEverything I read about Ruby I feel can be done with Common Lisp. I wish more people would learn Lisp just to see what's really possible in a programming language.
- eliseshaffer 3y agoHello everyone. I'm Elise, the author of the post. This is just wild. I mostly write for myself and never imagined I'd make it onto Hacker News. I think an overlooked part of my point in this post is that the language felt intuitive to me from the beginning. It really matches the way my brain was already thinking about code. Think in messages, focus on small objects and what messages they can receive. There's a lot of comments about not understanding Ruby or finding it hard to maintain, but we're all different. I know people who feel the same way I do, but about Javascript, or Kotlin, or even Objective-C(which I find impossible to follow). I get that Ruby isn't everyone's cup of tea, but for me it's pure joy. And when I'm working with other Rubyists, it feels like we're flying along effortlessly. I wasn't really trying to comment on other languages. And everything we choose is based on our own design sensibilities, our constraints, and our experience. I really just wanted to put down in writing, what sparks joy for me about Ruby.
- brightball 3y agoI can speak from both sides of it now. When I first took on a project that was written in Ruby I was extremely annoyed. Once I learned my way around and really understood it better, I loved it. It's still my go-to for just about everything just because of how productive and readable it is. The performance optimizer in me fights a constant inner battle about the fastest way to do things vs the most productive way to do them. With more time and experience, productivity wins just about every time. I'm also a huge fan of Elixir and it's always interesting to watch the language discussions because there are people who are absolute "static typing is the only way" zealots out there. I don't use zealots lightly either. Preference is one thing. "Any other way is wrong" is entirely another. Elixir gives you a different way of achieving the same thing with strong typing, pattern matching, guard clauses and type inference via symbols...but it's still not enough for the static typing crowd, no matter how perfect the balance of concerns. When you find your language, enjoy it. There's always going to be people who find a reason to dislike your choice because it wasn't their choice.
- eliseshaffer 3y agoI totally agree about productivity. It's one of those things where focusing on it really improves your outcomes.
- sodapopcan 3y agoEven though I don't really ever write it anymore, I still have a HUGE softspot for Ruby. It's a great language though definitely one you have to understand and follow its idioms to not be annoyed by it. Unfortunately, all your coworkers will need to do the same, which is where it can start to fall apart. One thing I don't miss that a significant part of this short article, is RSpec. I was into it at first but it just becomes a burden. When you're writing test descriptions in English, there is very little value gain to gain from the ceremony RSpec has. As for assertions, it turns out that if you're a programmer, `assert a == b` is just as readable as `expect(a).to eq(b)`. Yes, the latter does make it easier to get the arguments in the right order for the output, but that's about it. Otherwise, it's just "neat." You end up thinking a bit too much if you are doing things "the rspec way" which is not something I want in my brain when writing tests. It's also more to learn for onboarding people. Stuff like `expect(a).to be_present` really means `assert a.present?` are head scratchers that I just don't see any value in other than being neat. RSpec is definitely a cool idea and a very well-designed project, but un-necessary by me. It's been 3 years since I've used it daily and haven't found the tests I'm writing these days to be any less readable.
- altdataseller 3y agoIs Test Unit or whatever the alternative is called better?
- sodapopcan 3y agoI'm not sure, all I ever used in my 8 years of writing Ruby every day was RSpec. I was very bought into it but just expressing that once it was gone, I didn't miss it.
- psyclobe 3y agoI love ruby too; let’s your imagination run wild!