DEV Community

Discussion on: Why I still love Ruby

Collapse
 
kwstannard profile image
Kelly Stannard

Ignoring frameworks and libraries I would say this:

  • Ruby is much lighter on syntax than Java and C# so it can be incredibly easy to read.
  • Ruby is a dynamic scripting language so it is very easy to make changes to anything about your app and see what happens. I make a lot of OSS contributions by just altering a few lines of code in a third party library and seeing if it works.
  • Objects and functions are both first class concepts in Ruby so you can do both object oriented and functional programming at the same time.
  • Ruby is a scripting language, so you can use it for everything from a terminal one liner to a business application to microservices.
Collapse
 
shaijut profile image
Shaiju T

Thanks, What about performance ? does the performance is well when compared to C#, Java, Python and Go ? I also like to know which server side language is better for making web apps.

Thread Thread
 
kwstannard profile image
Kelly Stannard

I don't know what the comparison is in 2020, but for most business logic and webapp use cases Ruby and Rails is more than fast enough. Usually the biggest speed problem in web apps results from excessive database calls and that is going to be a problem in every language.

Thread Thread
 
swiknaba profile image
Lud • Edited

I found a nice benchmark a while ago, comparing:
Ruby 2.7 vs. Python 3.8 => in most benchmarks, Ruby is faster
Ruby 2.7 vs. PHP 7.4 => in most benchmarks, PHP is faster

source: benchmarksgame-team.pages.debian.n...

I guess almost all compiled languages will have an edge over scripting languages.

Thread Thread
 
cyberhck profile image
Nishchal Gautam

blog.iron.io/how-we-went-from-30-s...

I don't think performance is as good as other languages, I consider ruby and python to be slow, developers write code faster though

Thread Thread
 
mcfriend99 profile image
Ore Richard Muyiwa

@lud , what do you mean by "in most benchmarks, Ruby is faster"?? From the same link, I counted 3 (ruby) against 7 (python). Python kinds of win that competition.

And "in most benchmarks, PHP is faster"?? I counted 0 (ruby) against 10 (php). That looks like in all benchmarks

Thread Thread
 
lud profile image
Ludovic Sforza • Edited

Hi! I am not @lud but @lud :) (this is strange though)

edit: Oh. Looks like it is not possible to tag someone with a capital letter in its name. There is definitely a bug or a dev.to design problem here.

Thread Thread
 
swiknaba profile image
Lud

@mcfriend99 "some" in terms of formal logic can include "all". During statistics and formal logic lectures I got that drill, to never say "100%" or "all", but always "most"/"some"/"more than 99%" etc (I am a mathematician, plus English is not my first language, I learned all that logic stuff in German). For a discrete number of objects, that terminology might not necessary, but I just got used to it.

Also, if you scroll to the bottom of the page, you'll notice that this website uses the most recent version of each language, so possibly Ruby was faster in "at least 1" of the specs at the time that I've checked it (it now uses PHP 8, which was not yet released when I wrote my comment).

But honestly, I don't care about if one language wins in 3 out of 5 or 2 out of 7 of whatever. They are all just some isolated benchmarks, which might not reflect reality perfectly. You can write horribly slow code in any language :D

Thread Thread
 
swiknaba profile image
Lud • Edited

@lud :D @swiknaba should tag me, which is my username. Set up an issue ;) github.com/forem/forem
But I am pretty envious, that you got a/"my" three letter username :P

Thread Thread
 
lud profile image
Ludovic Sforza

So it seems that even your username is shown in lowercase in my comment, it tagged you (and not me) successfuly.

Thread Thread
 
decentralizuj profile image
decentralizuj

About ruby benchmark, ruby 3 shows to be 3 times faster compared to 2.7.*. My scripts for Linux administration in ruby 3 are way better. Ruby solved performance issues very well, and I am pretty sure it will keep going better. I know few languages, but I am only happy when writing ruby code :)

Collapse
 
strzibny profile image
Josef Strzibny • Edited

functions are both first class concepts in Ruby

Actually Ruby does not have functions at all. There are all methods.

Thread Thread
 
swiknaba profile image
Lud

They are all objects! :D

Thread Thread
 
kwstannard profile image
Kelly Stannard

Procs are functions.

Thread Thread
 
strzibny profile image
Josef Strzibny

From the Ruby doc: "Proc objects are blocks of code that have been bound to a set of local variables. Once bound, the code may be called in different contexts and still access those variables."

I can also recommend a book patshaughnessy.net/ruby-under-a-mi... that goes greatly to the implementation as well.

Collapse
 
notjames profile image
Jim Conner

One thing I'd like to add for those who are put off by dynamically typed languages (scripting languages, usually). There's a project called crystal, which is a statically typed Ruby-based compilable language. So if you wanna learn Ruby but use it in a compiled language, consider crystal. It's still in pretty heavy development, it seems, but I've done some small projects with it. It's a little different, but I like it because of its Ruby syntax. I love Ruby.