The terseness of Ruby

After hacking around with Ruby on a few scripts - I'm blown away with how terse the language allows the programmer to be.

I'm used to being a slightly more verbose or explicit in my programming. Coming from an education background in C++, everything is very declarative and verbose. That is until you program your own syntactic sugar into you programs/libraries.

I like terse languages, BASH and Perl are extremely terse languages, which although different in procedure - allow you to wield great results with very little code, and provide constraints to be precise in their execution.

However, I'm seeing very terse Ruby, which is doing a lot. I've seen it said that Ruby is candy coated Perl. And I'm starting to see why. It's not that Ruby is "easier" or "prettier" than Perl. It's that there is so much prebaked syntactic sugar that whole functions blocks are done on one line yet accomplish 4 or so lines of Python. And your dealing with single keystrokes for parameters.

This makes for some seriously terse code. Which I like, but I feel like you run into what gave perl a bad wrap. Maintainability.

Maybe it's a lack of experience in writing Ruby, but I think I'd have to spend a lot more time documenting what I did, when being extremely terse, than if I just wrote it out it moderately terse, but clearly understandable code/logic.

Then again Ruby is a very "open" language. It's not the Pythonic mind set, so feel free to be terse or verbose. I'm just blown away/impressed and at the same time cautious about this langauage.

I'm thinking Ruby is slightly different than most other languages and it may take some time to do things "the Ruby way"

1 Like

I'm not used to terse languages with a background in C. its one of my main struggles with python. it just does stuff in the background without me knowing what's happening