MVC Model View Controller :
Salesforce MVC Architecture is one of the widely used software architecture
design patterns which divides the design into three basic components i.e.
Model, View, and Controller. Salesforce provides Visualforce an interface to
quickly develop applications following MVC architecture over the cloud.
In SFDC
1. Visual Force pages, Page Layouts, Tabs come under View Layer of Model
View controller.
2. Workflows, Apex Classes, Triggers comes under the Controller part in
Model View controller.
3. Objects, Fields, Relationships come under Model Layer of Model View
Controller.
Model
Updates Manipulates
View Controller
Sees Uses
User
With Sharing and Without Sharing :
With Sharing
Use the with sharing keyword when declaring a class to enforce sharing
rules of the current user. Explicitly setting this keyword ensures that Apex
code runs in the current user context. Apex code that is executed with
the executeAnonymous call and Connect in Apex always execute using
the sharing rules of the current user. For more information
on executeAnonymous, see Anonymous Blocks.
If you declare a class as a With Sharing, sharing rules given to the
current user will be taken into consideration and the user can access and
perform the operations based on the permissions given to him on objects and
fields. (field level security, sharing rules)
Without Sharing
Use the without sharing keyword when declaring a class to ensure that
the sharing rules for the current user are not enforced. For example, you
can explicitly turn off sharing rule enforcement when a class is called from
another class that is declared using with sharing.
If you declare a class as a Without Sharing then this apex class runs
in system mode which means apex code has access to all the objects and
fields irrespective of current users sharing rules, fields level security, object
permissions.
Note: If the class is not declared as With Sharing or Without
Sharing then the class is by default taken as Without Sharing.
Both inner class and outer classes can be declared as With Sharing.
If inner class is declared as With Sharing and top-level class is
declared as without sharing, then the entire context will run in With
Sharing context.
Outer class is declared as With Sharing and inner class is declared
as Without Sharing then inner class runs in Without Sharing context only.
(Inner classes don't take the sharing properties from outer class)