This website uses cookies to better the user experience of its visitors. Where applicable, this website uses a cookie control system, allowing users to allow or disallow the use of cookies on their computer/device on their first visit to the website. This complies with recent legislative requirements for websites to obtain explicit consent from users before leaving behind or reading files such as cookies on a user’s computer/device. To learn more click Cookie Policy.

Privacy preference center

Cookies are small files saved to a user’s computer/device hard drive that track, save, and store information about the user’s interactions and website use. They allow a website, through its server, to provide users with a tailored experience within the site. Users are advised to take necessary steps within their web browser security settings to block all cookies from this website and its external serving vendors if they wish to deny the use and saving of cookies from this website to their computer’s/device’s hard drive. To learn more click Cookie Policy.

Manage consent preferences

These cookies are necessary for the website to function and cannot be switched off in our systems. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms. You can set your browser to block or alert you about these cookies, but some parts of the site will not then work. These cookies do not store any personally identifiable information.
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us to know which pages are the most and least popular and see how visitors move around the site. If you do not allow these cookies we will not know when you have visited our site, and will not be able to monitor its performance.
Cookies list
Name _rg_session
Provider rubygarage.org
Retention period 2 days
Type First party
Category Necessary
Description The website session cookie is set by the server to maintain the user's session state across different pages of the website. This cookie is essential for functionalities such as login persistence, ensuring a seamless and consistent user experience. The session cookie does not store personal data and is typically deleted when the browser is closed, enhancing privacy and security.
Name m
Provider m.stripe.com
Retention period 1 year 1 month
Type Third party
Category Necessary
Description The m cookie is set by Stripe and is used to help assess the risk associated with attempted transactions on the website. This cookie plays a critical role in fraud detection by identifying and analyzing patterns of behavior to distinguish between legitimate users and potentially fraudulent activity. It enhances the security of online transactions, ensuring that only authorized payments are processed while minimizing the risk of fraud.
Name __cf_bm
Provider .pipedrive.com
Retention period 1 hour
Type Third party
Category Necessary
Description The __cf_bm cookie is set by Cloudflare to support Cloudflare Bot Management. This cookie helps to identify and filter requests from bots, enhancing the security and performance of the website. By distinguishing between legitimate users and automated traffic, it ensures that the site remains protected from malicious bots and potential attacks. This functionality is crucial for maintaining the integrity and reliability of the site's operations.
Name _GRECAPTCHA
Provider .recaptcha.net
Retention period 6 months
Type Third party
Category Necessary
Description The _GRECAPTCHA cookie is set by Google reCAPTCHA to ensure that interactions with the website are from legitimate human users and not automated bots. This cookie helps protect forms, login pages, and other interactive elements from spam and abuse by analyzing user behavior. It is essential for the proper functioning of reCAPTCHA, providing a critical layer of security to maintain the integrity and reliability of the site's interactive features.
Name __cf_bm
Provider .calendly.com
Retention period 30 minutes
Type Third party
Category Necessary
Description The __cf_bm cookie is set by Cloudflare to distinguish between humans and bots. This cookie is beneficial for the website as it helps in making valid reports on the use of the website. By identifying and managing automated traffic, it ensures that analytics and performance metrics accurately reflect human user interactions, thereby enhancing site security and performance.
Name __cfruid
Provider .calendly.com
Retention period During session
Type Third party
Category Necessary
Description The __cfruid cookie is associated with websites using Cloudflare services. This cookie is used to identify trusted web traffic and enhance security. It helps Cloudflare manage and filter legitimate traffic from potentially harmful requests, thereby protecting the website from malicious activities such as DDoS attacks and ensuring reliable performance for genuine users.
Name OptanonConsent
Provider .calendly.com
Retention period 1 year
Type Third party
Category Necessary
Description The OptanonConsent cookie determines whether the visitor has accepted the cookie consent box, ensuring that the consent box will not be presented again upon re-entry to the site. This cookie helps maintain the user's consent preferences and compliance with privacy regulations by storing information about the categories of cookies the user has consented to and preventing unnecessary repetition of consent requests.
Name OptanonAlertBoxClosed
Provider .calendly.com
Retention period 1 year
Type Third party
Category Necessary
Description The OptanonAlertBoxClosed cookie is set after visitors have seen a cookie information notice and, in some cases, only when they actively close the notice. It ensures that the cookie consent message is not shown again to the user, enhancing the user experience by preventing repetitive notifications. This cookie helps manage user preferences and ensures compliance with privacy regulations by recording when the notice has been acknowledged.
Name referrer_user_id
Provider .calendly.com
Retention period 14 days
Type Third party
Category Necessary
Description The referrer_user_id cookie is set by Calendly to support the booking functionality on the website. This cookie helps track the source of referrals to the booking page, enabling Calendly to attribute bookings accurately and enhance the user experience by streamlining the scheduling process. It assists in managing user sessions and preferences during the booking workflow, ensuring efficient and reliable operation.
Name _calendly_session
Provider .calendly.com
Retention period 21 days
Type Third party
Category Necessary
Description The _calendly_session cookie is set by Calendly, a meeting scheduling tool, to enable the meeting scheduler to function within the website. This cookie facilitates the scheduling process by maintaining session information, allowing visitors to book meetings and add events to their calendars seamlessly. It ensures that the scheduling workflow operates smoothly, providing a consistent and reliable user experience.
Name _gat_UA-*
Provider rubygarage.org
Retention period 1 minute
Type First party
Category Analytics
Description The _gat_UA-* cookie is a pattern type cookie set by Google Analytics, where the pattern element in the name contains the unique identity number of the Google Analytics account or website it relates to. This cookie is a variation of the _gat cookie and is used to throttle the request rate, limiting the amount of data collected by Google Analytics on high traffic websites. It helps manage the volume of data recorded, ensuring efficient performance and accurate analytics reporting.
Name _ga
Provider rubygarage.org
Retention period 1 year 1 month 4 days
Type First party
Category Analytics
Description The _ga cookie is set by Google Analytics to calculate visitor, session, and campaign data for the site's analytics reports. It helps track how users interact with the website, providing insights into site usage and performance.
Name _ga_*
Provider rubygarage.org
Retention period 1 year 1 month 4 days
Type First party
Category Analytics
Description The _ga_* cookie is set by Google Analytics to store and count page views on the website. This cookie helps track the number of visits and interactions with the website, providing valuable data for performance and user behavior analysis. It belongs to the analytics category and plays a crucial role in generating detailed usage reports for site optimization.
Name _gid
Provider rubygarage.org
Retention period 1 day
Type First party
Category Analytics
Description The _gid cookie is set by Google Analytics to store information about how visitors use a website and to create an analytics report on the website's performance. This cookie collects data on visitor behavior, including pages visited, duration of the visit, and interactions with the website, helping site owners understand and improve user experience. It is part of the analytics category and typically expires after 24 hours.
Name _dc_gtm_UA-*
Provider rubygarage.org
Retention period 1 minute
Type First party
Category Analytics
Description The _dc_gtm_UA-* cookie is set by Google Analytics to help load the Google Analytics script tag via Google Tag Manager. This cookie facilitates the efficient loading of analytics tools, ensuring that data on user behavior and website performance is accurately collected and reported. It is categorized under analytics and assists in the seamless integration and functioning of Google Analytics on the website.

A Brief Guide to Moving from PHP to Ruby

  • 17959 views
  • 17 min
  • Feb 21, 2019
Gleb B.

Gleb B.

Copywriter

Vlad V.

Vlad V.

Chief Executive Officer

Share

PHP has long been among the top programming languages in popularity rankings. It has lots of advantages, from a low barrier to entry to a huge and well-developed ecosystem. For this reason, lots of newcomers to the world of programming opt for PHP, and you may be one of them.

Yet if you’re reading this article, you’re likely considering switching to a different software development technology and Ruby is on your shortlist. Just like PHP, Ruby is a high-level object-oriented programming language that allows developers to implement web applications of any complexity. But is the shift from PHP to Ruby worth it? Definitely yes. Ruby stands out from other programming languages due to its unique philosophy. Unlike other technologies, it’s created to help developers feel happy about their work.

If you aren’t familiar with Ruby and its developer happiness first philosophy seems far-fetched, this article is for you. We consider the main advantages of this programming language and provide a road map to help PHP developers quickly learn Ruby and related software development technologies.

Popular Programming Languages

Key strengths of Ruby

As a PHP developer, you know well the advantages and disadvantages of PHP, so there’s no point mentioning them in this article. Besides, what may seem like a significant drawback to you may actually be a plus in the eyes of another programmer. So let’s move to Ruby right away.

Experienced Ruby developers can praise their favorite language for ages. To cut a long story short, we’re going to draw your attention to the aces Ruby has up its sleeve. Let’s delve in!

#1 Developer happiness first

When Yukihiro “Matz” Matsumoto was designing Ruby, he set a goal to make software developers happy. In Matz’s opinion, a person is happy if they can do their job quickly and while having some fun. So he decided to create a programming language that would be both comfortable and intuitive for developers while allowing them to be productive:

Developer Happiness Matz's Quote

Ruby features an elegant syntax that highly resembles natural human speech. This makes it much easier for developers (and even for non-technical people) to understand code in Ruby compared to code in less intuitive programming languages. To prove this point, take a look at these examples:

This short code snippet prints Hello, world! five times, and even a person with no programming background is likely to understand what it does. Now check out code that does the same thing in PHP:

Compare the two examples above. The majority of developers (regardless of the programming language they work with) will agree that the Ruby syntax is more readable and intuitive.

Simple and concise code is not only easier to write but also to check, meaning developers can be more productive. The syntax significantly speeds up development and maintenance of applications written with Ruby.

Another awesome aspect of the Ruby programming language is its pure object-oriented nature: everything is an object in Ruby. All data structures are objects and, therefore, you can manipulate them accordingly. To show you how this works, imagine you need to count the number of characters in a phrase. Here’s how to do it in PHP:

Now the same code in Ruby:

Take a look at these examples and perhaps you’ll agree that the Ruby code is easier to understand.

#2 Ruby’s synergy

Now let’s focus on frameworks.

There are a bunch of PHP frameworks that follow the Model–View–Controller (MVC) architectural pattern. Here are the most popular:

Major MVC Frameworks in PHP

A variety of frameworks seems to be an advantage for a programming language, but let’s look at the issue from a different angle. All MVC frameworks for PHP listed above serve the same purpose − they help create modern web and mobile applications. The PHP community thus needs to support a variety of frameworks that are quite similar in terms of the tasks they solve.

The situation is different in Ruby − instead of scattering efforts on supporting several identical tools, the community focuses on supporting frameworks that solve different problems. For example, when the community decided to merge Merb and Ruby on Rails, the two MVC frameworks served the same purpose. As a result of this merger, the Ruby on Rails 3 framework was created and the community focused solely on it.

In fact, whenever you hear the word “Ruby,” it’s the Ruby on Rails framework that probably comes to mind. Yet there are other Ruby frameworks that serve different purposes:

Frameworks in Ruby

Ruby on Rails for startups

Created in 2005 by David Heinemeier Hansson (known as DHH in the community), Ruby on Rails has become a cornerstone of the whole Ruby ecosystem. It’s the dominant Ruby framework, and knowing it is a must for any Ruby developer.

Ruby on Rails is a great tool for technology startups as it enables programmers to speed up development. Ruby on Rails provides a lot of solutions to common problems developers face when implementing a web application. Instead of writing excess code, Ruby programmers can focus on proper implementation of an application’s business logic.

Ruby on Rails relies on a large number of skilled developers that support it and keep it up to date. There are over 3,600 Ruby on Rails contributors on GitHub, which is more than twice as many as the PHP Symfony framework has. The numbers speak for themselves!

Sinatra for implementing a service-oriented architecture (SOA)

Sinatra (together with its offspring Padrino) is a framework and a domain-specific language in Ruby for building web services. While Rails is tailored for developing monolithic applications, Sinatra allows programmers to create web servers and build SOA applications.

When a monolithic application built with Ruby on Rails becomes too big, it becomes reasonable to scale it by splitting the application into several web services. Ruby developers can easily do this with the help of Sinatra.

Hanami for building enterprise applications

Hanami (formerly known as Lotus) is a fully featured architecturally sound Ruby framework that follows the Clean Architecture approach. Thanks to this approach, developers can easily scale a Ruby application built with Hanami regardless of its functional complexity and the number of developers on the project.

The modular structure of Hanami allows Ruby developers to add new functional modules to applications quickly and safely. This makes Hanami an excellent choice for building enterprise applications in which stable performance and high development speed are crucial.

#3 Ruby gems

For many developers, the best component of the Ruby ecosystem is the gems or, in other words, open-source libraries that allow developers to easily expand the functionality of any application written in Ruby. Programmers don’t need to write code from scratch; instead, they can simply select a relevant gem and use it. Gems make programmers’ work easier and significantly speed up development.

Now you might be asking, So what? There are scores of similar libraries in PHP and other programming languages. What makes Ruby special? It’s all about flexibility. For example, lots of PHP libraries are compatible only with a specific framework, which considerably restricts their usability. In Ruby, gems are compatible with any framework, be it Ruby on Rails, Sinatra, or Hanami.

Top Five Ruby Gems

At an early stage of development of the Ruby ecosystem, developers understood the necessity to ensure the compatibility of gems. To make sure gems were compatible, the community created RubyGems − a package manager for the Ruby programming language that’s included in the standard Ruby on Rails package.

RubyGems provides a standard format for managing and distributing open-source libraries written in Ruby. It allows developers to install gems with relevant dependencies. The tool integrates with the Ruby runtime loader and automatically installs required gems. Moreover, RubyGems manages dependencies and downloads the version of a gem that’s compatible with a specific Ruby application.

RubyGems works as a command-line tool called gem. To install a gem, a Ruby developer simply types its name after gem install in the command line:

So far, the Ruby community has developed almost 150,000 gems. There are gems for anything: authentication, payments, content management systems, you name it. Think what functionality you need to implement and there’s certainly a gem that will help you.

Take a look at a brief list of functionalities that you can easily implement with the help of Ruby gems:

Ruby Gems for Any Purpose

#4 Focus on code quality

The Ruby community puts a strong emphasis on code quality. You could even claim that Ruby developers are obsessed with delivering high-quality code. In our opinion, the very philosophy of developer happiness means that developers should be able to do their job well and, naturally, write good code.

Before moving on, it’s important to get a clear understanding of what code quality means.

  • Reliability − The software needs to be reliable and predictable to be capable of solving the problems of end users.
  • Readability − Quality code is easy to read and easy for other programmers to understand.
  • Maintainability − A good codebase is easy to maintain and update.

High code quality is not only a prerequisite for building fully functional applications; it also facilitates their maintenance and reduces technical debt. In Ruby, writing quality code doesn’t take a rocket scientist and doesn’t require years of experience. There are plenty of tools in the Ruby ecosystem that help programmers ensure code quality.

Here are the most important tools for:

General code analysis

Ruby developers use multiple software development practices that help them write A-level code. For example, programmers remove business logic and finders out of the MVC framework. Yet making sure such practices are followed can be difficult. To mitigate this issue, the Ruby community uses a variety of code metric tools, such as rails_best_practices.

Detecting code smells

Code smells (such as bloaters or couplers) are indicators of deep-rooted problems in a codebase that can result in serious problems. Developers need to detect and remove them before the codebase is deployed to production. Ruby programmers can easily do this with the help of such gems as Reek.

Test automation

Sometimes developers may neglect to write automated tests, but it’s an integral part of the software development process in the Ruby community. There’s no need to emphasize the importance of automated tests for code quality, and the Ruby ecosystem boasts a rich tool set for test automation:

  • Testing frameworks, such as RSpec and Cucumber, allow Ruby developers to write automated tests, while Capybara lets them create acceptance tests.
  • Test data generators, such as faker and factory-bot, enable Ruby developers to easily create test data to run automated tests against.

Test coverage

Test coverage is the major metric for assessing the code quality of software applications. In the Ruby ecosystem, there are lots of tools (like SimpleCov) that help you find out the test coverage in your application and add more automated tests if needed.

Static code analysis

In order to write code that’s easy to read and easy for other developers to understand, programmers should follow certain rules, formats, and styles. All of them are included in the Ruby style guide, and to help developers write better code, the community has created multiple gems for static code analysis (such as RuboCop).

Apart from checking that code follows the guidelines, Ruby developers can easily check a codebase for structural similarities with the help of Flay.

Code debugging

No matter how proficient and experienced you are, bugs are inevitable. So it’s essential to be able to track them down and fix them. The Ruby ecosystem has lots of debugging tools (such as Pry) as well as utilities that display detailed error pages (such as Better Errors) and, consequently, facilitate bug fixing.

#5 Focus on application security

Application security is the priority for software developers. A vulnerable application is likely to fall victim to hacking or theft of sensitive information, which means reputational and financial losses for business owners.

The Ruby community has developed plenty of tools to detect and root out application vulnerabilities. Such tools as Brakeman help developers scan their applications for vulnerabilities, while the bundler-audit library allows them to detect vulnerable versions of gems.

When it comes to security, it’s better safe than sorry. There are also third-party security assessment services such as CodeClimate that Ruby developers can use.

#6 Mature community

Two eyes see better than one.

You can be an exceptionally gifted developer, but it’s much better to rely on a proficient and skilled community. Let’s find out how different the PHP and Ruby communities are.

As mentioned above, PHP is one of the most popular programming languages in the world, so it’s no wonder there’s a large community of PHP developers. Yet the relatively low barrier to entry of PHP means there are lots of novices in the community, so the size doesn’t match the quality: there are many immature coders.

In Ruby, the situation is different. The community is smaller in size but comprises mostly professionals who know Ruby up and down. Keep in mind that Ruby is typically the second programming language for developers. It’s no wonder the community is extremely active and productive. According to the The State of the Octoverse 2017 report by GitHub, Ruby outpaces PHP in terms of pull requests per year (870,000 versus 559,000, respectively).

There’s another positive aspect about a higher level of experience in the Ruby community − salaries. Needless to say, professionalism should be paid accordingly, and the average Ruby developer is paid more than the average PHP developer:

Developer Salaries in US PHP vs Ruby

That’s exactly what David Heinemeier Hansson (the creator or the Ruby on Rails framework) meant in this tweet:

DHH Quote

#7 Powerful metaprogramming capabilities

Metaprogramming is a technique of writing code-generating computer programs. In other words, metaprogramming allows developers to create code that can on its own read, generate, analyze, and transform other code or even itself during runtime.

This programming technique helps developers write testable, reusable, and flexible code that corresponds to the DRY (don’t repeat yourself) design principle. Also, metaprogramming substantially speeds up development, allowing Ruby developers to spend several minutes accomplishing tasks that usually take hours if implemented in other programming languages.

A roadmap to moving from PHP to Ruby

Already eager to transition from PHP to Ruby? If your answer is yes, you might be asking how to do it. There are scores of video tutorials, courses, books, and forums about Ruby, but choosing the most efficient can be a problem. We decided to help out by drawing up a shortlist of the best resources that will help you become a high-level Ruby programmer.

Step #1 Learn the basics of Ruby

When learning any new subject you should start from the basics. So if you’re interested in studying (and, hopefully, mastering) Ruby, you should start from the very beginning. There are plenty of guides and books about coding in Ruby, and here are some of the most popular:

  • Learn Ruby the Hard Way, a step-by-step guide to learning Ruby that’s comprised of 52 practical exercises. This book provides you with the necessary skills and tools so that you can move to more complex programming topics.
  • Ruby Essentials, a free brief guide to the basics of Ruby.
  • Why’s (Poignant) Guide to Ruby, an offbeat approach to learning Ruby based on stories and comics.

If you’re already familiar with the basics of Ruby but still have questions, make sure to check the official Ruby FAQ.

This document has been edited with the instant web content converting tool which can be found at htmleditor.tools - give it a try.

Step #2 Study Ruby frameworks

After learning the basics of Ruby, you can move to frameworks. To create top-notch applications in Ruby, you need to know:

Web application frameworks

First of all, you need to master web application frameworks in Ruby. Most developers study only Ruby on Rails, but if you want to become an expert, you should also be able to use other web application frameworks:

Ruby on Rails

Sinatra

Hanami

Testing frameworks

Writing quality code involves a lot of testing, so if you decide to transition from PHP to Ruby, you need to learn testing frameworks, meaning RSpec and Cucumber:

Business logic framework

Writing functional and bug-free code is crucial, but it’s equally important to structure it properly. Trailblazer, a powerful business logic framework, helps programmers efficiently structure the business logic in Ruby applications. Apart from Ruby on Rails, Trailblazer can be used with other web application frameworks (Sinatra and Hanami).

Trailblazer is growing popular in the Ruby community, so if you want to become a skilled developer, you should know how to apply this business logic framework. Here are some handy resources you can opt for:

Step #3 Enhance your skills in Ruby development

As you gain experience in Ruby development, you should enhance your coding skills to build more maintainable, scalable, and reliable applications. Here are some useful books that will provide you with the necessary knowledge:

Step #4 Interact with the Ruby community

Finally, don’t forget that a large and skilled community is one of Ruby’s most notable advantages. You can always interact with the community to get help or to learn new things about Ruby and its ecosystem.

Here’s a brief list of resources that will help you interact with the community:

Platforms

  • Stackoverflow − a popular website where you can ask questions and get answers from Ruby developers
  • GitHub − the world’s leading software development platform where you can not only download gems but also interact with fellow Ruby programmers
  • Reddit − one more popular platform where you can keep track of the latest news in the world of Ruby

Screencasts

  • Go Rails − informative paid screencasts about Ruby on Rails
  • Ruby Tapas − short screencasts that help you pump up your Ruby development skills
  • Drifting Ruby − paid tutorials about Ruby development

Podcasts

  • The Bike Shed − listen to opinions and recommendations from renowned Ruby developers
  • Ruby Rogues − interesting discussions about Ruby, Rails, JavaScript, and related software development technologies
  • The Ruby Testing Podcast − learn more about testing in Ruby

Final thoughts

Now you realize what’s so special about Ruby: it’s a language created to make developers happy. Moving from PHP to Ruby can be a great solution if you want to be productive and participate in interesting and challenging projects. If that’s what you want, then Ruby is the perfect choice.

If you want to stay updated on the latest news about Ruby, subscribe to our blog.

CONTENTS

Authors:

Gleb B.

Gleb B.

Copywriter

Vlad V.

Vlad V.

Chief Executive Officer

Rate this article!

Nay
So-so
Not bad
Good
Wow
5 rating, average 4.6 out of 5

Share article with

Comments (2)
Thai Nguyen
Thai Nguyen over 5 years ago
Nice post, its very useful!
Reply
Anastasia Z.
Anastasia Z. over 5 years ago Thai Nguyen
Hi there! Thanks for your kind feedback ;)
Reply

Subscribe via email and know it all first!