Building Web Applications with Ruby on Rails
This is the first article in the series on building awesome web applications with Ruby on Rails. It explores why you should build for the web and use a web framework, especially Rails.
Since I started learning Rails last year and kept sharing my learnings on this blog, I've received questions from both developers and non-developers on how to get started in programming, especially with Rails.
So I've decided to write a series of articles on the basics of web application development using Ruby on Rails. This is the first article in this series.
The primary purpose of these articles is to provide a high-level overview of the Rails framework with concrete examples to learn what you need to work in with any Rails codebase and build useful web applications.
It is for developers who already know how to program in Ruby and want to build awesome web applications in Rails that delight the users. By the end of this series, you should be comfortable writing an entire Rails app from scratch.
It's important to note that I am not writing this series from a position of expertise.
Although I have more than five years of experience building web applications (in .NET), I'm only a year and a half into my Rails journey and still have a long way to go, so I will be sharing the perspective of an intermediate Rails developer.
Still, I think this perspective will be helpful to many developers who are just starting their journey into web development.
With that out of the way, let's begin.
Why Build Web Applications?
You can build a web app to express yourself, share knowledge, and teach others.
In an industry that's increasingly rewarding specialists, web application development is one of the few fields left which still rewards the generalist.
To make a useful web application, you need to know a little about programming, databases, design, writing, and much more.
Building applications for the web is like those "easy to learn, hard to master" games. Though it's very easy to get started, the thread goes deep, and it can take a lifetime to learn and master the various technologies that power a web application.
If you are an aspiring software developer, confused with all the trends in software such as A.I., machine learning, data science, and don't know what to do, start by learning to build a simple database-backed dynamic website, also called a web application.
Building for the web is free. You don't need anyone's permission to build a web application. It can also be profitable without taking anything away from someone else. In other words, competition doesn't matter. You have a global audience.
You can build websites that provide information (e.g. blogs, online magazines), invite users to create information in collaboration (StackOverflow, Quora, etc.), provide some service using the back-end program, or query a database of information that's typically hard to find (houses or cars on the market).
The opportunities are endless.
Now that I've sold you on building for the web, let me answer your next question.
Why use a web framework?
Before answering this, let's invert the question and try understanding what it will take to build a web application without a framework.
Where do you begin if you decide not to use a framework like Rails?
First, you need a web server to accept HTTP requests. Then, you need support for routing these incoming requests to the correct Ruby code.
We also need to send HTML in response to the incoming request. How do you build this response HTML?
How about working with the database to store and retrieve data?
Where do you store all this code? How do you load your code or any 3rd party dependencies?
Even if you build all this yourself, how is the next developer supposed to learn and use them?
You can build all the above features just using Ruby gems in isolation. However, frameworks like Rails package these gems together with the framework glue.
A framework provides configuration files, directory structure, and conventions. It also provides sensible conventions to reduce the overhead for new developers.
Someone else decides which gems to use, how to use them, and how they fit together. That leaves you, the developer, to focus on the core of your web application.
Why Ruby on Rails?
At its core, Rails is about enabling developers. It strives to increase developer speed and happiness, making it easier for developers to learn quickly and start building fully-functioning applications.
Rails strives to provide clear, simple, and beautiful code and features. It doesn't value architectural purity or hold allegiance to a specific programming principle. Its primary focus is to serve the individual developer.
Convention over configuration is a core value of Rails. When you stick to the defaults provided by Rails, you are free to focus on the core of your application without worrying about the unnecessary complexity common to all web applications. Rails takes care of it.
That's enough praise for Rails for now. I believe in "Show, don't tell". I know that once we start building a web application using Rails, you will appreciate just how awesome Rails is.
I hope you join in this journey. Stay tuned for the next article in the series.