The web development industry is growing rapidly, and with it a multitude of frameworks, libraries and languages to choose from to develop your web application. Although the choices can seem confusing and daunting, understanding the basics of the more popular frameworks out there can help you select the right technologies before taking the nosedive into your project. Ruby on Rails is one of the more popular frameworks being embraced by both start ups and established industries alike. But what sets Ruby on Rails apart from the MEAN and LAMP stacks?
Understanding the basics of MVC is imperative if you want to make use of Rails. Fortunately, the philosophy behind the framework is easy to understand. A model maps to your database and is considered the information or data in your application. Models are independent of both the view and the controller. The view displays the model data and is the interface that the user sees. The controller gives the model data to the view and interprets events that the user makes on the view.
Rails also requires the developer to make use of RESTful routes in the application, and are usually all mapped in a single routes.rb file. Representational state transfer or REST is an architectural style that recommends that web applications use HTTP as it was originally intended. The routes associated with REST are also easy to understand and consist of the following: create, new, edit, update, destroy, show, and index. These routes allow the controller in Rails to display the action executed on the page.
Although Rails is comprehensive out of the box, a web server is still required to connect it to the internet. Although preferred web servers have changed over time, Passenger is now considered to be the best web server option. However, Rails developers should be aware that a baseline Ruby server called WEBrick is automatically included.
Lastly, what sets Rails apart from other options? Ruby on Rails was developed to embrace two important web development philosophies that have made the framework popular with novices and small scale enterprises: Convention over Configuration (CoC) and Don’t Repeat Yourself (DRY). CoC results in an application that is straightforward and easy to understand since the developer only needs to explicitly specify unusual aspects of the web application. DRY helps keep all related information in one single and easy to find place. The general rule when building a Rails app is “fat models, skinny controllers”, or making sure that the bulk of the application’s logic can be found in the model. Taken together, Rails is a unique framework that emphasizes easy to read code and an approachable framework structure.