Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 469457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T23:47:04+00:00 2026-05-12T23:47:04+00:00

I have been reading a lot about Ruby the past few days. Every SO

  • 0

I have been reading a lot about Ruby the past few days. Every SO post I come across I hear that ruby is an elegant language. Can you guys give an example of why ruby is elegant compared another language?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T23:47:05+00:00Added an answer on May 12, 2026 at 11:47 pm

    It’s considered elegant because it’s orthogonal. That’s a fancy way of saying that similar operations apply to similar operands.

    Simple example: + on integers adds them; on floating point numbers, ditto. On big integers, too. On strings, it concatenates them (which you’d kind of expect too). Now this is not a big deal for +, you kind of expect it from any decent programming language. But there are operations like map or filter, they work on lists (they should!) but they also work on arrays and in fact on anything that can be enumerated or iterated through.

    I like how array (or list) indexing works, you can use positive integer indexes to index from the start, or negative indexes to specify a position back from the end of the structure, you can specify a range to pull out a subset… this works for lists, arrays and (sub)strings too. It works on the right side of an assignment (=), it works on the left side too (you can assign to a substring, thus replacing part of a string). So you don’t need a substring_replace function, you just leverage an existing, general concept.

    The author of Ruby expressed this in terms of satisfying the user’s (i.e. the programmer’s) expectations: There should be as few surprises as possible, whenever common sense would lead you to expect that something works in a certain way, it simply should. He worked very hard to satisfy this requirement. Also, while Ruby borrows a little bit from Perl, the author disagrees with Perl’s TMTOWTDI principle in favor of the Zen of Python: “There should be one –and preferably only one– obvious way to do it.”

    It’s also nice that Ruby does closures (= code blocks) so you can specify a function simply by wrapping it in a pair of braces. There are places where it’s appropriate to specify a function inline, and Ruby lets you do it conveniently.

    Ruby lets you do things with a small amount of coding because its constructs fit together in powerful ways. I dabble in Project Euler and I find that often the shortest legible and understandable solutions were done in Ruby. The very shortest are in J, but that’s an APL dialect and to the uninitiated it looks like line noise.

    My personal experience bears this out: I taught myself Ruby and Rails and wrote a Web application with medium-complex data analysis in one week. Every principle I learned, I could apply in different places with different data – It Just Works™!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been reading a lot about Reinforcement Learning lately, and I have found
I have been reading a lot about how and why to use an MVC
I have been reading a lot about C++ casting and I am starting to
I have been reading a lot about how flash development/design had died, and as
I have been reading a lot about HTML 5 and some of the changes
I use jQuery. I have been reading a lot about selector performance and optimizing
I have been noticing __construct a lot with classes. I did a little reading
I have been reading through the C++ FAQ and was curious about the friend
I have been reading about the differences between Table Variables and Temp Tables and
I have been reading up on this, and it seems that if you use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.