Tuesday, May 6, 2014

Ruby on Rails vs Object Oriented Programming Language

 

What is Ruby on Rails? 


Ruby on Rails, is an open source web application framework which runs on top of the Ruby programming language. Rails allows a programmer to write web applications that talk to a back-end database to retrieve data and render the data in templates on the client side. The implicit philosophy of Ruby on Rails also impacts how Ruby on Rails was designed; it provides lots of implicit default conventions that the programmer can rely on out of the box. Ruby on Rails assume there’s only one best way of doing certain things, therefore making it very hard for a programmer to modify the logic and behavior of Rails code.

 

Convention over Configuration


The most important philosophy of Ruby on Rails is convention over configuration (CoC), which means that Ruby on Rails projects have a predefined layout and sensible defaults. All components such as models, controllers, and static CSS and JavaScript files are located in standard sub-directories and you can simply drop your own implementation files into those directories and Rails will automatically pick them up

CoC is a big win for the developer since it saves alot of time typing the same configuration code over and over again. However, if you want to customize your project's configuration, you have to learn quite a bit about Ruby on Rails in order to change the configuration without breaking the whole project.

 

Implemented MVC framework


Ruby on Rails is a Model-View-Controller (MVC) full stack web framework, which means that the controller calls functions from the model and returns the data back to the view. Although many web frameworks are also based on MVC, Rails is unique because it supports a full REST protocol out-of-the-box. All model objects are accessed and handled in an uniform manner using the standard HTTP verbs like GET, PUT, DELETE and POST.

 

Object-Oriented Programming




The Object-Oriented Programming refers to a programming methodology based on objects, instead of functions and procedures. These objects are organized into classes, which allow individual objects to be group together.


An "object" in an Object-Oriented Programming language refers to a specific type, or "instance," of a class. Each object has a structure similar to other objects in the class, but can be assigned individual characteristics. An object can also call methods, specific to that object

Object-oriented programming makes it easier for programmers to structure and organize software programs. Because individual objects can be modified without affecting other aspects of the program, it is also easier to update and change programs written in object-oriented languages. As software programs have grown larger over the years, OOP has made developing these large programs more manageable.

 

Model View Controller (MVC)


MVC is a pattern for implementing UI. It divides a given software application into three interconnected parts, so as to separate internal representations of information from the ways that information is presented or accepted from the user. The central component, the model, consists of application data, business rules, logic and functions. A view can be any output representation of information, such as a chart or a diagram. Multiple views of the same information are possible, such as a bar chart for management and a tabular view for accountants. The third part, the controller, accepts input and converts it to commands for the model or view.

In addition to dividing the application into three kinds of components, the model–view–controller design defines the interactions between them. 
  • Model


Notifies its associated views and controllers when there has been  a change in its state. This notification allows the views to produce updated output, and the controllers to change the available set of commands. In some cases an MVC implementation might instead be "passive," so that other components must poll the model for updates rather than being notified.

  • View


Requests information from the model that it needs for generating an output representation to the user.

  •  Controller


Can send commands to the model to update the model's state (e.g., editing a document). It can also send commands to its associated view to change the view's presentation of the model (e.g., by scrolling through a document).

Why Ruby on Rails


Ruby on Rails uses models to describe database tables, and controllers to retrieve data from models and return the data to views who eventually renders the data into an HTTP response. To map controller to an incoming request, programmers specify routes in a configuration file.

Since its initial release in 2005, Rails has become more and more popular among web programmers. It’s easy to use and understand tech stack and implicit CoC philosophy seem to allow agile web programmers to implement applications faster than other frameworks

 

Summary


Both Ruby on Rails and Object Oriented Programming Language are effective. The Object Oriented Programming Language uses the re-usability concepts, however the Model View Control is a framework for reducing the complexity of application by separating the database, business logic and the interface, it also provides better security as the users cannot directly access the database, that’s why Ruby on Rails is preferred for web application development and it is considered in the top  5 languages for used for web development.     

No comments:

Post a Comment