Sunday 26 May 2013

Introduction of MVC

Prerequisites
 
Knowledge of some other programming language ( Basic , C++ , C#, Any language ).

Installed In Your PC .
 
* Visual Studio 2010 or Visual Studio Web Developer 2012 Express
* MS Sql Server 2005 or MS Sql Server 2005 Express or 2008
* IIS or IIS Express
* MVC3
* Web Platform Installer Not Necessary But nice to have.  










About Microsoft ASP .NET MVC 


MVC or Model View Controller is a design pattern. This design pattern has been present in software applications for several decades. The Model View Controller pattern was invented in a Smalltalk context for decoupling the graphical interface of an application from the code that actually does the work.
* Model-Consist of Application data and the business rules. It contains the code to manipulate the data ( From Database or any datasource) & Also the Objects that retrive the data. It represent the state of   particular aspect of the application. Eg Model Maps to Database Table and entries in table   represent the state of the application.Model is responsible for actual data processing, like database connection, querying database, implementing business rules etc. It feeds data to the view without worrying about the actual formatting and look and feel.
* Controller- Handles user interation, Reads data from view, Controls Input & Send input data to the model. Handles Inputs and update the model to reflect the change in state of the   application. It also pass information to the view . Controller is responsible for Notice of action. Controller responds to the mouse or keyboard input to command model and view to change. Controllers are associated with views. User interaction triggers the events to change the model, which in turn calls some methods of model to update its state to notify other registered views to refresh their display.
* View-Is an output , It could be a webpage or a printout . In short views are used to display the data. Most of the time we create views from the model data. It accepts information from the   controller and displays it. View is the graphical data presentation (outputting) irrespective of the real data processing. View is the responsible for look and feel, some custom formatting, sorting etc. View is completely isolated from actual complex data operations.


 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
What U Need To Learn
 
* HTML
* CSS
* JQuery
  > JQuery UI
  > JQueryTemplates ( Transform JSON into HTML Markup )


 
 
Advantages of MVC?
 
1. Separation of Concerns
2. Better Support For Test Driven Development
3. Clean URL 
4. Better For Search Engine Optimization
5. Full Control Over the User Interface or the HTML 
6. Loosely Coupled so Each Component can be tested independently. 
 
 
Hello World Application 


           "Hello World" Application
          
          
          
Lets start with a hello world application to make sure that we have everything in place to get started & the code executes .



Lets start with your first mvc application "Hello World"

Step 1 : Start Visual Studio





Step 2 : Create a new Project









Step 3 : Change ViewBag.Message To "Hello World"



Step 4 : Run the Application



Here You go : Your First "Hello World" MVC Application




Now that you got your application to run , You have everything in place to start learning asp .net MVC.



No comments :