This is the first time to learn Ruby for me. However, as compared with other programming language, which are Java, PHP, and so on. Ruby is much understandable programming language. Programming language of Ruby makes us simplify programming. There are many advantages of Using Ruby because it based on object-oriented. What are the advantages of Ruby?
Output of each method shows the same result. As you see, method 3 in Java is the easiest one. However, Ruby’s one is much easier than Java’s ones to write. Ruby does not require semicolon and “System.out.println.” Of course, Ruby makes other situation of methods easier.
Simple looping Example 2:
In case of looping examples, both Java and Ruby show the same result. As you see, Ruby is simpler than Java. Ruby can cut unneeded part of programming language and give us extra time to work other things.
Object-oriented makes us create a data field and a method together. It means that we do not need to work them separately. The concept of object-oriented programming is “object.” We need to consider about object first, then what things should be around “object”. There is a list of benefits of object-oriented:
- The concept of a data class makes it possible to define subclasses of data objects that share some or all of the main class characteristics. Called inheritance, this property of OOP forces a more thorough data analysis, reduces development time, and ensures more accurate coding.
- Since a class defines only the data it needs to be concerned with, when an instance of that class (an object) is run, the code will not be able to accidentally access other program data. This characteristic of data hiding provides greater system security and avoids unintended data corruption.
- The definition of a class is reuseable not only by the program for which it is initially created but also by other object-oriented programs (and, for this reason, can be more easily distributed for use in networks).
- The concept of data classes allows a programmer to create any new data type that is not already defined in the language itself.
Those lists made by Margaret Rouse. She talks what is benefit of object-oriented programming easily. Here is entire article:
In case of this post, I just compare Ruby with Java. However, I found interesting article about Ruby. Its article compares Ruby with Perl and Python. I have never used and learned Python and Perl, but it shows how simple Ruby is. It shows the same program by Perl, Python, and Ruby. Unfortunately, It is in Japanese, but you can see code of them Here is article.