“The goal of Ruby is to make programmers happy.” ~ Yukihiro Matsumoto
Anyone who wants to create their own application faces the challenge to select a programming language. The choice is huge and it reminds the situation when experienced generals decide what kind of weapons to employ for their operations. Different types of armed forces can achieve the desired result but each of them has its specifics. Using aviation and heavy artillery allows architects and designers to fully realise their creative visions afterwards. At the same time, light troops can conduct “sweep and clean” operations and leave suitable for living areas – only cosmetic repairs are required.
The same thing is about programming languages: in the sphere of web applications development, there is always at least 2 or 3 languages capable to cope with the task. However, each of these languages may use a slightly different approach to the problem which brings up the question of development priorities and individual preferences. It makes sense to choose the language that provides better tools for maintainability, optimisation and scalability of your application.
The Essence of Ruby
Developers apply Ruby in dozens of areas – administration, prototyping, research, development of games and various applications, writing scripts, etc. Cisco, NASA, HP and many other companies use this programming language. Ruby perfectly works on nginx, Apache and there are even web servers written in the Ruby.
Ruby is a well-balanced language. It was created in 1995 by Yukihiro Matsumoto. He combined features of different programming languages such as Perl, Lisp, Smalltalk to form a new one that would be natural but not a simple language. It is a high-level object-oriented programing language which is also fully interpretable. The interpretability means that the program code is stored in plain text which is transmitted to the interpreter that executes it.
The cleanliness and beauty of Ruby code are achieved owing to the fact that programmers follow some principles:
- Do not repeat yourself. By writing code once and putting it in the right place, we protect ourselves from the code duplications and from unnecessary work.
- Conventions over Configuration. A lot of methods have already been written and they are ought to be used. In extreme cases, when the defaults do not suit us, we simply rewrite them for ourselves. All for clarity and conciseness of code and all these with minimal efforts.
In Ruby, everything is the object. For each piece of data or code, their own properties and actions may be defined. In object-oriented programming, properties are referred as object variables and actions – as methods. Ruby can easily demonstrate the object-oriented approach by a line of code, which applies an action to a number.
10.256.round # we will get a round number 10
In many programming languages, numbers and other primitive data types are not objects. Ruby, influenced by Smalltalk, allows you to define methods and object variables for all data types. This simplifies the use of Ruby, since the rules applicable to objects are applicable to the entire Ruby.
Ruby’s flexibility is amazing – it allows users to delete, override and modify the basic parts as they wish. Ruby aims to give the programmer as much freedom as possible.
Ruby deliberately supports only single inheritance, unlike many other object-oriented languages. This language gives us the concept of modules (traits – in Scala, categories – in Objective-C). Modules are collections of methods. Classes can freely mix in a module and receive all its methods. For example, any class which implements method
each may mix in Enumerable module. This module adds a number of methods that use
each to create cycles.
class Collection include Enumerable end
The openness of the community is one of the most important strengths of Ruby. If you found a solution to the problem and wrote a useful module you can publish it in the open access and help others. At the moment, thanks to contributions of many people, we have access to thousands of ready-made solutions of various problems.
You do not need to bother about development of standard tools – share-buttons in social networks, sending emails, making up test data, authorization and authentication systems, comments, etc., it is all created, tested and works perfectly. Even if you do not like a part of the library, you can write it by yourself and share it with the community – may be your idea is in high demand right now.
A rich selection of tools is always good but the wider the choice, the harder it is to make a decision. Ruby is not the only one programming language in the world and all of them have strengths and weaknesses. I do not deny the possibility that a more perfect tool may exist but when I program in Ruby I feel ease and pleasure. I like Ruby!
Alexey Kudryashov is a developer from Belarus, currently working at Anadea.info. He has experience building web-based applications using Ruby on Rails. Passionate about Led Zeppelin, book and tea lover.
- Freebie: Vintage Vector Halloween Stamps
- Building Websites with the Future in Mind
- Get the Data You Need in Real-Time with scrapestack Sponsored
- Automating Laravel Tests with Buddy Sponsored
- How Being Uncomfortable Can Make You a Better Web Designer
- A Showcase of Websites That Have Been Inspired by Wireframes
- weatherstack Brings Real-Time Weather Data to Your Projects Sponsored
- Taking a Look at Brand-Related Splash Screens in Web Design