<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Pratha Avashia</title>
    <description>The latest articles on DEV Community by Pratha Avashia (@pratha_avashia).</description>
    <link>https://dev.to/pratha_avashia</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F375874%2F118655b2-f713-4d20-a498-e4ea58f93c48.png</url>
      <title>DEV Community: Pratha Avashia</title>
      <link>https://dev.to/pratha_avashia</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pratha_avashia"/>
    <language>en</language>
    <item>
      <title>Why Ruby on Rails is still a good choice in 2020</title>
      <dc:creator>Pratha Avashia</dc:creator>
      <pubDate>Mon, 07 Sep 2020 05:42:46 +0000</pubDate>
      <link>https://dev.to/solutelabs/why-ruby-on-rails-is-still-a-good-choice-in-2020-i1a</link>
      <guid>https://dev.to/solutelabs/why-ruby-on-rails-is-still-a-good-choice-in-2020-i1a</guid>
      <description>&lt;p&gt;We at SoluteLabs love meddling around with tech, especially if it’s something fresh off the oven like Flutter. Here, we were sitting around on a Wednesday noon, playing truth or dare and passing the 8-ball around, when one of our developers posed the question:&lt;/p&gt;

&lt;p&gt;Which is your favourite application development framework?&lt;/p&gt;

&lt;p&gt;Okay, this might not be as exciting as saying, “How many tequila shots can you down at one go before passing out?” but these are developers we are talking about.&lt;/p&gt;

&lt;p&gt;The answers came quickly.&lt;/p&gt;

&lt;p&gt;Django. Ruby on Rails. Laravel. Ruby. Symfony. RoR.. and so on.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1440%2F0%2Ai86hx4vKfUYKNVJ5" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1440%2F0%2Ai86hx4vKfUYKNVJ5" alt="Why Ruby on Rails is still a good choice in 2020" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ruby on Rails won this popularity contest, despite being one of the oldest technologies on the list.&lt;/p&gt;

&lt;p&gt;Interest in Ruby on Rails has been waining, this much we know, but the technology still seems to be popular among hardcore developers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F960%2F0%2AWEChm4PMg9HpOpSc" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F960%2F0%2AWEChm4PMg9HpOpSc" alt="Ruby on rails(RoR) Google Trends" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see, the graph has flatlined over the past year, and considering the fact that RoR is more than two and a half decades old, this is quite an achievement.&lt;/p&gt;

&lt;p&gt;To put things into perspective, we have almost forgotten about Psy’s Gangnam style song, which is just eight years old!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F960%2F0%2AN7E00DeXqFsHy07Z" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F960%2F0%2AN7E00DeXqFsHy07Z" alt="Psy’s Gangnam style song gif" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;a href="https://giphy.com/gifs/vevo-gangnam-style-psy-oppa-nYI8SmmChYXK0" rel="noopener noreferrer"&gt;Image credit&lt;/a&gt;



&lt;p&gt;So we did a deep dive to see what keeps this RoR engine ticking, and found the key reasons why developers still feel using the technology will lead to RoaRing success (pun intended).&lt;/p&gt;

&lt;p&gt;Here are our top seven picks:&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Ruby is highly mature.&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;For the first few years after the release of any new programming language, the developers take it apart and use it to build things that were unheard of before. The language becomes “trendy” there is a bunch of cool stuff coming out every week, and the excitement in the air is electric.&lt;/p&gt;

&lt;p&gt;This was also the case with Ruby way back in 1995 when Yukihiro Matsumoto released it to the world, to create a language that was “natural, not just simple to understand.”&lt;/p&gt;

&lt;p&gt;In 2003, an employee of 37 signals called David Hansson, made things easier for the whole developer community by creating Ruby on Rails, simply called ‘Rails.’&lt;/p&gt;

&lt;p&gt;We won’t bore you with more Ruby history, but a little back story is required to get the proper context.&lt;/p&gt;

&lt;p&gt;Now that you know how Ruby has been around for more than two and a half decades, the hype around it has surely died down, and what was once cutting edge has now become commonplace.&lt;/p&gt;

&lt;p&gt;The language, in other words, has &lt;strong&gt;‘matured.’&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;But does maturity mean the language has become boring? Hell No.&lt;/p&gt;

&lt;p&gt;Maturity means that the Ruby code is now more stable and refined, and Web Applications written on Ruby are much more maintainable.&lt;/p&gt;

&lt;p&gt;Good developers know that code need not be written in the hottest new framework if it becomes a pain to support for the coming years. Instead, code stability that comes with maturity directly translates to saved time, which can then be used to focus on improving the application logic-or playing more foosball. A winner all around.&lt;/p&gt;

&lt;p&gt;In other words, &lt;strong&gt;Mature Ruby Code &amp;gt; Code in Hot New Framework.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;A large developer pool for Ruby&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;A good starting point to see if a technology is “in” or “out” is to see the number of job openings the technology has.&lt;/p&gt;

&lt;p&gt;So I ran a quick Linkedin search for “Ruby on Rails developers.”&lt;/p&gt;

&lt;p&gt;The results? Well, see for yourself.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F960%2F0%2AbdENghnP-iPcR5TZ" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F960%2F0%2AbdENghnP-iPcR5TZ" alt="Ruby on Rails developers in worldwide linkedin search result" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A whopping 31,000 openings worldwide. Now, if Ruby On Rails were a dying technology, that number is surely bound to be way lower.&lt;/p&gt;

&lt;p&gt;A large developer pool also means that there is a large repository of Ruby gems ready to use. Ruby gems are self-contained library formats that help you carry out complicated tasks.&lt;/p&gt;

&lt;p&gt;We wrote a detailed post on “&lt;strong&gt;How to create A Ruby on Rails gem&lt;/strong&gt;,” which you can find &lt;a href="https://blog.solutelabs.com/how-to-create-a-gem-in-ruby-on-rails-688ff998fbdb" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Interesting caveat:&lt;/strong&gt; At this juncture, our HR team at SoluteLabs wants to point out an interesting fact. When scouting for talent, the HR team says that Ruby on Rails developers are particularly hard to come by. This is contrary to what the data says about RoR developers being easily available in the market, so we will have to wait and watch before we proceed further.&lt;/p&gt;

&lt;p&gt;Let us see what else makes Ruby popular.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Best for developing MVPs&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Imagine this.&lt;/p&gt;

&lt;p&gt;You have an idea for a killer app, something that is an offshoot of the current technology that you are working on, and have an investor meeting coming up in three weeks.&lt;/p&gt;

&lt;p&gt;You can either:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A &lt;/strong&gt;— Create a complicated wireframe or a presentation that only developers can follow and which is sure to confuse your investors.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;B&lt;/strong&gt; — Create a working prototype of the app and have the investors go… Ooooohhhhhh!!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F960%2F0%2AiKctquzFhar8TU41" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F960%2F0%2AiKctquzFhar8TU41" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;a href="https://tenor.com/view/oooh-toystory-aliens-gif-5654122" rel="noopener noreferrer"&gt;Image credit&lt;/a&gt;



&lt;p&gt;Building a Minimum Viable Product (MVP) in the least amount of time is why Ruby climbed to the top of the developer’s favourite list and is continuing to stay there.&lt;/p&gt;

&lt;p&gt;Ask yourself questions like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Does my product need to go-to-market in the least amount of time?&lt;/li&gt;
&lt;li&gt;  Do I want to extensively test my product before it hits the market?&lt;/li&gt;
&lt;li&gt;  Am I low on money and need to build something good out of minimal resources?&lt;/li&gt;
&lt;li&gt;  Should I constantly be able to receive feedback and improve my product?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If your answer is a Yes to most of the questions listed here, then you need to go ahead and build an MVP before you do anything else.&lt;/p&gt;

&lt;p&gt;Ruby on Rails has a large community, as we stated above, and a tonne of gems available, which solves most of the problems developers face.&lt;/p&gt;

&lt;p&gt;Ruby apps are easy to scale, and we can build apps much more easily for a bug user count, like GitHub.&lt;/p&gt;

&lt;p&gt;RoR apps are easier to connect to a database, which means the technology offers a lot of flexibility.&lt;/p&gt;

&lt;p&gt;All this leads us to one conclusion — &lt;strong&gt;“Think MVP, Think Ruby.”&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Ruby on Rails is open-source.&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;What does an open-source framework mean to the end-user? Well, for starters, the source code is free to download for anyone wishing to play around with Ruby.&lt;/p&gt;

&lt;p&gt;The RoR framework runs on Linux, which is also 100% free and is an open-source framework.&lt;/p&gt;

&lt;p&gt;Ruby gems, which lets you add features quickly without having to develop them from scratch, also comes in handy here. The developer’s time and effort is saved, which also translates to saved costs.&lt;/p&gt;

&lt;p&gt;Being open-source is what allows startups to compete with experienced players in the software industry.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F960%2F0%2AU2_CqfvNo3DvMZXR" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F960%2F0%2AU2_CqfvNo3DvMZXR" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;a href="https://itsfoss.com/10-funny-jokes-pictures-windows-mac-linux/" rel="noopener noreferrer"&gt;Image credit&lt;/a&gt;



&lt;p&gt;So if you are a Microsoft Windows and Java aficionado, consider switching to Linux and Ruby and watch your savings grow.&lt;/p&gt;

&lt;p&gt;Moving on.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Ruby on Rails is easy to maintain and change.&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;One aspect of Ruby on Rails that all developers love irrespective of their other differences is the “Convention over Configuration” principle.&lt;/p&gt;

&lt;p&gt;Rails has a very concrete idea of how to develop a web application and defaults to this set of conventions.&lt;/p&gt;

&lt;p&gt;This means that not only do the developers save a lot of their time that is otherwise sunk in re-coding repetitive tasks, but Ruby code is cleaner and less prone to bugs. Convention over Configuration also means that it is easier to troubleshoot problems as and when they occur.&lt;/p&gt;

&lt;p&gt;Ruby code structured so that there is no need for developers to leave behind detailed explanations as to why they took certain coding decisions. Instead, the Rails conventions act as a shared common ground for developers to write their code.&lt;/p&gt;

&lt;p&gt;Rails is also good for Rapid Application Development (RAD), and the framework makes it super easy to accommodate changes.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Ruby on Rails is widely supported.&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;As we have mentioned earlier, the Ruby on Rails community is widespread across the globe, with developers constantly pushing out new Ruby on Rails gems.&lt;/p&gt;

&lt;p&gt;Ruby on Rails community members pride themselves on keeping the technology updated and making the Ruby code clean and simplistic.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F960%2F0%2AOln32iJBQaTfPs78" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F960%2F0%2AOln32iJBQaTfPs78" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;a href="https://www.asianage.com/science/131217/human-sized-ancient-penguin-found-at-new-zealand.html" rel="noopener noreferrer"&gt;Image credit&lt;/a&gt;



&lt;p&gt;A huge developer community means new users can quickly find solutions to any bug or coding problem they may be facing.&lt;/p&gt;

&lt;p&gt;The RoR technology is so widely supported that an inside joke among RoR developers goes like “There is a gem for that.”&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Is Ruby dying? A few drawbacks of Ruby on Rails&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;While we have talked about the advantages of Ruby on Rails at length, there are a few drawbacks of using RoR. Among them are:&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Ruby on Rails is not Machine-learning friendly.&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Remember how you see a list of Facebook friends you thought were long lost but seem to appear on your feed mysteriously? That’s machine learning optimizing your social feed based on past experiences.&lt;/p&gt;

&lt;p&gt;When you drive from home to work, Google Maps shows traffic congestion in certain areas. That is machine learning at work too.&lt;/p&gt;

&lt;p&gt;Machine learning has been an integral part of our lives for the past few years, without us even noticing it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F960%2F0%2AdgYDRSK-8fLqFXEz" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F960%2F0%2AdgYDRSK-8fLqFXEz" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;a href="https://marketoonist.com/2017/11/machine-learning.html" rel="noopener noreferrer"&gt;Image credit&lt;/a&gt;



&lt;p&gt;Unfortunately, Ruby on Rails is not the best technology to use when dealing with Machine Learning. Languages such as Python or even Java offer much more features to integrate with Machine learning.&lt;/p&gt;

&lt;p&gt;A major hindrance to Ruby and Machine learning is that there are just not enough libraries to support ML in Ruby on Rails apps. Considering the fact that Ruby on Rails is mature and was written a long time ago, when Machine learning was relegated to science fiction, this drawback can be easily forgiven.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Ruby on Rails is not fully flexible.&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Ruby on Rails is highly opinionated and rigid. This is something that all Rails developers agree upon.&lt;/p&gt;

&lt;p&gt;When we say opinionated, we mean that Ruby on allows you to create apps that “Rails wants you to.”&lt;/p&gt;

&lt;p&gt;Ruby on Rails operates on some fixed rules and default code samples, which makes it difficult for developers to highlight their creativity.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F960%2F0%2A-PhWWKWCumWzERgg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F960%2F0%2A-PhWWKWCumWzERgg" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;a href="https://www.freepik.com/" rel="noopener noreferrer"&gt;Image credit&lt;/a&gt;



&lt;p&gt;If you decide to build an unconventional architecture or extended features that fall outside Rail’s conventional guidelines, you will be in for a surprise. Developers have to choose between sacrificing time or originality.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Ruby on Rails has less operational speed and is not scalable.&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;RoR is the go-to tool if you want to build an MVP. That much is abundantly clear. But seasoned developers say that RoR is a bit slower compared to other frameworks.&lt;/p&gt;

&lt;p&gt;Unlike C++ and Java, Ruby on Rails requires extra time to execute the code. Rails is a speed demon, and if you need high operational speed and low resource consumption, then Ruby on Rails is a big no-no.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F960%2F0%2A5TyiK0aCpi3zf_Nr" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F960%2F0%2A5TyiK0aCpi3zf_Nr" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;a href="https://giphy.com/gifs/batman-running-run-wIV2gwOkpZeBG" rel="noopener noreferrer"&gt;Image credit&lt;/a&gt;



&lt;p&gt;Speed again is a relative term, and you may not need a lot of speed if you are building an MVP.. Unless you plan your app to go viral and be used by hundreds of millions of users, speed is not generally a dampener.&lt;/p&gt;

&lt;p&gt;But does your app need to scale quickly? Ruby language poses a drawback here too.&lt;/p&gt;

&lt;p&gt;When Twitter moved out of Ruby on Rails to Scala, the framework’s inability to scale was seen as a major drawback. However, many developers would argue that each element in the server’s system architecture is responsible for scaling, and not just the web app’s backend.&lt;/p&gt;

&lt;p&gt;But does it mean RoR is not completely suitable when building an app that scales? Not exactly. Shopify was able to scale and support over 500,000 businesses at a time using Ruby on Rails.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Who uses Ruby on Rails today?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Ruby on Rails is still going strong, with a host of companies swearing by the technology’s robustness and flexibility.&lt;/p&gt;

&lt;p&gt;Here is a look at some of the big names using Ruby:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F960%2F1%2AY7qlKpUbEiPrZm3qZbG9AA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F960%2F1%2AY7qlKpUbEiPrZm3qZbG9AA.png" alt="Popular apps built using Ruby on Rails(RoR)" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Both Ruby and Rails are scheduled to release updated versions this year, to address many of the pain points the developers are facing.&lt;/p&gt;

&lt;p&gt;Ruby 3, aimed for a Christmas 2020 release, aims at making the framework faster, improve memory and CPU performance, and make Concurrency a cornerstone in development.&lt;/p&gt;

&lt;p&gt;Rails 6, released last year, offers better text-editing features with Action Text and faster reply rates with Action Mailbox, and the ability to use multiple databases that make the app that much more secure.&lt;/p&gt;

&lt;p&gt;As you can see, Ruby on Rails has been here for long and looks like it is here to stay. If you want an app developed using Ruby on Rails, remember to give &lt;a href="https://www.solutelabs.com/" rel="noopener noreferrer"&gt;SoluteLabs&lt;/a&gt; a shoutout.&lt;/p&gt;

</description>
      <category>ruby</category>
      <category>rails</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>How to create a gem in Ruby on Rails? [From Scratch]</title>
      <dc:creator>Pratha Avashia</dc:creator>
      <pubDate>Wed, 29 Apr 2020 06:02:31 +0000</pubDate>
      <link>https://dev.to/solutelabs/how-to-create-a-gem-in-ruby-on-rails-fromscratch-3f4p</link>
      <guid>https://dev.to/solutelabs/how-to-create-a-gem-in-ruby-on-rails-fromscratch-3f4p</guid>
      <description>&lt;p&gt;Being web developers, we all love Ruby on Rails. And we have our own &lt;a href="https://blog.solutelabs.com/ruby-on-rails-for-web-development-why-developers-love-it-5910f93f52ac" rel="noopener noreferrer"&gt;reasons&lt;/a&gt;. But, one of the reasons why we love Ruby onRails (RoR) is the simplicity, which eases the way we code.&lt;/p&gt;

&lt;p&gt;One of the simplest functionalities, which most RoR developers love is, creating gems in Ruby.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What are gems in Ruby?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A gem in Ruby programming language is a software package in which Ruby applications or libraries can be distributed in a single format.&lt;/p&gt;

&lt;p&gt;But, then most of our newbie web developers ask these questions-&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why should we create a gem? It is ultimately a rails code, so why can't we add a code in one of the module files and use it in our projects?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;And to that, the answer is Yes. We can use that method. But sometimes, if the code seems more general than the project-specific code, it should be converted to a gem so that it can be reused and shared with multiple projects. This will ultimately help you to maintain a clean line of code as well as will reduce the duplication of the code.&lt;/p&gt;

&lt;p&gt;Recently in one of our projects, there was a functionality of sending notifications using FCM. FCM gem already exists in Rails to fulfill the functionality. But we wanted to integrate upgraded APIs from FCM itself, which the existing gem was not using.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;And, how do we do that?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To adapt the newer APIs, one way was to code manually to send the notifications using FCM APIs. But, that is not a good idea because the "notifications" functionality is something that is going to be used in the majority of the projects.&lt;/p&gt;

&lt;p&gt;So, we thought to have a private gem which will have a core logic of sending notifications to the devices using FCM non legacy API, which can be further used in many such projects.&lt;/p&gt;

&lt;p&gt;So, we will see the step by step process of how we can create a gem in Ruby onRails. So here we go!!&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Creating a Gem from Scratch&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Now let's start with setting up our gem. Here we will be creating a gem with bundler. So to begin creating a gem using Bundler, use the bundle gem command like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1600%2F0%2A2ZqVFSvuzFBbui7R" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1600%2F0%2A2ZqVFSvuzFBbui7R" alt="-----" width="470" height="49"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Name your gem:
&lt;/h2&gt;

&lt;p&gt;Before running above command we should know how to name your gem. There are some naming conventions to be followed.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use dashes and extensions (every dash represents a structure (folder, module))&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;-- For example if we have a gem name like &lt;strong&gt;gem gem-structure-demo_notifier&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;-- It will be included in one of the files like &lt;strong&gt;require 'gem/structure/demo_notifier'&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;-- And its class or module will have a name like &lt;strong&gt;module/class Gem::Structure::DemoNotifier&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use underscores (represents a joining in the class name)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;-- For example if we have a gem name like &lt;strong&gt;gem demo_notifier&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;-- It will be included in one of the files like &lt;strong&gt;require 'demo_notifier'&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;-- And its class or module will have a name like &lt;strong&gt;module/class DemoNotifier&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Don't use uppercase letters&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The command we have specified above will create the following file structure for creating a gem.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1600%2F0%2ApR7_YT7QtWWOg-I1" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1600%2F0%2ApR7_YT7QtWWOg-I1" alt="-------" width="578" height="241"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If this is your first time running the bundle gem command then you will be asked whether you want to include the CODE_OF_CONDUCT.md and LICENSE.txt files with your project.&lt;/p&gt;

&lt;p&gt;We will see what all files are generated with gem bundle command and have a brief description for each file:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Gemfile&lt;/strong&gt;: This file manages gem dependencies for our library's development. File contains a gemspec line meaning that Bundler will include dependencies specified in demo_notifier.gemspec. It's best practice to specify all the gems that our library depends on in the gemspec file.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Rakefile&lt;/strong&gt;: Requires Bundler and adds the build, install and release Rake tasks by way of calling Bundler::GemHelper.install_tasks. The build task will build the current version of the gem and store it under the pkg folder, the install task will build and install the gem to our system and release will push the gem to Rubygems for public consumption.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;CODE_OF_CONDUCT.md&lt;/strong&gt;: Provides a code of conduct that is expected from all contributors to your gem to follow. It will only be included if you chose to have it included.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;LICENSE.txt&lt;/strong&gt;: Includes the MIT license. It will only be included if you chose to have it included.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;demo_notifier.gemspec&lt;/strong&gt;: The Gem Specification file. This is where we provide information for Rubygems' consumption such as the name, description and homepage of our gem. This is also where we specify the dependencies our gem needs to run.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1600%2F0%2APouHxRSz1tQJjOcz" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1600%2F0%2APouHxRSz1tQJjOcz" alt="-------" width="782" height="560"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the gemspec file as you can see there are dependencies called development dependencies. So what is this exactly?&lt;/p&gt;

&lt;p&gt;It's what you use while creating the gem. Things like rspec, rake and bundler should be in this file, because those might not be necessary for the people adding this gem to their Gemfile.&lt;/p&gt;

&lt;p&gt;In this file we will also have to include the version of a gem we are creating. This version will reference DemoNotifier module's variable VERSION.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;lib/demo_notifier.rb&lt;/strong&gt;: The main file to define our gem's code which will be required by Bundler when our gem is loaded. This file defines a module which we can use as a namespace for all our gem's code. Here we have added the core logic of sending notifications to devices in demo_notifier.rb file like this:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1600%2F0%2A2Ia8mC6VOvfmYPfg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1600%2F0%2A2Ia8mC6VOvfmYPfg" alt="-------" width="800" height="666"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;lib/demo_notifier&lt;/strong&gt;: This folder should contain all the code (classes, etc.) for our gem. The lib/demo_notifier.rb file is there for setting up our gem's environment, whilst all the parts of it go in this folder. If our gem has multiple uses, separating this out so that people can require one class/file at a time can be really helpful.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;lib/demo_notifier/version.rb&lt;/strong&gt;: Defines a demo_notifier module and in it, a VERSION constant. This file is loaded by the demo_notifier.gemspec to specify aversion for the gem specification.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Versioning of a gem requires some conventions to be followed as follows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A gem version is a string of 3 numbers divided by dots - 'X.X.X'.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Incrementing any one of the digits has a different meaning i.e what level of the change has been made to the gem at the time of releasing.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;-- &lt;strong&gt;Increasing the third number&lt;/strong&gt;, means the 'build' number means that the change was small and did not affect the functionality of the gem.&lt;/p&gt;

&lt;p&gt;-- &lt;strong&gt;Increasing the second number&lt;/strong&gt; (A minor number) means the changes include adding new functionality, but the gem did not lose compatibility with the previous versions.&lt;/p&gt;

&lt;p&gt;-- &lt;strong&gt;Increasing the first number&lt;/strong&gt; ( A major number) means that the changes made to the gem were so severe that it's no longer compatible with the previously released versions.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Test your gem:
&lt;/h2&gt;

&lt;p&gt;Now after configuring all the above-mentioned things, it is important to test the written code.&lt;/p&gt;

&lt;p&gt;Testing the gem is a very important part when building a gem. It helps to assure you that your code works, and helps others know that the gem is working perfectly fine. When going through any gem, Ruby developers always check a solid test suite as one of the main reasons for trusting that piece of code which they want to include in their applications.&lt;/p&gt;

&lt;p&gt;For writing test cases gem file structure also creates rspec related in which you can write the test cases using rspec guidelines and test your code through the test cases. Here in our file structure, the main rspec test cases will be written in*&lt;em&gt;demo_notifier/specs/demo_notifier_spec.rb&lt;/em&gt;*&lt;/p&gt;

&lt;p&gt;To run the test cases you can run &lt;strong&gt;rspec&lt;/strong&gt; or &lt;strong&gt;bundle exec rspec&lt;/strong&gt;. If the result is green then the code is working fine and good to go.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Generate the build:
&lt;/h2&gt;

&lt;p&gt;Now that we have completed the coding of a gem we want it to be used in other projects. For this, we will run the build command.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1600%2F0%2ABAU-YrONFOjTlEH5" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1600%2F0%2ABAU-YrONFOjTlEH5" alt="-------" width="478" height="57"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This command will build the gem and output a gem file as follows:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1600%2F0%2ALc-NtuZNo4lR8BWa" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1600%2F0%2ALc-NtuZNo4lR8BWa" alt="-------" width="486" height="69"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Push the Gem:
&lt;/h2&gt;

&lt;p&gt;Finally, after building the gem it's time to push the gem. There are two ways of pushing your gem.&lt;/p&gt;

&lt;p&gt;For pushing the gem to &lt;strong&gt;RubyGems&lt;/strong&gt; you will need to create an account on &lt;strong&gt;RubyGems.org.&lt;/strong&gt; Once that's finished, use your email and password when pushing the gem (RubyGems saves the credentials in ~/.gem/credentials for you so you only need to log in once).&lt;/p&gt;

&lt;p&gt;After that, it is just a matter of making it available to rails communities around the globe through rubygems.org. This is done with two simple commands:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1600%2F0%2A_4TeQZJ2yUDmrAZM" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1600%2F0%2A_4TeQZJ2yUDmrAZM" alt="-------" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And once its done run following command&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1600%2F0%2Ap4txQynJvzcgAeI2" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1600%2F0%2Ap4txQynJvzcgAeI2" alt="-------" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With this command, the gem will be pushed and will be available on RubyGems.&lt;/p&gt;

&lt;p&gt;Sometimes we want to keep our gem private and don't want to share it with the world. But RubyGems doesn't support that.&lt;/p&gt;

&lt;p&gt;So to keep the gem private you can push your gem to a private Github Repository and include the gem to your project using github url with oauth credentials. And if we don't want to include oauth credentials to the url then you can add the ssh key to the gem repository and gain access from where you are installing the gem.&lt;/p&gt;

&lt;p&gt;This way your gem will become private and will only be accessible to limited people.&lt;/p&gt;

</description>
      <category>ruby</category>
      <category>rails</category>
      <category>development</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
