01 - Intro, MVC
MVC
- MVC pattern is from SmallTalk team, first academic paper is from year 1979
- By the original definition
- MODEL – business info and logic
- VIEW – visual (partial) representation of model
- CONTROLLER – middle part in between user and system
- Derivatives: MVP, MVVM, ...
Modern web uses the same pattern – html as model, css as view and browser as controller
MVC Separation
Why MVC?
- Separation of Concerns – business logic (model) and user interface (view) should be separated from each other. BL/Model represent our understanding of real world, UI is just for presentation and manipulation
- Business logic should be totally independent
- Business logic should be able to support several different UI-s
- Controller intermediates between BL and UI
- Good teamwork, testable code
MS Web Technologies
MS has several Web technologies
- .NET and ASP.NET Core
- Multiplatform (Win, macOS, Linux), modular, extremely fast, modern, open source
- ASP.NET MVC is predecessor to ASP.NET Core, tightly coupled to IIS and Windows .NET framework.
- WebForms is even older technology (Sharepoint)
- Similar to desktop development
- Unclean and cluttered html, state is saved into html
- Lots of readymade components
- Every page has its own code behind
Demo - Contact App
Exam practical excercise
Create a simple web application, that manages basic contact database and allows searches from it
Required features
- Add, change and remove Persons, Contacts and Contact Types
- Add n comments to Persons (creation Date and time)
- Statistics and detail views about Person and Contact Type
- Search functionality in
- persons (First name, Last Name, Company)
- contacts (contact type and value)
- Removal of persons and contacts – logical and hard delete
- Every logged in user has its own contacts
UOW, Repos, i18n are not required. ViewModels, nullable ref types, etc. are required.