tdd, di, and soc with asp.net mvc presented by jeffrey palermo cto, headspring systems microsoft...
DESCRIPTION
INETA - The Face of.NET World-wide association of.NET User Groups –860+ groups world-wide –Over 810,000 developers Started and run by.NET User Group leaders Sponsors and supports both.NET and other professional user groups all around the world Sponsors –Microsoft –Verio –New sponsors welcome! North America (NorAm) INETA Speaker Bureau consists of 67 world-renowned speakersTRANSCRIPT
![Page 1: TDD, DI, and SoC with ASP.NET MVC Presented by Jeffrey Palermo CTO, Headspring Systems Microsoft MVP, MCSD.Net](https://reader031.vdocuments.us/reader031/viewer/2022012914/5a4d1b297f8b9ab05999871b/html5/thumbnails/1.jpg)
TDD, DI, and SoC with ASP.NET MVC
Presented byJeffrey PalermoCTO, Headspring SystemsMicrosoft MVP, [email protected]
![Page 2: TDD, DI, and SoC with ASP.NET MVC Presented by Jeffrey Palermo CTO, Headspring Systems Microsoft MVP, MCSD.Net](https://reader031.vdocuments.us/reader031/viewer/2022012914/5a4d1b297f8b9ab05999871b/html5/thumbnails/2.jpg)
Agenda
•What is ASP.NET MVC?•Sound architectural approach•Soc – Separation of Concerns•DI – Dependency Injection•TDD – Test-Driven Development•Questions
![Page 3: TDD, DI, and SoC with ASP.NET MVC Presented by Jeffrey Palermo CTO, Headspring Systems Microsoft MVP, MCSD.Net](https://reader031.vdocuments.us/reader031/viewer/2022012914/5a4d1b297f8b9ab05999871b/html5/thumbnails/3.jpg)
INETA - The Face of .NET• World-wide association of .NET User Groups
– 860+ groups world-wide– Over 810,000 developers
• Started and run by .NET User Group leaders• Sponsors and supports both .NET and other professional user
groups all around the world• Sponsors
– Microsoft– Verio– New sponsors welcome!
• North America (NorAm) INETA Speaker Bureau consists of 67 world-renowned speakers
www.ineta.org
![Page 4: TDD, DI, and SoC with ASP.NET MVC Presented by Jeffrey Palermo CTO, Headspring Systems Microsoft MVP, MCSD.Net](https://reader031.vdocuments.us/reader031/viewer/2022012914/5a4d1b297f8b9ab05999871b/html5/thumbnails/4.jpg)
What is ASP.NET?
ASP.NET• HttpApplication• HttpContext• HttpRequest• HttpResponse• HttpRuntime• HttpUtility• IHttpHandler• IHttpModule
WebForms• Server Lifecycle• Postback• ViewState
ASPX• MasterPages• Themes, Skins• General Templating
![Page 5: TDD, DI, and SoC with ASP.NET MVC Presented by Jeffrey Palermo CTO, Headspring Systems Microsoft MVP, MCSD.Net](https://reader031.vdocuments.us/reader031/viewer/2022012914/5a4d1b297f8b9ab05999871b/html5/thumbnails/5.jpg)
What is ASP.NET MVC?
ASP.NET• HttpApplication• HttpContext• HttpRequest• HttpResponse• HttpRuntime• HttpUtility• IHttpHandler• IHttpModule
Mvc• Routes• Controllers• ViewData• Filters• MvcContribASPX• MasterPages• Themes, Skins• General Templating
![Page 6: TDD, DI, and SoC with ASP.NET MVC Presented by Jeffrey Palermo CTO, Headspring Systems Microsoft MVP, MCSD.Net](https://reader031.vdocuments.us/reader031/viewer/2022012914/5a4d1b297f8b9ab05999871b/html5/thumbnails/6.jpg)
Two types of architecture
• Short-term• Long-lived
![Page 7: TDD, DI, and SoC with ASP.NET MVC Presented by Jeffrey Palermo CTO, Headspring Systems Microsoft MVP, MCSD.Net](https://reader031.vdocuments.us/reader031/viewer/2022012914/5a4d1b297f8b9ab05999871b/html5/thumbnails/7.jpg)
Philosophy
• Software Systems are complex• Maintainability is king• Simplicity rules• Abstraction and the human brain (7+/-2)• ASP.NET MVC is going away• Coupling to infrastructure
![Page 8: TDD, DI, and SoC with ASP.NET MVC Presented by Jeffrey Palermo CTO, Headspring Systems Microsoft MVP, MCSD.Net](https://reader031.vdocuments.us/reader031/viewer/2022012914/5a4d1b297f8b9ab05999871b/html5/thumbnails/8.jpg)
Coupling (Architectural Metrics)
• Afferent Coupling (Ca) – incoming dependencies• Efferent Coupling (Ce) – outgoing dependencies• Instability (I)
– I = Ce / (Ce + Ca) (0 = stable, 1 = instable)– Stable = painful to modify
• Abstractness (A)– # Abstract Types / # Total Types (0 = concrete assembly, 1 = abstract
assembly)
![Page 9: TDD, DI, and SoC with ASP.NET MVC Presented by Jeffrey Palermo CTO, Headspring Systems Microsoft MVP, MCSD.Net](https://reader031.vdocuments.us/reader031/viewer/2022012914/5a4d1b297f8b9ab05999871b/html5/thumbnails/9.jpg)
Traditional Layered Architecture
Data Access/Infrastructure
Business Logic
UI
![Page 10: TDD, DI, and SoC with ASP.NET MVC Presented by Jeffrey Palermo CTO, Headspring Systems Microsoft MVP, MCSD.Net](https://reader031.vdocuments.us/reader031/viewer/2022012914/5a4d1b297f8b9ab05999871b/html5/thumbnails/10.jpg)
Traditional Layered Architecture
Business Logic
UI
Data Access
I/OWCF
![Page 11: TDD, DI, and SoC with ASP.NET MVC Presented by Jeffrey Palermo CTO, Headspring Systems Microsoft MVP, MCSD.Net](https://reader031.vdocuments.us/reader031/viewer/2022012914/5a4d1b297f8b9ab05999871b/html5/thumbnails/11.jpg)
Web Service
File
Solution Structure
UI Business Logic
Data Access
DB
Infrastructure
![Page 12: TDD, DI, and SoC with ASP.NET MVC Presented by Jeffrey Palermo CTO, Headspring Systems Microsoft MVP, MCSD.Net](https://reader031.vdocuments.us/reader031/viewer/2022012914/5a4d1b297f8b9ab05999871b/html5/thumbnails/12.jpg)
Better layering
Business Logic(service classes)
UI Data Access
I/OWCF
Object Model (business logic)
![Page 13: TDD, DI, and SoC with ASP.NET MVC Presented by Jeffrey Palermo CTO, Headspring Systems Microsoft MVP, MCSD.Net](https://reader031.vdocuments.us/reader031/viewer/2022012914/5a4d1b297f8b9ab05999871b/html5/thumbnails/13.jpg)
Onion Architecture
Object Model
Object Services
Application Services
User Interface
Infrastr
ucture
Tests
DB
Web Service
FileApplication Core
LoginController
IUserSessionIEmployeeRepository
HttpUserSession<<class>>
EmployeeRepository<<class>>
EmployeeEmployeeSelectList
![Page 14: TDD, DI, and SoC with ASP.NET MVC Presented by Jeffrey Palermo CTO, Headspring Systems Microsoft MVP, MCSD.Net](https://reader031.vdocuments.us/reader031/viewer/2022012914/5a4d1b297f8b9ab05999871b/html5/thumbnails/14.jpg)
Web Service
File
Solution Structure
UI Core
Infrastructure
DB
IoC Container
![Page 15: TDD, DI, and SoC with ASP.NET MVC Presented by Jeffrey Palermo CTO, Headspring Systems Microsoft MVP, MCSD.Net](https://reader031.vdocuments.us/reader031/viewer/2022012914/5a4d1b297f8b9ab05999871b/html5/thumbnails/15.jpg)
Demo ahead (all code)
![Page 16: TDD, DI, and SoC with ASP.NET MVC Presented by Jeffrey Palermo CTO, Headspring Systems Microsoft MVP, MCSD.Net](https://reader031.vdocuments.us/reader031/viewer/2022012914/5a4d1b297f8b9ab05999871b/html5/thumbnails/16.jpg)
MvcContrib
• http://mvccontrib.org • Founded by Eric Hexter and Jeffrey Palermo• Multiple view engines• ViewDataExtensions• IoC Container support• Html helpers• Extra ActionFilters• Anything else the community contributes
![Page 17: TDD, DI, and SoC with ASP.NET MVC Presented by Jeffrey Palermo CTO, Headspring Systems Microsoft MVP, MCSD.Net](https://reader031.vdocuments.us/reader031/viewer/2022012914/5a4d1b297f8b9ab05999871b/html5/thumbnails/17.jpg)
About me
• CTO, Headspring Systems• Agile coach• MCSD.Net• Microsft MVP, ASPInsider• Certified ScrumMaster• Austin .Net User Group• INETA speakers bureau• U.S. Army Veteran• Party with Palermo• www.partywithpalermo.com• Headspring’s Agile Boot Camp