Ruby On Rails
Ruby and Object-Oriented Programming Ruby follows strict concepts of Object Oriented programming languages (OOPS) and thus has objects, methods and classes available for programming. It has all the ways by which we can handle these objects and classes in a smooth manner.
Now letâ??s have a look at a few basic phenomenon which are available in OOPS which Ruby also supports. The common features of OOPS are: Objects, Classes and Instances, Methods, Portability, Security.
We will talk about these in brief in the section below to have an understanding of the same. Objects are the real world entities. In programming these objects are used to make proper use of all methods which are available in the classes. Whenever we want to work on any object, we need to create a new object first, then the initialization of that particular object is done.
Classes and Instances: Ruby also has classes and Instances. Objects are nothing but the instances of the Class class. This can be easily understood, as objects are nothing but particular mirror copies of a class, but with all its attributes and properties specified. Normally object instances are made with the help of a new method but here it is advised to have the initialization method create the object. The complete data here is confined in the objects and we work on these objects by implementing the methods available in the particular class. It is a general practice that the class name should always be a unique name and needs to be a constant as it helps to differentiate one class from the other.
Whenever we call any class method in Ruby, it tries to track a particular method at several locations. It also follows a specific path to locate that method so as to avoid wasting search time.
Methods: In ruby, all algorithms that we write on any object are placed safely in methods. Method can be defined as code which is given by any class to an object to perform all the series of instructions. All code which we write in Ruby is nothing but the method of one class or another.
We also have Singleton methods in Ruby. Whenever any particular method has a strict association with a particular and a specific object we call these type of methods Singleton methods. These methods are defined with the help of def statements.
Security: Although Ruby provides the programmer with portability the programmer can keep his or her code in a distributed form over the network. The security system of Ruby is so robust that the programmer does not need to worry about the authenticity and the safety of his or her valuable code. Data portability is an important feature of Object Oriented Programming languages. We have a very strong concept of Lock Down in Ruby which enables the programmer to decide which part of his code or data may be a threat to the remaining part of the code. He can execute it under strict supervision thus saving the danger of getting the remaining data being effected by that set of code. This feature of Ruby has made it a very strong point as to why the programmers have accepted Ruby more than any other programming language when we talk about the security feature. Not only this. We can also execute our Ruby programs under a tight security check. This is done by enabling the security check option. We also have a variable known as $SAFE which helps us to find out the safety level of the code.
|