Part of a new series! Feel welcome to dip in and weigh in on a past question.
Let's say I've never used Ruby before. Can anyone give the run down of what the language does and why you prefer it? Feel free to touch on drawbacks as well.
We're a place where coders share, stay up-to-date and grow their careers.
Part of a new series! Feel welcome to dip in and weigh in on a past question.
Let's say I've never used Ruby before. Can anyone give the run down of what the language does and why you prefer it? Feel free to touch on drawbacks as well.
For further actions, you may consider blocking this person and/or reporting abuse
Nick Taylor (he/him) -
Sloan -
error434 -
Nick Taylor (he/him) -
Once suspended, ben will not be able to comment or publish posts until their suspension is removed.
Once unsuspended, ben will be able to comment and publish posts again.
Once unpublished, all posts by ben will become hidden and only accessible to themselves.
If ben is not suspended, they can still re-publish their posts from their dashboard.
Discussion (16)
Ruby has an elegant syntax and allows for very expressive DSLs. Look to various languages that have cribbed RSpec syntax, even those fail to match the expressive DSL. All of which is to say there's something envious about Ruby
Further, Ruby on Rails is an amazing tool for moving from prototype to product.
It's also a language that trusts the programmer (which is a blessing and a curse). You can go so far as to re-open a class to adjust implementation details. (Very similar to advising functions in emacs lisp and I believe other lisps). You could go so far as to store Ruby class defs (or modules) in a database and mix those into your running application. (Is that a good plan? Probably want to not give just anyone that power.
I see Ruby as the child of Lisp and Smalltalk with an upbringing by Perl. Lisp and Smalltalk come from a theoretical era, when computational power was expensive. They are both thought exercises in what could be. And Ruby benefits from their endeavors and presents itself in the vein of a C-based language, meaning it uses the same-ish declaration syntax as many languages (Python, JavaScript, etc).
Ruby is my comfort language. That may say more about me than about Ruby. For whatever reason, if I have a need to compute something algorithmically, and it's something reasonably simple, Ruby is what I reach for, mainly because in Ruby I'm less likely to hit the speed bump called "reading the manual." But that's because I've memorized a larger chunk of the Ruby manual than (say) the Python manual (I'm a student of mathematics so in theory I should be more in the Python orbit). So very likely it being my comfort language is not something about Ruby per se. As I said in my "Python pitch" in your series, I edit Python faster than I edit Ruby, but I think so much faster in Ruby that Ruby is still my comfort language. Doing every single Ruby exercise on Exercism is probably what addicted me to Ruby.
I've been using ruby quite extensively over the past 3 years, and I would describe it as the following:
Nothing more, nothing less. It's quite similar as Python, but with a few more syntaxic sugar (it allows you to write your code in many alternative ways, that I often find very pleasant to read, compared to other languages, which are generally more "rigid").
The places where it shines is when you has to write web applications, thanks to the beautiful Ruby on Rails framework, that allows, thanks to a well defined architecture, and good balance between presets and flexibility to quickly build new applications (and it comes with a very good ecosystem of libraries, called "gems")
So, to summarize:
Of course, it has drawbacks too, like:
I work on the Bridgetown site generator/framework.
At the level of simple end-user tasks, perhaps Ruby isn't any more helpful than, say, JavaScript or PHP. But at the framework level itself, or end-user code which operates on a similar level, the amount of productivity a single programmer has is extraordinary. I'm using Ruby to deliver new features and enhancements at a comparable pace as projects far larger and better funded.
And that's the anecdote I hear from other Rubyists all the time. Small teams or even single developers can use Rails (for example) to deploy "CRUD" apps in the time it takes other stacks to get their build tooling configured. 😏 Now does it require a lot of discipline to maintain a fast, well-architected & tested codebase in the long term? Sure. Ruby can result in awful spaghetti code as much as any language. But for the early stages of large projects or the lifespan of small/mid-sized products? In terms of productivity & elegant expressiveness, I'll happily pit Ruby against anything else out there and feel confident it will win.
Ruby is a force multiplier.
vs.
or
vs.
yield
allows for some nice construct like theFile.open do ...
On the cons side, I would not suggest it for medium complexity code and/or code with a "long life" that will require maintenance in the future. Duck and dynamic typing is nice for its flexibility, but when the code is too complex it gets difficult to keep track of the type of the different variables and this makes maintenance more difficult (at least, according to my experience)
I'll just leave my love letter to Ruby here 💕
Why do you love Ruby, actually? An ode.
Sylwia Vargas ・ Feb 21 '21 ・ 8 min read
Active Record(IMO still one of the best ORMs)
Being the co-founder of Forem, which technically implies that you are omniscient about the language, i think this is the best occasion to pitch us on ruby.
Jekyll ...? ;)
Whether this is a good or a bad thing depends entirely on what you need the language for 😉
General request, could you do a pitch me on Elixir series?
Ruby has a lot of room to reinvent the wheel. This is one of the reasons I love Ruby.
There are two main reasons I fell in love with Ruby: 1) Ruby optimizes for developer happiness, 2) Ruby on Rails
如果我自己开一个公司,我肯定用ruby,因为效率高,写着舒适。