Technical Articles

Tech Articles from your friends at Oracle and the developer community.

Topics
              Topics

              What is Ruby?

              Have you been thinking of learning a new programming language, but aren’t sure which one?

              If you’ve done much research or had any experience in computer programming, chances are you’ve seen Ruby programming discussed. Ruby is a highly popular programming language that’s used for lots of things, from web app development to data analysis. It’s also very user-friendly compared to other programming languages, and it’s fairly easy to learn if you’re willing to put in the work.

              Perhaps best of all, Ruby programming skills are highly in-demand in the marketplace, and being able to code using Ruby can make you a very versatile and useful programmer.

              But if this is the first time you’re hearing about Ruby, you may be feeling a little overwhelmed. After all, there’s a wealth of information on programming on the internet, but not all of it is helpful. Where should you begin if you’re just a beginner trying to learn Ruby?

              While there are lots of resources on the web for mastering Ruby programming, this article will give you a solid introduction. Keep reading to find out what Ruby is and what it’s for.

              Benefits of Ruby

              You don’t have to spend much time researching computing programming before you come across mentions of Ruby on Rails or the Ruby programming language. But what exactly is it?

              According to the official Ruby project website, the Ruby language is one of careful balance between functional programming and imperative programming. It was designed to be natural and intuitive, but not too simple to be effective. Fans of Ruby consider it "a beautiful, artful language".

              More specifically, Ruby is a scripting language designed for front- and back-end web development, as well as other similar applications. It’s a robust, dynamically typed, object-oriented language, with high-level syntax that makes programming with it feel almost like coding in English. In fact, some people feel that they can practically understand Ruby code before even learning how to program.

              Ruby on Rails, Ruby’s web framework, is one of the most popular web development frameworks in any language. Although Ruby is probably most famous for its use in web development, it has many other uses, too. Some of these include automation, command-line tools, static site generation, DevOps, web scraping, and data processing.

              Perhaps most importantly, Ruby is a highly versatile and portable language. It can be used just as easily on Windows, macOS, Linux, and even UNIX and DOS. No matter what programming job you want to get done, there’s a gold chance you can do it in Ruby.

              Where Ruby Came From?

              Ruby was invented by Yukihiro “Matz” Matsumoto, a Japanese computer programmer, in the mid-1990s. Matsumoto was an expert on multiple programming languages at the time, including Perl, Eiffel, Smalltalk, Lisp, and Ada. When creating Ruby, he tried to combine what he thought were the best elements of each of these languages.

              Ruby was publicly released in 1995, but it didn’t quite achieve mass acceptance until much later in 2006. Since then, Ruby has attracted a massive global user base, with programmers from many different industries using it to make some of the world’s best applications. There are even large groups of devoted coders that meet in major cities for Ruby-related conferences.

              Best of all, Ruby is completely free—not only free to use but and open source. It can be copied, modified, and distributed at will.

              The Ruby on Rails web development framework was released in 2005, and in many ways, it became Ruby’s claim to fame. Ruby on Rails revolutionized how web development was done, making it possible to create complex and user-friendly web applications in far less time than before.

              Ruby on Rails became an instant hit with time-strapped startup entrepreneurs, as it allowed small teams to build large applications quickly. Some of the major sites that use Ruby on Rails today include Shopify, Square, Instacart, Twitch, SoundCloud, GitHub, Kickstarter, Ask.fm, and even Hulu.

              How Ruby Works

              Ruby is a highly flexible programming language. Developers coding in Ruby can make changes to the way the language itself works. It’s an interpreted language like Python, rather than a compiled one like C or C++.

              But unlike Python, which focuses on a single, unambiguous solution for every problem, Ruby projects try to take multiple different approaches to problem-solving. As you might have guessed, there are benefits and disadvantages to both methods, depending on your project.

              One feature that makes Ruby so user-friendly is that it hides a lot of details from the programmer. This makes programming with Ruby much easier than using other mainstream languages with more complexity, such as C and C++. However, it also means that finding bugs in the code can be more difficult.

              Conveniently, code you write in Ruby will run on any of the major operating systems without having to be ported, including Windows, macOS, and Linux.

              What Is Ruby Used For?

              As we’ve already established, Ruby is most often used for creating web applications. But because it’s a general-purpose language, it can be used for many other types of programs as well.

              Ruby has been used in the booking site Airbnb, the streaming service Hulu, and the calorie-tracking app MyFitness Pal. This fact alone demonstrates just how versatile and powerful Ruby can be.

              When it comes to web development, the framework Ruby on Rails is used. Rails uses ready-made conventions that save developers time on configuring projects. It also has code generators to create parts of an application automatically, letting programmers write less code.

              Ruby can also be used for static site generation. In a static website, all web pages are loaded at the same time. This improves webpage loading speeds and allows for quick, easy website deployment.

              Web servers are another fairly obvious application for Ruby. Some existing web servers that were made using Ruby include Puma, Unicorn, and Passenger. Servers process raw incoming HTTP requests and pass them on to the correct backend applications, then handle the HTTP response that’s sent back.

              Other uses for Ruby include DevOps, data processing, and web scraping and crawling. To learn about these use cases and more, check out Devleoper.Oracle.com to learn more about the varying ways you can leverage Ruby with OCI.

              Ruby vs. Python

              When people are trying to decide which programming language to learn or use for a project, they often compare Ruby’s features with those of other languages. C, C++, and Java are all popular options to consider. But perhaps the other language that gets compared to Ruby most often is Python, as they can be used for many of the same applications.

              Python and Ruby share many similarities, and this can make it difficult for beginner programmers to decide which language to study. For example, both are high-level, server-side scripting languages. Both can be used for web applications and work on multiple platforms.

              Additionally, both Ruby and Python are supported by Emacs modes, work with embedded doc tools, and can be used in GNU Debugger (gdb) styles. They both use an interactive prompt called IRB, and objects for both languages are strongly and dynamically typed. Last and perhaps most importantly, both Python and Ruby have clean syntax and are easy to read.

              For all the similarities between Python and Ruby, however, there are just as many differences. To start with, while Python is a strictly high-level programming language, Ruby is more of a general-purpose language. They also use separate frameworks—while Ruby uses Ruby on Rails, Python only works with Django.

              Python supports multiple IDEs, while Ruby only supports EclipseIDE. Mixins can be used with Ruby, but they don’t work with Python. And Python has a larger range of libraries than Ruby.

              Finally, the Python community is mainly focused on Linux and academia, while the community surrounding Ruby focuses on web development.

              There are several other differences between the two languages, but these are the basics that you’ll need to know to make your choice.

              Get Started on Your Ruby Programming Journey Today

              By now you should understand what Ruby programming is, what it’s most often used for, and what you need to know to get started. As you can see, Ruby is a valuable and versatile programming language with many uses. What’s more, mastering it can give you a significant edge in the coding industry. However, this article only scratches the surface. You’ll have a lot more to discover on your way to learning Ruby, or any other coding skill. To get even more help along the way, make sure you stay up to date by reading our blog.

              Latest content

              Explore and discover our latest tutorials

              Serverless functions

              Serverless functions are part of an evolution in cloud computing that has helped free organizations from many of the constraints of managing infrastructure and resources. 

              What is a blockchain?

              In broad terms, a blockchain is an immutable transaction ledger, maintained within a distributed peer-to-peer (p2p) network of nodes. In essence, blockchains serve as a decentralized way to store information.

              OCI CLI

              The CLI is a small-footprint tool that you can use on its own or with the Console to complete Oracle Cloud Infrastructure tasks. The CLI provides the same core functionality as the Console, plus additional commands.