
Ruby in Twenty Minutes (2006) - mooreds
https://www.ruby-lang.org/en/documentation/quickstart/
======
rlue
I'm a self-taught junior developer who started with Ruby in 2016. I've very
much enjoyed the experience so far, and am currently rather invested in Rails,
though I'm preparing to branch out into other areas of web development (I'm
looking at you, React).

This thread is really opening my eyes to the sheer vitriol that gets directed
at Ruby outside of its own echo chamber.

I get that it has performance issues (to be addressed in Ruby 3) and interest
in Rails is now less than half what it was at its peak.[0] Everyone has very
strong opinions, and when people start soapboxing like they are in this
thread, nobody learns anything.

At this point, honestly, I just think the rest of the community could use a
little bit of Ruby's characteristic niceness.[1]

[0]:
[https://trends.google.com/trends/explore?date=all&q=%2Fm%2F0...](https://trends.google.com/trends/explore?date=all&q=%2Fm%2F0505cl)

[1]:
[https://en.wiktionary.org/wiki/MINASWAN](https://en.wiktionary.org/wiki/MINASWAN)

~~~
toasterlovin
The people who complain about Ruby performance are really missing the the
forest for the trees, IMO. Most people are using Ruby for web development. Web
development has hundreds of milliseconds of latency _that there is absolutely
no way to get rid of_ (in the form of transit to the server and back to the
client). Then you're doing a bunch of I/O. The actual amount of time spent
executing Ruby is just not significant in all of that. Ruby could be 2x faster
than it is now and it would probably make a sub-10% difference in response
time for most of the endpoints in most of the Ruby/Rails apps I've
encountered.

~~~
lucidone
Execution speed of your server code is critically important in today's
atmosphere. It's a lot easier to scale an application than the database behind
it (e.g, spin up a few more VMS/containers vs. partitioning your db - one is a
2 minute task, the other a bohemian effort).

That being said, I enjoy Ruby a lot, and mostly enjoy working on Rails
codebases (depends on how the front end is built, as Rails particularly
_doesn't_ prescribe any form of convention here). I wish they worked on
improving the front end story like Laravel has.

~~~
jmknoll
Unrelated to your main point, but what is a bohemian effort?

~~~
scns
s/bohemian/herculean ?

------
djohnston
I've never learned ruby in an intentional manner, but whenever I needed to
write some, I found that things just worked the way I expected it to, and the
docs were always super helpful. To be fair, I haven't built anything large
scale with it, but my experience with the language has been anecdotally
pleasant.

~~~
colechristensen
I am having the opposite feeling about Python. Seems everyone is using python
these days and I am constantly running into things which I like just a bit
less as I am trying it for side projects. Things just don't quite work the way
I expect them to.

~~~
enraged_camel
Same. I’ll get downvoted for saying this but I find that it is a very
overrated language that is popular _mostly_ because of its dominance in fields
that are currently in the vogue, i.e. ML/AI.

(I know Django is a thing, but that has always been in the shadow of Rails,
and rightly so.)

~~~
wenc
In 2005 I had to choose to invest in learning either Ruby or Python as a
primary language for writing a fairly complex piece of technical software.

I looked into Ruby and it struck me as being a truly aesthetically pleasing
language, and since it espoused the "principle of least surprise" \-- with
caveats, naturally -- most Ruby code tended to be straightforward to read.

Python on the other hand, while clean -- I came from Perl -- had a fair bit of
ugliness like the "self" argument in class methods, and the "dunders" in
dunder methods (__init__). That said, the Python ecosystem, especially in the
numerical computation space, was far ahead of Ruby's at the time, so I chose
Python. It worked out really well and allowed me to accomplish what I needed
to. To this day I have no regrets choosing Python.

Compared to many languages (like Haskell etc.) Python's design isn't the most
aesthetically pleasing or orthogonal or clean. But being a Dutch design, at
least initially, it was very pragmatic. And Python is by no means ugly on an
absolute scale, on the contrary. It’s just not as beautiful as some others.

Python's main advantage is the energy behind it: to this day there are no
converged alternatives to Numpy or Pandas on Ruby.

I can't help but wonder that if in an alternate universe/timeline, Travis
Oliphant, Pearu Peterson, Wes McKinney and others happened to have encountered
Ruby first, we might have a different de facto language for scientific
computing and data science.

~~~
h8hawk
I don't understand why people bashing self argument. It's part of best design
decisions in python. Methods in languages such Java or JavaScript always have
hidden argument called 'this'. In js this actually become messy duo to binding
of this. In python you can easily find this method is bind to instance of
class aka 'self'. It's not always self, It could be cls for classmethods or
nothing for static methods.

~~~
wenc
Most languages have an implicit “this”/“self” which works well. This makes it
easy to convert functions to class methods and vice versa without using any
editor refactoring features. It also makes it easier to refactor (no need to
search and replace every reference to foo within an object to self.foo —- the
only time this might be iffy is if there’s a global function foo, but in
practice it’s not onerous to handle)

Also beginners don’t have to mentally blot out in their heads the self
argument when calling a method (“you mean self isn’t the first argument?”).
Debug messages are also more consistent (“the debug message says my method
needs 1 argument. Isn’t self right there?”)

I accept Python’s explicit self for what it is (Python’s philosophy prefers
explicit over implicit), and don’t have trouble with it but aesthetically it
deviates from most OOP languages out there. It’s a valid choice for practical
reasons but I would also say that an implicit “this” is an equally valid
choice for aesthetic reasons.

Here’s a survey of this/self choices:
[https://en.m.wikipedia.org/wiki/This_(computer_programming)](https://en.m.wikipedia.org/wiki/This_\(computer_programming\))

------
wgj
The obligatory and beloved, [http://poignant.guide/](http://poignant.guide/)

~~~
bepvte
this, along with some of julia evans excellent 'zines, are going straight on
my bookshelf if i ever have a cool bookshelf

------
x15
Ruby helped me grasp the basic OOP concepts when I was a teenager, just by
reading tutorials and blog posts during the time RoR was all the rage.

It was one of those unexpected moments of extreme enlightenment I haven't
experienced in a while now.

------
zach43
i'm a bit confused about who the target audience for this tutorial is...it is
too fast-paced for a newbie, but also seems to be too basic for anyone who is
experienced with other programming languages.

not entirely sure what the "in twenty minutes" bit is aiming to achieve here

~~~
MuffinFlavored
Why would anybody want to learn Ruby over say... node.js/Typescript these
days?

~~~
chrischattin
Well, Rails is still the fastest way to build and iterate a web app that I
know of... BY FAR.

I volunteer to teach an intro to Rails class to folks getting ready to
graduate a local code school and always enjoy watching their facial
expressions as I live demo in about 15 min what they just spend the last
couple months learning how to implement in the node/JS stack.

Plus, Ruby is just a joy to work with. Hard to put a price on enjoying the
language and framework you work with.

~~~
shubham_sinha
When Node Js is taught people often teach Express framework. If someone
teaches AdonisJs, it will have similar effect on audience as mentioned above.

~~~
dagoat
AdonisJs actually does look interesting.

As a side point though, it is much less mature than rails.

Just going off the age, and number of: commits/releases/contributors.

Its GitHub pulse is also obviously not as “rapid”

Rails also has a rich set of libraries in the form of gems - which AdonisJs
most likely doesn’t rival

Rails is also used/has been used in production by some major companies.
Perhaps AdonisJs has been too, but it can’t be as many

------
aboutruby
There is also
[https://ruby.github.io/TryRuby/](https://ruby.github.io/TryRuby/) (inspired
by the now defunct tryruby.org)

Also my favorite:
[https://learnxinyminutes.com/docs/ruby/](https://learnxinyminutes.com/docs/ruby/)

------
Teichopsia
I just started playing around with ruby (on rails) a few days ago and there is
something I found frustratingly refreshing (I consider myself a Jr.) in
comparison to python. The directory is Ruby's virtual environment. End of
story. I was awed and mildly cursing at the same time.

~~~
faitswulff
Virtualenvs are easily the worst part of python

EDIT - I asked 9 months ago and the top comment recommended pipenv and flit:

[https://news.ycombinator.com/item?id=17062184](https://news.ycombinator.com/item?id=17062184)

~~~
Teichopsia
There was a lot of negativity around pipenv a couple months ago.

[https://news.ycombinator.com/item?id=18612590](https://news.ycombinator.com/item?id=18612590)

I just use pythons integrated venv and pip, which work fine for me. However,
it was in that same thread (the link posted in this comment) which suggested
poetry and another I believe, which I do feel like trying out.

~~~
TomBombadildoze
pipenv is still a mess.

Definitely give poetry a shot, it's really good. In particular, I enjoy how
the maintainer engages with the community and is receptive to feedback. He's
pretty good about adding features to satisfy the users, rather than handwaving
legitimate concerns in one-line responses.

------
stanislavb
Also - the fun way to learn Ruby
[https://news.ycombinator.com/item?id=19125800](https://news.ycombinator.com/item?id=19125800)

------
stevebmark
How to grind your programming career to a halt in 20 minutes by buying in to a
community that thinks metaprogramming, duck typing, monkeypatching, unsealing
and resealing, and _everything_ done at runtime are good ideas, with no self
awareness or ability to understand why other ecosystems left these terrible
ideas behind.

~~~
Rapzid
The community has matured a lot over the past decade. Practical OO Design in
Ruby seemed to introduce a paradigm shift as people discovered the old ways
could help them write more maintainable code. And that just because you
can(meta programming), doesn't mean you should.

I haven't had to deal with Ruby in a couple years though.. I don't miss mixin
hell, or chasing down a code line from a strack trace that doesn't exist
because it was generated at runtime(I hope your ears are burning Chef).

------
de9xvnh7
Isn't it a bit late for Ruby now?

~~~
thinkingkong
Late in the day, you mean?

~~~
throwaway427
Personally I love a little Ruby after dark...

------
spricket
Ruby is going the way of Perl, same as the Dodo. I wouldn't recommend anyone
learn Ruby over Typescript, JS, Python, C#, or Java.

There's too much magic and Ruby is seriously sllllooowww. Slower than PHP,
Perl, and Python. The main draw of Ruby was rails, which is functionally
obsolete for modern front end frameworks like React and Angular. It's the OSS
version of Asp.Net WebForms

~~~
intertextuality
Ruby 3 is specifically going to address speed issues, among other features.
However in a lot of cases that’s usually not where the bottleneck is.

Using rails-api as a backend with your choice of frontend is still a viable
option. Perhaps it’s not one’s first choice these days but it’s far from
obselete.

~~~
freehunter
Agreed. Rails API and whatever Javascript front-end you want is the best
possible option out there. It's fast to develop, it's well documented since
Rails has been around forever, Ruby on the backend is sooo much nicer than
Javascript, and you still get access to the front end trickery you need from
modern Javascript.

I have three languages I use. My web sites are done in Rails because it's fast
and logical. One site has a Vue front end, only on a couple of pages where I
need the JS fancy stuff. Most of my pure APIs are done in Flask because it's
lighter weight. I use React Native for my native apps. I tried using
Express.js for the APIs backing these apps but I could never get it all
working right. I ended up rewriting it in Rails and now it's rock solid and
fast as hell.

I'd also like to mention most web development out there is still right in line
with even old school PHP and does not need React or Angular or anything
fancier than Rails. YAGNI.

~~~
h1d
While I like ruby, your post is completely based on your experience. I have a
Koa (express.js successor) with TypeScript and it's rock solid and since I
don't like rails that much, I feel pretty loose there.

~~~
mromnia
Isn't this comparing apples to oranges? I haven't used koa, but it seems to be
same level of abstraction as express - basically a thin layer over HTTP with
routing. Rails or Django are several levels higher - they include auth,
database interaction, CRUD etc. I'm not saying that either approach is better,
just that the comparison seems strange.

~~~
benbristow
Rails doesn't include Auth.

Devise does a great job of it though -
[https://github.com/plataformatec/devise](https://github.com/plataformatec/devise)

~~~
e12e
It does include "has_secure_password" and its friends
(password/password_confirmation) though, which goes a ways towards including
auth/authz even if one doesn't use devise, when coupled with before_action-s.
It certainly comes with _some_ facilities for getting off the ground:

[https://api.rubyonrails.org/classes/ActiveModel/SecurePasswo...](https://api.rubyonrails.org/classes/ActiveModel/SecurePassword/ClassMethods.html)

------
jackewiehose
Even though I always wanted to learn some ruby, I never made it through any
short tutorial.

My problem is: I already _know_ that LISP is the best language(-family) ever
and probably nothing in future will change that.

And meanwhile I accepted python for daily use because it has so many
libraries.

~~~
em-bee
after learning common lisp and smalltalk i realized that almost none of the
languages that were created after added anything new to the language. this
doesn't make lisp the best language, but certainly one that's good enough, and
the only thing holding it back today is lack of popularity, not lack of
ability.

i feel that newer languages add a more complex syntax without necessarily
simplifying the the process. though here i feel that ruby and python have a
rather nice syntax, and it's debatable which is actually easier to read.

for my part, i like the minimalistic syntax of either lisp or smalltalk,
because they make it easier to reason about the code once you get used to it
because there are not so many syntactic elements that i need to keep track of.
but both do take some getting used to.

maybe ruby and python today feel easier to pick up because we start learning
with rather complex syntax.

~~~
em-bee
a good comparison may be lego bricks. lisp and smalltalk syntax is like the
basic bricks that can be used anywhere, whereas ruby, python and others have
additional special parts that only have a single use.

while the basic bricks are much easier to understand, maybe it does take more
skill to use them to build complex systems than if you have a lot of
specialized parts...

------
webgoat
Wow, I thought Ruby was supposed to be an elegant and simple language for
developers but now I realize why it's dying off. It looks like it's trying to
cater to newbies and not real developers with all the syntax changes and odd
paradigms. I'll stick with Python.

~~~
tracer4201
What's wrong with catering to "newbies"? How do you define "real developers"
vs. a newbie?

One of my previous teams at one of the big tech companies who's products or
services you likely use every day had an entire suite of tests for data
pipelines that were quickly implemented in Ruby. That system is still in
production today.

I guess none of the folks on that team were "real developers", huh?

~~~
freehunter
The folks at Basecamp, Github, AirBnb, Hulu, Kickstarter, MyFitnessPal,
Twitch, or tons of other Rails-powered sites must not be "real developers"
either...

~~~
h1d
Add Discourse as a rails app too which is becoming hugely popular. Also
GitLab.

~~~
hartator
And GitHub and Basecamp and Twitter

~~~
h1d
OP already states 2 of those and I thought Twitter left rails forever ago.

