Sunday, 5 April 2015

Model View Controller (MVC) paradigm salesforce

Model view controller (MVC) is a software architecture pattern which separates the representation of information from the user’s interaction with it.

MVC pattern in salesforce contains below three modules:
  1. Model
  2. View
  3. Controller
1) A controller can send commands to its associated view to change the view’s presentation of the model . It can also send commands to the model to update the model’s state. According to Salesforce : How the interface actions. Controllers are used to perform the actions whenever users interact with visual force.

2) A model notifies its associated views and controllers when there has been a change in its state. This notification allows the views to produce updated output, and the controllers to change the available set of commands. A passive implementation of MVC omits these notifications, because the application does not require them or the software platform does not support them. According to salesforce :- What schema and data does salesforce uses to represent the system completely. In salesforce, we can say that sObjects are the model as every entity in salesforce is mapped to some sObject.

3) A view requests from the model the information that it needs to generate an output representation.
According to Saleforce :- How the schema and data is represented. Visualforce is used to present the data to users.


M - Model (Object, Fields, Relationships, Apex Classes)
V - View (Visualforce page, Pagelayouts, Record Types, Force.com Sites, Components)
C - Controller(Validation Rules, Controllers in a Visualforce page)

Some Useful link :- https://developer.salesforce.com/page/An_Introduction_to_Visualforce

Thanks,
Amit Chaudhary