Thursday, 26 May 2016

Model View Controller (MVC)

The Model view Controller architecture solves these problem by decoupling data access, business logic , and data presentation and user interaction. Such separation allows  multiple views to share the same enterprise data model, which make supporting multiple client easier to implement, test & maintain.



The MVC pattern stands for Model View Controller Pattern. The Pattern is  used to separate application's concerns.

Model :
             The Model represents the state of component(i.e its data and the method require to manipulate it ) independent of how the component is viewed or rendered.

View : 
           The View render the contents of a model and specifies how that data should be presented.
There can be multiple views for the same model within single application  or model may have different views on different application or operating system.

Controller :
                   The controller translates interactions with the view into actions to be performed by the model. In a web application they appear as GET and POST HTTP requests. The action performed  by the model include activating business processes or changing the state of model. Based on the user interactions and the outcome of the model actions, the controller responds by selecting an appropriate views.

Can we call one constructor from another if a class has multiple constructors? How?



Yes,  we can call one constructor from another in the same class, or call the super class , with the following  restriction:

1. It has to be the first line of code in the calling constructor.

2. It cannot have any implicit or Explicit reference to "this". So you cannot pass an inner class (even an anonymous or if it reference any instance methods), or the result of a non-static method call, as a parameter.