Rails Main Principles
Tags: ruby, rails, programming, beginners
Published: 2023-01-05 04:30:00


## Rails Main Principles

Hello Everyone, In this article, we are going to discuss the **Main Principles** of a popular framework for web development — “**Ruby on Rails**”. So let’s get started.

![Rails Principles](https://cdn-images-1.medium.com/max/2000/1*dBa58iuiZqS2QVaWhuBJiQ.png)
<figcaption align = "center"><b>Rails Principles Poster Designed By Rutik Patel(me)</b></figcaption>

<br />
This article is divided into the sections listed below:

 1. What is Ruby on Rails?

 2. Rails Principles


Let’s start by reviewing Ruby on Rails’ foundational concepts.
<br />
### **What is Ruby on Rails?**

Ruby on Rails (RoR), is a server-side web application framework which is written in Ruby. In simpler terms, Rails is a **full-stack web development framework**. It includes all of the tools you’ll need to build amazing front-end and back-end web applications. It was created by **David Hansson** in **2004**.

Rails can do everything and more, including enqueuing jobs for asynchronous work, storing uploads in the cloud, producing HTML templates, updating databases, sending and receiving emails, maintaining live pages with Web Sockets, and providing solid security protections for conventional assaults.
<br />
### Rails Principles

The Rails framework is based on **two fundamental principles**, making it a popular choice among customers and web programmers.

 1. Conventions over Configurations

 2. Don’t Repeat Yourself (DRY)

### **1. Conventions over Configurations**

Many programming language or web frameworks require lots of configuration and it acquire good amount of time. Few web application frameworks, for instance, require many configuration files, each with a variety of options. A developer need to define that a class called “Blogs” and a database table called “blogs” are equivalent.

However, Rails depends on assumptions rather than detailed configuration files. Convention indicates that if a programmer creates a model named “Post”, It will automatically save data to a database table called “posts” without any additional configuration.

It greatly helps in reducing the time and effort required by developers, without compromising development flexibility.

### **2. Don’t Repeat Yourself (DRY)**

“Don’t Repeat Yourself,” commonly abbreviated and known as DRY, is one of the most important principle in application development. The primary goal of DRY principle is to minimise code duplication or repetition. To illustrate, rails provide a feature of partials which follows this philosophy.

The user can create a partial and write code in that, which will be reused throughout the application as many times as needed without repeating the entire code.

It facilitates developers to producing simpler, user-friendly, manageable, and easier-to-upgrade applications, as well as making it a piece of cake to create sophisticated systems.

![Photo by [Kelly Sikkema](https://unsplash.com/@kellysikkema?utm_source=medium&utm_medium=referral) on [Unsplash](https://unsplash.com?utm_source=medium&utm_medium=referral)](https://cdn-images-1.medium.com/max/11136/0*Ht6GhxWztiXmhUgw)
<figcaption align = "center"><b>Photo by Kelly Sikkema - (https://unsplash.com/@kellysikkema)</b></figcaption>