Ruby on Rails Interview Questions for freshers
Ruby on rails is growing up technology and has wide range of opportunities across the world. The first things when we talk about
Ruby on rails is OOPS’s and object. so lets start with OOPS’s.So What is OOPS’s?
So What is OOPS’s?
In simple word OPPS is the Object Oriented Paradigm where everything is managed by Object., here object can be contained
data as fields, procedures and code, we can access, modify or process data from the object that is
feature of object.
The Question can be arises here why we need an OOPS? while there many procedure oriented paradigm already exists Than
why why we use OOPS?
The answer is the purpose of object-oriented programming is to make programming simple, Incorporated, beset performance,
with lowest memory uses, increase the flexibility and maintainability.
Because when we create any application we have limited memory and process capacity so we must have to care about it.
OOPS has the principal’s to care about it.
Everything in ruby is an object is this correct?
This is the principal of ruby that everything in ruby is an Object because just like a 123 is belongs to Integer class
every text belongs to String class, every functions belongs from some class, Question is also arise here if this is a principal
that everything is an object that what are the things those are not an object, yes there are many things that does not belongs to
any, like methods arguments when we define the function it does not belongs to any class some keywords like class is not an object however when we defined the class like class User end here, here User class is an object but the keyword class is not an object.
Of course OPPS has lot of feature some of them we summarized bellow
OPPS are have some more features
Object: all the real word entity that has state and behavior can be called as object like human eye, hand, lag, chair, tree etc.
If we define object with respect to the class than object is the instance of a class. All objects has an address in memory
hence it occupy some memory based on class from which its depends. Objects can communicate to each other without knowing the data and code. when objects communicate
to each other the thing the the message that they carry and the response that object we get based on message.
Class: In OOPS, class is the blueprint for the object. We can say class is the collection of objects and class does not occupy any space in memory
Based on the definition of the class, objects change it behavior.
When we create new object, it also provides the initial values for the state member variable and attributes, also provide behavior we call it member functions or methods.
- What is difference between OOPS and Object based paradigm?
The difference is in the characteristics of both paradigm as in OPPS based paradigm it support inheritance while object based paradigm it does not support inheritance.
What are the features of OOPS?