Ruby Developer Question:
Download Job Interview Questions and Answers PDF
Please explain what is MVC and why do we use it?
Answer:
MVC stands for Model View Controller.
Model is the data structure that your program uses.
The View is the part that interacts with the screen or the next level up.
The Controller generally processes data between the model and view.
For example, a model will define your table in the database, the controller will dictate what to do behind the scenes and what to display in the view next. The view part generates the user interface which presents data to the user.
Let’s take an example of creating a form. The submit form will be a view file, from that view file, when you click on the submit button it goes to the respective controller where you have written your business code about what happens on submitting the application/form, and from that controller the data will be saved in the database.
Thus MVC helps to split up the the business logic, database access and presentation. This is very useful in most web applications, and now lately into software/desktop applications.
Model is the data structure that your program uses.
The View is the part that interacts with the screen or the next level up.
The Controller generally processes data between the model and view.
For example, a model will define your table in the database, the controller will dictate what to do behind the scenes and what to display in the view next. The view part generates the user interface which presents data to the user.
Let’s take an example of creating a form. The submit form will be a view file, from that view file, when you click on the submit button it goes to the respective controller where you have written your business code about what happens on submitting the application/form, and from that controller the data will be saved in the database.
Thus MVC helps to split up the the business logic, database access and presentation. This is very useful in most web applications, and now lately into software/desktop applications.
Download Ruby Developer Interview Questions And Answers
PDF
Previous Question | Next Question |
As you know ruby provides four types of variables. List them and provide a brief explanation for each? | Tell me an array [1,2,34,5,6,7,8,9], product it using a method? |