Originally this post was published on Syndicode blog.
Despite I hate word 'guide', I catch myself on trying to submit every new article as a guide. I want it to be complete and consist as many useful knowledge as I can fit in it. I hope, this time it wasn't too much.
Here we go! Let's start with some general information.
Facts about Ruby (peculiarities)
- In 2018 Ruby obtained the 5th place among 23 most wanted programming languages to learn next by developers.
- Ruby allows you to write a clean code with minimal syntactic and semantic 'noise', offers many libraries to implement a variety of functionalities and supports such aspects as object-oriented programming (OOP), dynamic typization and metaprogramming. Why is this important?
- OOP Most entities in Ruby, including logical, numeric, and string literals, and some elemental entities can be recreated as objects and methods. This approach makes it easy to design complex systems and scale them without duplication of code.
- Dynamic typization In dynamic typization, type validation is performed during the execution of the program, and not during compilation. This allows Ruby developers to simplify the writing of small scripts and macros. They can reuse variables, develop more flexible and easier frameworks and create applications in a more convenient way.
- Metaprogramming Metaprogramming allows you to create software code and libraries that other developers can reuse and easily customize according to the needs and tasks to solve. Going into metaprogramming, developers can create DSL - Domain-Specific Languages for solving complex tasks within specific industries. DSL allows high-level professionals like system administrators to work with and make changes to software.
- In the Ruby ecosystem, the standards of writing and structuring code are approved by the global community of devs and recorded in the Ruby style guide. (Rails style guide is approved as well). A great example of effective standardization in Ruby — libraries and tools creation mechanism called Gems (more than 140K of them available). All the Ruby libraries have the same structure and are stored in a single repository — Ruby Gems. This determines the speed of obtaining the necessary libraries and the ability to easily navigate the new tools. The Ruby ecosystem offers a complete toolkit for testing (RSpec, Capybara, and Cucumber). Also, Ruby pays much attention to checking how the code conforms to the norms and standards (RuboCop, SimpleCov, RubyCritic, Rails_best_practices).
- Active and enthusiastic Ruby community supports many large-scale conferences all over the world.
Ruby on Rails (RoR) is not the only Ruby framework, but it is the most popular and therefore it is worthy of special attention. Rails helped the plethora of nice projects to become alive. Ruby on Rails relies on convention to write less code and avoid repeating. This is the open source framework, open and free to use even for commercial purposes. The Ruby community has created useful open source solutions, using which developers can easily build from scratch fully functional applications that meet safety requirements and are effective as from the point of view of expenses, so as from the point of view of development.
- Rails for startups. With Ruby on Rails, startups can find a lot of answers to a problem they only think they might face. You’re likely to find hundreds of items on any given topic. All the patterns or structures you can desire already exist, you have just to configure something – and voila! This is great for rapid prototyping. A small team can get a minimum viable product into beta very quickly using tools that are fun to work with. In the US, Rails is the most wanted framework for startups.
- Rails for enterprises. When you run a huge business, flexibility is among first priorities. The trick is in the availability of Rails developers. Developer you need is right here before you. Because Ruby is elegant and easy to start it has a huge ecosystem and plugins for every possible need. The new generation of programmers loves it. Developers can jump in and start coding immediately.
Using Ruby and Ruby on Rails you can create and customize many great solutions!
You can use the next ones:
- Compass, bonsaiERP for ERP systems;
- Fat Free CRM for CRM Systems;
- Redmine, GitLab, OpenProject, Hours, Travis CI for project management;
- Discussion platform - Discourse;
- Open Source Billing for financial management;
- Spree, Solidus, Sharetribe for e-commerce platforms;
- Refinery CMS, Locomotive CMS, Spina CMS for content management.
- Ruby on Rails;
- Sinatra is a service-oriented framework;
- Hanami - relatively new framework that is focused on enterprises.
The best of available Ruby tools
- RSpec — BDD-framework;
- Capybara — acceptance test framework for web applications;
- Cucumber — BDD that talks to domain experts first and code second;
- Minitest — a library for unit-tests, a simpler analog of RSpec;
- Shoulda-matchers — additional matcher-methods for RSpec.
- Factory_bot — for setting up Ruby objects as test data;
- Faker — a library for creating test data;
- WebMock — for stubbing and setting expectations on HTTP requests;
- Selenium WebDriver — Ruby bindings for WebDriver.
- RuboCop — a static code analyzer, based on the community Ruby style guide;
- Simplecov — Code coverage for Ruby 1.9+;
- RubyCritic — a Ruby code quality reporter;
- Rails_best_practices — a tool to check Ruby code quality.
- Warden — General Rack Authentication Framework;
- Devise — a flexible authentication solution for Rails based on Warden;
- JWT — JSON Web Token standard implementation for Ruby;
- Doorkeeper — an OAuth2 provider for Rails;
- OAuth2 — a Ruby wrapper for the OAuth 2.0 protocol;
- CanCanCan — continuation of CanCan, an authorization Gem for Ruby on Rails.;
- Pundit — CanCanCan lightweight alternative.
- ActiveModel::Serializers — JSON generation tool for the Rails app;
- GraphQL-Ruby — Ruby implementation of GraphQL;
- Grape — a micro-framework for creating REST-like APIs in Ruby;
- Apipie — documentation management API;
- Swagger — this gem provides an autogenerated documentation for your Grape API.
- Dry-rb — a collection of Ruby libraries intended to encapsulate a common task, it allows you to program in Ruby in functional programming style;
- Trailblazer — a framework that enforces encapsulation, an intuitive code structure and gives you an object-oriented architecture;
- Interactor — allows business-logic structuring.
- Sass and Less — leaner CSS assets;
- Asset_sync — synchronizes Assets between Rails and S3;
- Autoprefixer — automatically adds CSS-props for a better cross-browser experience.
- Puma — a modern, concurrent web server for Ruby.
- Unicorn — Rack HTTP server for fast clients and Unix.
- Chef or Puppet — infrastructure orchestrating tools;
- Capistrano — a remote server automation and deployment tool written in Ruby;
- Vagrant — create and configure lightweight, reproducible, and portable development environments;
- Backup — DSL in Ruby for performing backups on UNIX-like systems.
Environment and package management + assets
- RVM — CLI that allows to easily install, manage, and work with multiple Ruby environments from interpreters to sets of gems;
- RubyGems — Ruby libraries repository;
- Bundler — application's gem dependencies manager.
- HTTParty — convenient way to work with HTTP-requests;
- Faraday — an HTTP client library that provides a common interface over many adapters and embraces the concept of Rack middleware when processing the request/response cycle;
- GraphQL-client — a lib to work with GraphQL requests.
- MiniMagick — a Ruby wrapper for ImageMagick or GraphicsMagick command line;
- Streamio FFMPEG — a wrapper for FFMPEG utility for reading metadata and transcoding movies.
Queues and Messaging
- Sidekiq or Resque — background processing frameworks for Ruby;
- Delayed_job — Database backed asynchronous priority queue; this tool was taken out of Shopify;
- Foreman — Manage Procfile-based applications;
- Whenever — A Ruby gem with a clear syntax for writing and deploying cron jobs.
- Elasticsearch-ruby — Ruby integrations for Elasticsearch;
- Mongoid Search — a full-text search implementation for Mongoid;
- Pg_search — builds ActiveRecord named scopes that take advantage of PostgreSQL's full-text search.
- ActiveAdmin or RailsAdmin — RoR frameworks for creating backends for website administration;
- RefineryCMS — an open source content management system for Rails 3 and 4;
- Publify — CMS platform;
- Gollum — Git-based library for wiki-system realization;
- Jekyll or Middleman — platforms for static sites and blogs building.
- RubyMotion — a toolchain that lets you quickly develop and test full-fledged native iOS and OS X applications for iPhone, iPad, Mac, and Android;
- Ruboto — a platform for developing full stand-alone apps for Android;
- Ruby Push Notifications — iOS, Android and Windows Phone Push notifications.
- Machine-learning-with-ruby — resources for machine learning in Ruby.
- ai4r — A Ruby playground for AI researchers.
And the many more neat tools. Find them all in 'Awesome Ruby' collection.
Ruby key limitations
There's nothing perfect in this world. And every nice thing has its drawbacks. So as Ruby. But, thank God, there are only a few of them! (According to my own opinion, of course).
- Performance. Despite the high speed of development, Ruby demonstrates not the highest performance. On the one hand, Ruby performs many operations for the convenience of the developer, including managing memory for dynamic typing. On the other hand, of course, the volume of such operations affects the speed of execution. This criterion is not the most problematic, but it could be better.
- Ruby multithreading is slow. Ruby's multithreading algorithm is somewhat unpredictable: it can switch from one thread to another at any time and it is difficult to predict or control. This affects the result of processing data and making changes and, in general, the speed of the entire process. At the moment, Ruby community is working on this issue.
Ruby for beginners
- Books and tutorials to learn and master Ruby;
- Ruby interesting facts and learning process;
- Useful Ruby/Rails regular email newsletters
- Podcasts and screencasts
- Online-courses on Ruby
- Python and PHP are the main Ruby competitors on the market.
- Ruby features cover the full range of different functionalities, including mobile development and industries such as ML, robotics and AI. The arsenal of Ruby tools expanding and getting better every day.
- At the moment, over 1 million web platforms are relying on Rails ecosystem that remains one of the best and most desirable for startups.
- Open source Rails - a library with recently added, recently started, most starred on GitHub, and last active Rails open source repositories.
- Ruby Gems - all Ruby Gems from A to Z.
- ‘Awesome Ruby’ collection of libraries, tools, frameworks, and software. Abstractions, assets, caching, cloud, CRM, encryption and more…
- Ruby Guide by Volodymyr Vorobiov - this article inspired me to collect all we know about Ruby and share it as well.
- Most popular Ruby Gems of all the time.
- Ruby toolbox with open source Ruby libraries.
I hope that was useful!
If you have something to add, I'll be happy to hear your thoughts!