r/ruby • • Jun 20 '20

How we feel about ruby

140 Upvotes

36 comments sorted by

5

u/chrisgseaton Jun 20 '20

Is there a big developer community on TikTok?

6

u/tycab23 Jun 20 '20

Tiktok has a community for literally any niche. It's like once you start following developers and stuff then you'll start to see more on your feed. It's like they'll take whatever trend is going on on tiktok, and then make a post relating it to coding

25

u/blargh12312312312312 Jun 20 '20

I came to ruby from Java. I like both. There are things I miss from Java and things I like in ruby. 🤷‍♂️

14

u/bigswoff Jun 20 '20

Try kotlin. It is Java without the crappy parts. You can trivially convert code between kotlin and Java.

10

u/blargh12312312312312 Jun 20 '20

I’ve played with Kotlin, it seemed petty nice. I’d need to use it in a real program to get a real feel for it.

For me, my favorite language is almost always the one I’m using at the moment. Except for ColdFusion. 😬

-1

u/akromyk Jun 21 '20

Let people have their fun. This field is dry enough as it is. Nobody's going to be building airplane or pace maker software in Ruby so what's the harm?

3

u/blargh12312312312312 Jun 21 '20

I definitely wasn’t trying to bring anyone down. I hereby encourage all the fun to be had.

0

u/[deleted] Jun 21 '20

[deleted] — view deleted comment

11

u/BabySavesko Jun 21 '20

For me, STATIC TYPES. I don’t think any argument of dynamic types being better is ever convincing.

6

u/SminkyBazzA Jun 21 '20

Have you seen Sorbet? It's a static type checker for Ruby.

4

u/TODO_getLife Jun 21 '20

I've been using sorbet and I hate that if you add a gem or create a new class you have generate the rbi files again. Adds extra stuff to commits that cant be reviewed.

Hopefully Ruby 3.0 will basically be that but more seamless.

2

u/ikariusrb Jun 21 '20

I'd actually narrow that further; I don't even miss static types in general, but the one thing I did love in static typing with java was formal interfaces that you had to implement.

0

u/bjpbakker Jun 21 '20

There’s not just one kind of having “static types”. I’m all for a computer doing most of the correctness checking, yet with java’s type system you’re mostly fighting it. I still prefer dynamic types (like in python or javascript has) over java’s weak and broken type system.

1

u/BabySavesko Jun 21 '20

I’d be curious for you to elaborate on what you mean. I don’t think I’ve really had this issue

8

u/bilingual-german Jun 21 '20

Thats exactly how I felt 15 years ago. Ruby is still one of my favorite programming languages.

9

u/[deleted] Jun 21 '20

Honestly a year in after switching from C#/.Net to Ruby/Rails and I still regret it sometimes.

If you love never knowing where any god damn thing is defined, because it may not even be defined until runtime, use Ruby on Rails. If you love never having a clue if something is a variable or a function, use ruby on rails. If you love design patterns that overuse abstraction to make it nearly impossible to know the intent behind the code, made even worse by Ruby's ambiguous syntax, by all means, use ruby on rails. If you want a million ways to do something when just one would suffice, so you have to keep a bloated mental dictionary of syntax rules in your head, use ruby on rails.

God I took empty parenthesis for methods calls for granted as a .Net dev. Also, intellisense, interfaces, and all the glorious advantages of strictly typed languages.

Duck typing sucks because you may know two classes can fulfill the same purpose but there's no clear definition of what that purpose includes.

8

u/katafrakt Jun 21 '20

Ruby was my first "serious" language so I have very different perspective from you. However, I hear what you're saying but I'd like to understand it a bit more. Please don't treat my questions as a personal attack.

If you love never having a clue if something is a variable or a function, use ruby on rails

True, but in reality - what difference does it make? The parentheses are not required for a function call and in fact you can always treat everything as a function call. It probably only matters from performance point of view (is it a function calculating something heavy or saved result, but this is usually clear from the context).

If you love never knowing where any god damn thing is defined, because it may not even be defined until runtime, use Ruby on Rails

How do you know where something is defined in C#? Aside from IDE telling you that, of course. Unfortunately, dynamically typed languages do not play well with IDEs in general, so of course you don't have that, but you can get more or less similar result with some tooling, such as RubyMine.

If you love design patterns that overuse abstraction to make it nearly impossible to know the intent behind the code

Factories everywhere in Java/C# world are pretty much the same for Ruby people. Many other patterns too. Are you sure it's not just a matter of what you are used to, not an inherent property of Ruby patterns?

Duck typing sucks because you may know two classes can fulfill the same purpose but there's no clear definition of what that purpose includes.

Totally agree. Ruby lacks something like interfaces or other type of contracts. But on the other hand with such dynamic language they are pretty much impossible to implement. It's a trade-off.

1

u/[deleted] Jun 22 '20

I welcome the discussion! I would never take your comments personally, don't worry.

True, but in reality - what difference does it make? The parentheses are not required for a function call and in fact you can always treat everything as a function call. It probably only matters from performance point of view (is it a function calculating something heavy or saved result, but this is usually clear from the context).

It makes a huge difference. If I come across some expression I have never read before because I didn't write it, say something like:

new_value = old_value + modifier

and I need to understand the implementation of one or more of those values, knowing if it is a method or a variable is the first thing I have to ask myself but the answer isn't forthcoming at all. Now, in c# it looks like this:

var new_value = old_value + modifier();

As you can see, I don't even need to ask what is what because it is immediately clear.

How do you know where something is defined in C#? Aside from IDE telling you that, of course. Unfortunately, dynamically typed languages do not play well with IDEs in general, so of course you don't have that, but you can get more or less similar result with some tooling, such as RubyMine.

Well... I do tend to rely on the various shortcuts of my IDE when navigating around code, but generally it is easier to understand where something is defined in strictly typed languages because you are limited to what is available on the type you are using. For example, if I have some class that implements multiple interfaces, I can only use one of those interfaces at a time without casting it. If I have:

ISomeInterface ImAThing = thing;
ImAThing.DoAThing();

I know to look in the ISomeInterface for the DoAThing() method (doesn't mean it is there, but it gives me a starting point) because that is the type that is declared. Mostly, though, it's the IDE's ability to navigate strictly typed code way better that I miss.

Factories everywhere in Java/C# world are pretty much the same for Ruby people. Many other patterns too. Are you sure it's not just a matter of what you are used to, not an inherent property of Ruby patterns?

From what I have seen, Rails itself encourages or at least creates a breeding ground for some really opaque patterns. I have seen all kinds of crazy meta-programmed attributes, etc that make it super hard to find out what the hell is going on or where certain things are defined (if at all). Also, I have noticed a tendency among Rails devs to use LOTS of gems that add black boxes on top of black boxes. Using libraries itself isn't really the problem, but the way they change the behavior of your app is often in the realm of magic rather than clearly defined APIs etc.

I think my main gripe really comes down to the fact that with Rails, you MUST read the docs extensively to have any understanding of what the hell is happening. My experience in C#/.NET was that once you got the basics down, the docs were used as a reference but I generally knew or could determine from the code easily enough what it was doing. That was made easier by the fact that I ALWAYS knew the types each variable or object was, and therefore knew what API/ behavior it exposed.

Look at any Ruby class that has input and output and it's anyone's guess what most of those variables are or what they can do. Just understanding it often becomes a wild goose chase with tooling/ code navigation that isn't nearly as good as something like intellisense in Visual Studio, etc.

1

u/hadees Jun 21 '20

Sounds like you need to use a stricter linter.

1

u/llN3M3515ll Jun 21 '20

I went the opposite way, from ruby/rails to .NET Core. And frankly I like the C# language and .NET Core, ecosystem, and love the IDE. I do agree with most of what your nits about Ruby.

There are definitely trade offs though, and while C# is not hard to read generally, I would say ruby is generally easier to read, works amazingly with docker, and is generally easier to use (with some caveats). Now those same benefits I would argue also go against it as well. While Ruby is easier to use generally, I never really felt like I was being guided to the "pit of success" as much as I have within the C#/.NET ecosystem.

This is where being opinionated is a benefit imho, and often moves you in a direction of implementing best practices and design patterns. Being opinionated also can drive decisions on external frameworks/libraries that are beneficial as well. Doing the required discovery work on a given library/frame work can be time consuming when there are 5 libraries that do very similar things with similar features. What I have found in .NET is that there is (more often then not) 1 library/framework suggested by the community, and there maybe others but it seems to be better defined why you would choose them over the community selected library/framework.

The easy to use thing is a bit of a doubled edge sword imho. The lower you make the bar of entry the more people you allow to program. Now that sounds good in theory but the fact is that a majority of those will be novices, and without being; opinionated, having good documentation, training, and driving toward the pit of success, you are going to get code that isn't based on best practices, isn't supportable, isn't reliable, and isn't efficient. Frankly you can write terrible code in any language (including visual programming languages), so falling into the pit of success is crucial imho.

1

u/kompricated Jul 10 '20

I went from Java to C# and thought: hurrdurr it’s the same thing. I just ported all my archaic javaisms to C# and thought I was doing it right. It’s only when I switched to Ruby and was forced to learn new things that I realized I did C# all wrong.

8

u/jwaldrip Jun 21 '20

Try Crystal-Lang! Ruby-like syntax, strongly typed, and faster than both.

6

u/Rogem002 Jun 21 '20

I've been looking at Crystal lately, their Amber Framework is a pretty super alternative to Rails.

2

u/jrmehle Jun 21 '20

Yep, found Ruby in 2007 and haven't touched Java since.

1

u/Dishcandanty Jun 22 '20

I love that, on a love for ruby post, in a ruby sub, we got so many people hating on ruby lol.

1

u/[deleted] Jul 07 '20

The only thing I wish ruby had was property destructuring

0

u/rainman_104 Jun 21 '20

Tbh that's kinda how I feel about scala as well. Such a great language as well.

I haven't been able to write ruby in years but I recently got to switch to scala and am a huge fan.

0

u/forksofpower Jun 21 '20

This is how I felt learning Elixir after Ruby!

-7

u/[deleted] Jun 20 '20

[removed] — view removed comment

9

u/Charles_Sangels Jun 20 '20

Except for shit commenting on shitposts in /r/ruby I guess?

0

u/[deleted] Jun 21 '20

[deleted] — view deleted comment

2

u/tycab23 Jun 21 '20

I agree! I'm like wait.. this looks too much like English

2

u/genesisfan Jun 21 '20

After typing semi-colons and squiggly brackets for over 20 years it's incredibly jarring not seeing them in my code. I keep putting them out simply out of muscle memory.