Upload
christian-horsdal
View
1.298
Download
0
Tags:
Embed Size (px)
DESCRIPTION
In the .NET space the overwhelming majority of web projects are built with ASP.NET in one form or another. But there are alternatives. Alternatives that offer other approaches, and supports other ways of thinking.Alternatives that are open source. Altenratives that run on Mono. Maybe one of those alternatives is the better fit for your next project - except if you don't know about them you will never know. In this code heavy talk I'll show the same sample application in the three Open Source .NET web frameworks FubuMVC, OpenRasta, and Nancy. You will not become an expert at anything by attending this talk - but you may discover just the right web framework for your next project.
Citation preview
Three web frameworks All .NET
One hour Go
Christian Horsdal@chr_horsdal
horsdal.blogspot.com
Thanks to the sponsors
• Lead Software Architect @ Mjølner Informatics• Denmark• Husband and Father• Some who enjoys– Clean code– TDD’ing– When Denmarks wins at football– Simplicity– Whisky
Who Am I?
• There are alternatives to ASP.NET – Even on .NET– Know them!
• Style matters
• Tradeoffs, tradeoffs, tradeoffs– Conventions <-----> explicitness– DRY <-----> separation of concerns– Abstract <-----> concrete
Why?
• Run anywhere
• IoC/DI to the bone
• Embrace HTTP
• OSS and community driven
Why?
A taste of some alternatives
• FubuMVC
• OpenRasta
• Nancy
What will you learn?
Sample
• One Model In One Model Out– Aka OMIOMO– Aka Russian Doll
• Convention over Configuration
• Really cool built-in diagnostics
• Everything is POCOs
FubuMVC – At a glance
GET “/” • No params
HomeController.get_Home
• Returns HomeViewModel
HomeView.cshtml • Takes HomeViewModel
FubuMVC – ShortUrl Overview
FubuMVC – ShortUrl Overview
POST “/” • UrlShorteningModel
HomeController.post_Home
• Takes UrlShorteningModel• Returns UrlShorteningViewModel
post_url_result.cshtml • Takes UrlShorteningVM
FubuMVC – ShortUrl Overview
GET “/42” • ShortenedUrlModel
HomeController.get_Url• Takes ShortenedUrlMode• Returns FubuContinuation
FubuMVC
Show me the code!
• Three things:– Resources– Handlers– Codecs
• Automatic conneg
• Everything is POCOs
OpenRasta– At a glance
• Resource:– “/”– “/{shortenedUrl}”– Home
GET “/” POST “/” GET “/42”
OpenRasta – Shorturl Overview
• Handler– HomeHandler
Home resourceHomeHandler
OpenRasta – Shorturl Overview
• “Codecs”– WebForms viewengine– Form data
Home resourceHomeHandler
GET “/” POST “/” GET “/42”
OpenRasta – Shorturl Overview
OpenRasta
Show me the code!
• Lightweight, low ceremony– Just works– But easily swappable– DSLs
• Built in diagnostics
• Automatic conneg
• Testability is first class
Nancy– At a glance
• Modules– ShortUrlModule
HTTP request Routes Handler
function Response
Nancy – Shorturl Overview
HTTP request Routes Handler
function Response
Nancy – Shorturl Overview
• Routes– Get[“/”]– Post[“/”]– Get[“/{shortenedUrl}”]
• A lambda for each
HTTP request Routes Handler
function Response
Nancy – Shorturl Overview
Nancy
Show me the code!
Why, again? There are alternatives to ASP.NET
Know them!
Style matters
Tradeoffs, tradeoffs, tradeoffs
• FubuMVC– OMIOMU
• OpenRasta – Resources, Handlers, Codecs
• Nancy– DSL
What might you have learned?A taste of some altenatives
WHEN, WHAT, WHERE?FubuMVC, OpenRasta, Nancy
Please rate this sessionScan the code, go online, rate this session
Christian Horsdal@chr_horsdal
horsdal.blogspot.com