Backend to the Future I — Rails
Frameworks are made of a series of components, including programs, compilers, libraries, toolsets, and APIs. Creating a framework is generally to facilitate the standard and efficient creation of a certain kind of software application.
My objective here is to breakdown a backend framework into its pieces to explain their purposes at a high level (Each component is likely to be worthy of its own blog post). It is my goal that by the end of this article, you will both be able to read through release notes and accurately gauge the relevance of the changes to your projects on your own, and to have the ability to add or remove the pieces you don’t need, for your current project, off the bat, and with no consequence.
The framework I will be taking apart for this post is Ruby on Rails (v5.2.4.4):
Action Cable — Can seamlessly integrate Websockets into your app and is used for real-time features such as a chat feature.
Action Mailbox — Routes incoming emails to controller-like mailboxes for processing in Rails. The inbound emails are turned into InboundEmail records using Active Record. Storage of the original email on cloud storage is handled via Active Storage. The inbound emails are routed asynchronously using Active Job.
Action Mailer — allows you to send emails from your application using mailer classes and views.
Action Pack — is a framework that provides the view and controller layers of Rails. It consists of two modules:
- Action Dispatch — responsible for routing, handling POST, PATCH, PUT parameters, cookies, and sessions.
- Action Controller — used to create filters and actions to handle requests.
Action Text — brings rich text content and editing to Rails using the Trix editor.
Action View — looks up and renders your views. Provides view helpers that assist with HTML forms and such. Template formats include ERB and XML Builder.
Active Job — a framework for declaring jobs. Jobs can be made to be anything from regularly scheduled clean-ups to billing charges to mailings.
Active Model — is a library containing various modules used in developing classes that need some features present on Active Record.
Active Record — library responsible for models, model association, and the naming convention used when associating those models.
Active Storage — for uploading and referencing files in cloud services and can attach those files to Active Records.
Active Support — library of useful utility classes and library extensions.
Railties — Rails core.
.rubocop.yml — Configuration file for Rubocop gem. You can go here to enable or disable linting rules for Rubocop. You will need to create this file.
Gemfile — gems installed from “https://Rubygems.org by default and the default git_source (where the GitHub dependencies are pulled from) is https://github.com/{repo}.git.
Gemfile/
- rake — a gem for automating building processes and the execution of programs and libraries (Ruby Make.. Rake). Mostly used for utility (rake — tasks for more info).
- capybara — used to perform tests on your web application. It can be configured to work with other tests.
- selenium-webdriver — used by capybara to use Selenium automated web app tests.
- rack-cache — middleware that enables HTTP caching in rack-based applications.
- sass-rails — allows for Rails integration of the Sass preprocessor.
- turbolinks — enables navigation to another page without a full page reload.
- webpacker — primarily used for Javascript in Rails.
- bcrypt — used for hashing passwords.
- uglifier — allows UglifyJS wrapper to be used in Rails for Javascript compression.
- JSON — Rails implementation of JSON according to RFC 7159 JSON standards.
- rubocop — Ruby style guide.
- rubocop-packaging — for Rubocop compatibility. This is updated as Rubocop standards evolve.
- rubocop-performance — Rubocop extension that checks the performance of Ruby code.
- rubocop-rails — rails style guide.
- sdoc — document generator, click the link, for example.
- redcarpet — markdown processing.
- w3c_validators — Ruby wrapper for w3c online validation services.
- kindlerb — a Kindle periodical-format ebook.
- rouge — Ruby syntax highlighting.
- dalli — a pure Ruby client for accessing memcached servers.
- listen — listens to file modifications and notifies you about the changes.
- libxml-ruby — provides Ruby language bindings for GNOME’s Libxml2 XML toolkit.
- connection_pool — used for Ruby network connections.
- rexml — used to parse XML files.
- bootsnap — optimizes and caches expensive computations.
- resque — used to create, distribute, and queue background jobs. Background jobs can be any Ruby class or module that responds to perform.
- resque-scheduler — used, on top of resque, to schedule background jobs.
- sidekiq — a framework for background processing.
- sucker_punch — asynchronous processing library.
- delayed_job — used to execute tasks as a background process.
- queue_classic — queueing library for Ruby apps.
- sneakers — a framework for background processing.
- que — ensures that jobs you queue are performed exactly once with a focus on reliability.
- backburner — used to queue very high volumes of background jobs.
- delayed_job_active_record — ActiveRecord backend for delayed_job.
- sequel — database toolkit for Ruby.
- puma — a ruby web server built for concurrency.
- hiredis — primarily used to speed up parsing multi bulk replies.
- redis — in-memory data structure store, used as a database, cache, and message broker.
- redis-namespace — provides an interface to a namespaced subset of your redis keyspace. This would be used when using a single instance of redis with multiple, different applications. Requires redis.
- websocket-client-simple — websockets for Ruby.
- blade — a sprockets toolkit for building and testing Javascript libraries.
- blade-sauce_labs_plugin — blade plugin for Sauce Labs.
- sprockets-export — sprockets directive for UMD-style JavaScript module definitions.
- aws-sdk-s3 — for Amazon Simple Storage Service. Part of the AWS SDK for Ruby.
- google-cloud-storage — for Google Cloud Platform services.
- azure-storage-blob — used to access and manage Microsoft Azure Storage Services.
- image_processing — used to process uploaded images with the ImageMagick/GraphicsMagick or libvips libraries.
- aws-sdk-sns — for Amazon Simple Notification Service. This gem is part of the AWS SDK for Ruby.
- webmock — library for stubbing and setting expectations on HTTP requests in Ruby.
- qunit-selenium — Ruby Qunit test runner for Selenium WebDriver.
- webdrivers — automatic installation and updates for Selenium webdrivers.
- minitest-bisect — used to diagnose random test failures.
- minitest-retry — rerun the test when the test fails.
- minitest-reporters — used to extend minitest.
- stackprof — call-stack profiler for Ruby.
- byebug — is a Ruby debugger. It provides breakpoint handling and bindings for stack frames.
- benchmark-ips — benchmarks a block’s iterations/second. You can also figure out how many times to run the code to get interesting data.
- nokogiri — is an HTML, XML, SAX, and Reader parser.
- racc — is an LALR(1) parser generator.
- sqlite3 — allows Ruby to interface with the SQLite3 engine.
- pg — allows Ruby to interface with PostgreSQL.
- mysql2 — MySQL library for Ruby — binding to libmysql.
- activerecord-jdbcsqlite3-adapter — Sqlite3 JDBC adapter for JRuby on Rails. Part of ActiveRecord JDBC Adapters.
- activerecord-jdbcmysql-adapter — MySQL JDBC adapter for JRuby on Rails. Part of ActiveRecord JDBC Adapters.
- activerecord-jdbcpostgresql-adapter — Postgres JDBC adapter for JRuby on Rails. Part of ActiveRecord JDBC Adapters.
- psych — is a YAML parser and emitter.
- ruby-oci8 — Ruby interface for Oracle using OCI8 API.
- activerecord-oracle_enhanced-adapter — provides useful methods for working with new and legacy Oracle databases.
- tzinfo-data — public domain IANA Time Zone Database packaged as a set of Ruby modules for TZInfo.
- wdm — can be used to monitor directories for changes on Windows.
- Rakefile — a place to define tasks to be used by rake.
For the categories chosen here, I used https://github.com/rails/rails as a list. The idea was to provide the highest level description of each so one could briefly glance at the list and find the piece they need to fit their Ruby puzzle.
Having said that, some of the nuances are lost in these descriptions and so it may seem, by simply reading through the list, that there are multiple items that seem to achieve the same goal. In this case, I can guarantee that one of those similar items will be a superior option to the other for your use case and you should look further into both to find this superior option.
To that end, each item is linked to either their rubygems.org page, their Github repository, or the docs for that item. Whichever I thought most immediately conveyed the purpose of the item.
Lastly, I don’t have a background in computer science, so if I thought that even the explanation of something was convoluted I included additional resources to clarify. It was enlightening, for instance, to learn what an HTTP cache was but I had to look that one up.
If you see that any of my descriptions are misleading or incorrect, please let me know in the comments or message me. I would appreciate that very much as I like to learn at least one new thing each day and in this instance, you will be my teacher. I would also be happy to try to clarify any questions.
Cheers,
Corey Lynch