Ruby On Rails What is Rails Rails in its simplest terms can be defined as the framework which provides a variety of programs which perform most of the application segment for us. This makes our task of programming much simpler and easier. Not only this, we can always have the flexibility of reusing this framework any number of times as we only need to install it once. Then we can implement it on any number of applications that we develop.
As stated above, since Rails is a framework it also follows the same pattern as any other programming framework. These frameworks when implemented ease up the task of the programmer as it reduces a large amount of code writing. The programmer only needs to specify code which provides the instructions or the guidelines to the framework as to what has to be done.This means that if we are implementing any type of framework in our application we are saving a lot of coding time and also making our application more efficient by reusing the already installed framework.
This framework is also designed so that the entire application is segregated in three different layers: 1. Model 2.View 3.Controller or MVC. By implementing the MVC design at the time of developing our applications, we can have our application segemented into three logical sections.
The Model Section helps us to analyse and design the data model for the application.
The View Section has everything to do with the look and feel of how the application presents the data model. The View includes all the pages which are associated with that application. For example, if we are in process of developing any reservation making application we need to have a welcome page, followed by a registration form filling page, a confirmation page and so on. Thus the View section of the application can well be considered to be the backbone of the MVC framework, as it determines how the entire application will be viewed by the end user.
The Controller section of this model determines how the application will react to all the different events and instances which are associated with that application. The Controller section formalized in the application in the form of its functionality. Thus the Controller section handles the entire control of the application.
In a nut shell, we can state that what ever is been done in any Rail application has to be a part of one of these sections. Nothing in the application goes beyond the scope of the MVC design of this framework.
Why Ruby and Rail together Ruby and Rails are mostly spoken of together although they both have their individual existence and can very well go without each other. The reason why they are taken together is that Ruby is the base foundation for Rails. Thus it is correct to state that they have a parent/child relationship with each other; Ruby is the parent and Rail is the child.
We can work very easily on Rails if we have the knowledge of Ruby since the basic conventions of Rails are similar to conventions of Ruby. But that doesn’t mean that we can’t work on Rails if we haven’t worked on Ruby. The efforts in programming will definitely increase and also the time taken to make your application go up and live will increase if you are not already familiar with Ruby. It helps a lot to understand the code of Rails and it's functionality if we have knowledge of Ruby while working on Rails and thus they both go side by side.
Ruby helps a programmer to be a better developer by giving him a better understanding of the code he is working with. It makes programming easier as the developer is familiar with the readily available idioms and conventions of Ruby.
Knowledge of Ruby also makes debugging quite an easy task for the programmer when he is working with Rails.
Compared to the other programming languages and development environments, Ruby on Rails is a very efficient way of developing successful web applications in a shorter time . Ruby Garbage Collection Ruby has been introduced with a very strong and effective feature called Garbage Collection. Although this feature is a part of many programming languages, Ruby has made it more efficient (proof?). Garbage in this context refers to memory which has been allocated but not freed, even though it is no longer needed. Ruby has an automatic mechanism for finding and clearing out the garbage and thus freeing memory automatically. This removes the need to manage memory resources which if done poorly can result in memory leaks. It effectively cleans up the dynamically allocated storage space in the memory and avoids a lot of application crashes (application crashes are generally not caused by memory leaks, unless of coarse the leak actually uses all system memory, in which case it will be more than just the application which crashes - in fact whoever wrote that doesn't really know what they're talking about). We do not have to release the memory allocation space in Ruby as we have to do in other object oriented programming language like C++. Thus the garbage collector of Ruby does the task of freeing the unused objects automatically, making Ruby an easier programming language for people who don't understand memory allocation/deallocation. It should also be noted that it's a bit odd to be comparing Ruby to C/C++. Both have their place in the world of software engineering but neither should be considered a replacement for the other.
|