SlideShare a Scribd company logo
Learning MVC-Part 1
Introductionto MVC Architecture and Separationof Concerns
Introduction:
After having gone through numerous of blogs and articles, I came to a
conclusion that very few of the genuine writers haveexplained the topic from
basics to its details in a full-fledged way with a working application. My effort in
this MVC articles series would be to cover almost all the aspects of MVC
starting from creating simple app and connecting with the databasewith
various Microsoftproviders. We’llbe gradually moving forward partby part to understand and
practically implement all the scenarios.
Road Map:
Part1: Introduction to MVC architecture and Separation of Concerns.
Part 2: Creating MVC Application from scratch and connecting it with databaseusing LINQ to
SQL.
Part 3: Connecting the MVC Application with the help of EntityFramework DB-Firstapproach.
Part 4: Connecting the MVC Application with the help of EntityFramework Code-First
approach.
Part 5: Implementing Repository Pattern in MVC Application with EntityFramework.
Part 6: Implementing a generic Repository Pattern and Unit Of Work pattern in MVC
Application with EntityFramework.
All set, now wecan start our journey with Part1.
Part1: Introduction to MVC architecture and Separation of Concerns.
Topics to be covered:
1. What does MVC mean.
2. Understand MVC Architecture.
3. Separation of Concerns
Players:
Model: The business entity on which the overallapplication operates. Many applications usea
persistentstorage mechanism(such as a database) to storedata. MVC does not specifically
mention the data access layer becauseit is understood to be encapsulated by the Model.
View: The user interface that renders the model into a formof interaction.
Controller: Handles a request froma view and updates the model that results a change in
Model’s state.
To implement MVC in .NET weneed mainly three classes (View, Controller and the Model).
MVC Architecture:
The choice of MVC comes when wego for a solution where separation of concerns, ease
of maintainability and extensibility of an application matters a lot. As per the architecture
given below, we can see the request-responseflow of a MVC application.
The architecture is self explanatory in itself. Browser as usualsends a requestto IIS,IIS
searches for the route defined in MVC application and passes requestto the controller as per
route, the controller communicates with model and passes the populated model(entity) to
View(frontend), Views are populated with model properties, and are rendered on the
browser, passing theresponseto browser through IISvia controllers which invoked the
particular View.
Separation of Concern:
As per Wikipedia 'the process of breaking a computer programinto distinct features that
overlap in functionality as little as possible'. MVC design pattern aims to separatecontent
frompresentation and data-processing fromcontent. Theoretically well, but where do wesee
this in MVC? Oneis reasonably clear - between the data-processing (Model) and the restof the
application.
When we talk about Views and Controllers, their ownership itself explains separation.The
views are justthe presentation formof an application, it does not haveto know specifically
about the requests coming fromcontroller. The Model is independent of View and Controllers,
it only holds business entities that can be passed to any View by controller as per need of
exposing them to end user.Thecontroller in independent of Views and Models, its sole
purposeis to handle requests and pass it on as per the routes defined and as per need of
rendering views.Thus our business entities(model), business logic(controllers) and
presentation logic(views) lie in logical/physical layers independent of each other.
Conclusion:
Now we know why and whereto useMVC, in another partof learning MVC we’ll be creating a
MVC application fromscratch, exploring the practical implementation of MVC.

More Related Content

What's hot (20)

PDF
MVC architecture
Emily Bauman
 
PDF
MVC Seminar Presantation
Abhishek Yadav
 
PPTX
ASP.NET MVC Presentation
Volkan Uzun
 
PPTX
Design Pattern - MVC, MVP and MVVM
Mudasir Qazi
 
PPTX
Mvc pattern and implementation in java fair
Tech_MX
 
PPTX
ASP .NET MVC Introduction & Guidelines
Dev Raj Gautam
 
PPTX
Mvc fundamental
Nguyễn Thành Phát
 
ODP
Why Use MVC?
Jesse Anderson
 
PPTX
MVC Framework
Ashton Feller
 
PPT
MVC Architecture
Prasanna Venkatesh
 
PDF
Model View Controller (MVC)
Javier Antonio Humarán Peñuñuri
 
PDF
Top 40 MVC Interview Questions and Answers | Edureka
Edureka!
 
PPTX
Slide Presentation of MVP Pattern Concept
Bayu Wijaya Permana Putra
 
PPTX
MVVM ( Model View ViewModel )
Ahmed Emad
 
PPTX
ASP.NET MVC.
Ni
 
PPTX
MVVM presentation
Inova LLC
 
PPTX
MVC architecture by Mohd.Awais on 18th Aug, 2017
Innovation Studio
 
PDF
Architecture logicielle #4 : mvc
Jean Michel
 
MVC architecture
Emily Bauman
 
MVC Seminar Presantation
Abhishek Yadav
 
ASP.NET MVC Presentation
Volkan Uzun
 
Design Pattern - MVC, MVP and MVVM
Mudasir Qazi
 
Mvc pattern and implementation in java fair
Tech_MX
 
ASP .NET MVC Introduction & Guidelines
Dev Raj Gautam
 
Mvc fundamental
Nguyễn Thành Phát
 
Why Use MVC?
Jesse Anderson
 
MVC Framework
Ashton Feller
 
MVC Architecture
Prasanna Venkatesh
 
Model View Controller (MVC)
Javier Antonio Humarán Peñuñuri
 
Top 40 MVC Interview Questions and Answers | Edureka
Edureka!
 
Slide Presentation of MVP Pattern Concept
Bayu Wijaya Permana Putra
 
MVVM ( Model View ViewModel )
Ahmed Emad
 
ASP.NET MVC.
Ni
 
MVVM presentation
Inova LLC
 
MVC architecture by Mohd.Awais on 18th Aug, 2017
Innovation Studio
 
Architecture logicielle #4 : mvc
Jean Michel
 

Viewers also liked (6)

PDF
Asp.net interview questions
Akhil Mittal
 
PDF
Mvc interview questions – deep dive jinal desai
jinaldesailive
 
PDF
ASP.NET MVC Interview Questions and Answers by Shailendra Chauhan
Shailendra Chauhan
 
PDF
Jinal desai .net
rohitkumar1987in
 
PDF
3 Things Every Sales Team Needs to Be Thinking About in 2017
Drift
 
PDF
How to Become a Thought Leader in Your Niche
Leslie Samuel
 
Asp.net interview questions
Akhil Mittal
 
Mvc interview questions – deep dive jinal desai
jinaldesailive
 
ASP.NET MVC Interview Questions and Answers by Shailendra Chauhan
Shailendra Chauhan
 
Jinal desai .net
rohitkumar1987in
 
3 Things Every Sales Team Needs to Be Thinking About in 2017
Drift
 
How to Become a Thought Leader in Your Niche
Leslie Samuel
 
Ad

Similar to IntroductionToMVC (20)

PPT
Mvc 130330091359-phpapp01
Jennie Gajjar
 
KEY
Introduction to ASP.NET MVC
LearnNowOnline
 
PDF
Introduction to ASP.NET MVC
Mayank Srivastava
 
PDF
IRJET- MVC Framework: A Modern Web Application Development Approach and Working
IRJET Journal
 
ODP
Model View Controller
Madhukar Kumar
 
PPT
Web engineering - MVC
Nosheen Qamar
 
PPTX
Asp.net c# MVC-5 Training-Day-1 of Day-9
AHM Pervej Kabir
 
PPTX
Introduction to Mvc
claudiu socaci
 
PDF
Targeting Mobile Platform with MVC 4.0
Mayank Srivastava
 
DOCX
Mvc, mvp & mvvm (erp)
Ayesha Maqsood
 
PDF
MVC in PHP
Vineet Kumar Saini
 
PPT
MVC From Beginner to Advance in Indian Style by - Indiandotnet
Indiandotnet
 
PPTX
Intro ASP MVC
KrishnaPPatel
 
PPTX
Very basic of asp.net mvc with c#
Shreejan Acharya
 
PPT
Asp netmvc
hmanjarawala
 
PPT
Mvc architecture
Surbhi Panhalkar
 
PDF
Web App Architectures and Design Patterns
Rui Sousa
 
PPTX
Model View Controller ext4
Pankaj Avhad
 
PPSX
Software Design Patterns
alkuzaee
 
Mvc 130330091359-phpapp01
Jennie Gajjar
 
Introduction to ASP.NET MVC
LearnNowOnline
 
Introduction to ASP.NET MVC
Mayank Srivastava
 
IRJET- MVC Framework: A Modern Web Application Development Approach and Working
IRJET Journal
 
Model View Controller
Madhukar Kumar
 
Web engineering - MVC
Nosheen Qamar
 
Asp.net c# MVC-5 Training-Day-1 of Day-9
AHM Pervej Kabir
 
Introduction to Mvc
claudiu socaci
 
Targeting Mobile Platform with MVC 4.0
Mayank Srivastava
 
Mvc, mvp & mvvm (erp)
Ayesha Maqsood
 
MVC in PHP
Vineet Kumar Saini
 
MVC From Beginner to Advance in Indian Style by - Indiandotnet
Indiandotnet
 
Intro ASP MVC
KrishnaPPatel
 
Very basic of asp.net mvc with c#
Shreejan Acharya
 
Asp netmvc
hmanjarawala
 
Mvc architecture
Surbhi Panhalkar
 
Web App Architectures and Design Patterns
Rui Sousa
 
Model View Controller ext4
Pankaj Avhad
 
Software Design Patterns
alkuzaee
 
Ad

More from Akhil Mittal (20)

PDF
PDFArticle
Akhil Mittal
 
PDF
Diving into VS 2015 Day5
Akhil Mittal
 
PDF
Diving into VS 2015 Day4
Akhil Mittal
 
PDF
Diving into VS 2015 Day3
Akhil Mittal
 
PDF
Diving into VS 2015 Day2
Akhil Mittal
 
PDF
Diving into VS 2015 Day1
Akhil Mittal
 
PDF
Agile Release Planning
Akhil Mittal
 
PDF
RESTfulDay9
Akhil Mittal
 
PDF
PDF_Article
Akhil Mittal
 
PDF
RESTful Day 7
Akhil Mittal
 
PDF
RESTful Day 6
Akhil Mittal
 
DOCX
Generic Repository Pattern in MVC3 Application with Entity Framework
Akhil Mittal
 
DOCX
Repository Pattern in MVC3 Application with Entity Framework
Akhil Mittal
 
DOCX
MVC Application using EntityFramework Code-First approach Part4
Akhil Mittal
 
DOCX
Learning MVC Part 3 Creating MVC Application with EntityFramework
Akhil Mittal
 
DOCX
LearningMVCWithLINQToSQL
Akhil Mittal
 
PDF
RESTful Day 5
Akhil Mittal
 
PDF
C sharp and asp.net interview questions
Akhil Mittal
 
PDF
Diving in OOP (Day 1) : Polymorphism and Inheritance (Early Binding/Compile T...
Akhil Mittal
 
PDF
Custom URL Re-Writing/Routing using Attribute Routes in MVC 4 Web APIs
Akhil Mittal
 
PDFArticle
Akhil Mittal
 
Diving into VS 2015 Day5
Akhil Mittal
 
Diving into VS 2015 Day4
Akhil Mittal
 
Diving into VS 2015 Day3
Akhil Mittal
 
Diving into VS 2015 Day2
Akhil Mittal
 
Diving into VS 2015 Day1
Akhil Mittal
 
Agile Release Planning
Akhil Mittal
 
RESTfulDay9
Akhil Mittal
 
PDF_Article
Akhil Mittal
 
RESTful Day 7
Akhil Mittal
 
RESTful Day 6
Akhil Mittal
 
Generic Repository Pattern in MVC3 Application with Entity Framework
Akhil Mittal
 
Repository Pattern in MVC3 Application with Entity Framework
Akhil Mittal
 
MVC Application using EntityFramework Code-First approach Part4
Akhil Mittal
 
Learning MVC Part 3 Creating MVC Application with EntityFramework
Akhil Mittal
 
LearningMVCWithLINQToSQL
Akhil Mittal
 
RESTful Day 5
Akhil Mittal
 
C sharp and asp.net interview questions
Akhil Mittal
 
Diving in OOP (Day 1) : Polymorphism and Inheritance (Early Binding/Compile T...
Akhil Mittal
 
Custom URL Re-Writing/Routing using Attribute Routes in MVC 4 Web APIs
Akhil Mittal
 

IntroductionToMVC

  • 1. Learning MVC-Part 1 Introductionto MVC Architecture and Separationof Concerns Introduction: After having gone through numerous of blogs and articles, I came to a conclusion that very few of the genuine writers haveexplained the topic from basics to its details in a full-fledged way with a working application. My effort in this MVC articles series would be to cover almost all the aspects of MVC starting from creating simple app and connecting with the databasewith various Microsoftproviders. We’llbe gradually moving forward partby part to understand and practically implement all the scenarios. Road Map: Part1: Introduction to MVC architecture and Separation of Concerns. Part 2: Creating MVC Application from scratch and connecting it with databaseusing LINQ to SQL. Part 3: Connecting the MVC Application with the help of EntityFramework DB-Firstapproach. Part 4: Connecting the MVC Application with the help of EntityFramework Code-First approach. Part 5: Implementing Repository Pattern in MVC Application with EntityFramework. Part 6: Implementing a generic Repository Pattern and Unit Of Work pattern in MVC Application with EntityFramework. All set, now wecan start our journey with Part1.
  • 2. Part1: Introduction to MVC architecture and Separation of Concerns. Topics to be covered: 1. What does MVC mean. 2. Understand MVC Architecture. 3. Separation of Concerns Players: Model: The business entity on which the overallapplication operates. Many applications usea persistentstorage mechanism(such as a database) to storedata. MVC does not specifically mention the data access layer becauseit is understood to be encapsulated by the Model. View: The user interface that renders the model into a formof interaction. Controller: Handles a request froma view and updates the model that results a change in Model’s state. To implement MVC in .NET weneed mainly three classes (View, Controller and the Model). MVC Architecture: The choice of MVC comes when wego for a solution where separation of concerns, ease of maintainability and extensibility of an application matters a lot. As per the architecture given below, we can see the request-responseflow of a MVC application. The architecture is self explanatory in itself. Browser as usualsends a requestto IIS,IIS searches for the route defined in MVC application and passes requestto the controller as per route, the controller communicates with model and passes the populated model(entity) to View(frontend), Views are populated with model properties, and are rendered on the
  • 3. browser, passing theresponseto browser through IISvia controllers which invoked the particular View. Separation of Concern: As per Wikipedia 'the process of breaking a computer programinto distinct features that overlap in functionality as little as possible'. MVC design pattern aims to separatecontent frompresentation and data-processing fromcontent. Theoretically well, but where do wesee this in MVC? Oneis reasonably clear - between the data-processing (Model) and the restof the application. When we talk about Views and Controllers, their ownership itself explains separation.The views are justthe presentation formof an application, it does not haveto know specifically about the requests coming fromcontroller. The Model is independent of View and Controllers, it only holds business entities that can be passed to any View by controller as per need of exposing them to end user.Thecontroller in independent of Views and Models, its sole purposeis to handle requests and pass it on as per the routes defined and as per need of rendering views.Thus our business entities(model), business logic(controllers) and presentation logic(views) lie in logical/physical layers independent of each other. Conclusion: Now we know why and whereto useMVC, in another partof learning MVC we’ll be creating a MVC application fromscratch, exploring the practical implementation of MVC.