26
Three web frameworks All .NET One hour Go Christian Horsdal @chr_horsdal horsdal.blogspot.com

Three Other Web Frameworks. All .NET. All OSS. One Hour. Go

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

Page 1: Three Other Web Frameworks. All .NET. All OSS. One Hour. Go

Three web frameworks All .NET

One hour Go

Christian Horsdal@chr_horsdal

horsdal.blogspot.com

Page 2: Three Other Web Frameworks. All .NET. All OSS. One Hour. Go

Thanks to the sponsors

Page 3: Three Other Web Frameworks. All .NET. All OSS. One Hour. Go

• 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?

Page 4: Three Other Web Frameworks. All .NET. All OSS. One Hour. Go

• 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?

Page 5: Three Other Web Frameworks. All .NET. All OSS. One Hour. Go

• Run anywhere

• IoC/DI to the bone

• Embrace HTTP

• OSS and community driven

Why?

Page 6: Three Other Web Frameworks. All .NET. All OSS. One Hour. Go

A taste of some alternatives

• FubuMVC

• OpenRasta

• Nancy

What will you learn?

Page 7: Three Other Web Frameworks. All .NET. All OSS. One Hour. Go

Sample

Page 8: Three Other Web Frameworks. All .NET. All OSS. One Hour. Go

• 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

Page 9: Three Other Web Frameworks. All .NET. All OSS. One Hour. Go

GET “/” • No params

HomeController.get_Home

• Returns HomeViewModel

HomeView.cshtml • Takes HomeViewModel

FubuMVC – ShortUrl Overview

Page 10: Three Other Web Frameworks. All .NET. All OSS. One Hour. Go

FubuMVC – ShortUrl Overview

POST “/” • UrlShorteningModel

HomeController.post_Home

• Takes UrlShorteningModel• Returns UrlShorteningViewModel

post_url_result.cshtml • Takes UrlShorteningVM

Page 11: Three Other Web Frameworks. All .NET. All OSS. One Hour. Go

FubuMVC – ShortUrl Overview

GET “/42” • ShortenedUrlModel

HomeController.get_Url• Takes ShortenedUrlMode• Returns FubuContinuation

Page 12: Three Other Web Frameworks. All .NET. All OSS. One Hour. Go

FubuMVC

Show me the code!

Page 13: Three Other Web Frameworks. All .NET. All OSS. One Hour. Go

• Three things:– Resources– Handlers– Codecs

• Automatic conneg

• Everything is POCOs

OpenRasta– At a glance

Page 14: Three Other Web Frameworks. All .NET. All OSS. One Hour. Go

• Resource:– “/”– “/{shortenedUrl}”– Home

GET “/” POST “/” GET “/42”

OpenRasta – Shorturl Overview

Page 15: Three Other Web Frameworks. All .NET. All OSS. One Hour. Go

• Handler– HomeHandler

Home resourceHomeHandler

OpenRasta – Shorturl Overview

Page 16: Three Other Web Frameworks. All .NET. All OSS. One Hour. Go

• “Codecs”– WebForms viewengine– Form data

Home resourceHomeHandler

GET “/” POST “/” GET “/42”

OpenRasta – Shorturl Overview

Page 17: Three Other Web Frameworks. All .NET. All OSS. One Hour. Go

OpenRasta

Show me the code!

Page 18: Three Other Web Frameworks. All .NET. All OSS. One Hour. Go

• Lightweight, low ceremony– Just works– But easily swappable– DSLs

• Built in diagnostics

• Automatic conneg

• Testability is first class

Nancy– At a glance

Page 19: Three Other Web Frameworks. All .NET. All OSS. One Hour. Go

• Modules– ShortUrlModule

HTTP request Routes Handler

function Response

Nancy – Shorturl Overview

Page 20: Three Other Web Frameworks. All .NET. All OSS. One Hour. Go

HTTP request Routes Handler

function Response

Nancy – Shorturl Overview

• Routes– Get[“/”]– Post[“/”]– Get[“/{shortenedUrl}”]

Page 21: Three Other Web Frameworks. All .NET. All OSS. One Hour. Go

• A lambda for each

HTTP request Routes Handler

function Response

Nancy – Shorturl Overview

Page 22: Three Other Web Frameworks. All .NET. All OSS. One Hour. Go

Nancy

Show me the code!

Page 23: Three Other Web Frameworks. All .NET. All OSS. One Hour. Go

Why, again? There are alternatives to ASP.NET

Know them!

Style matters

Tradeoffs, tradeoffs, tradeoffs

Page 24: Three Other Web Frameworks. All .NET. All OSS. One Hour. Go

• FubuMVC– OMIOMU

• OpenRasta – Resources, Handlers, Codecs

• Nancy– DSL

What might you have learned?A taste of some altenatives

Page 25: Three Other Web Frameworks. All .NET. All OSS. One Hour. Go

WHEN, WHAT, WHERE?FubuMVC, OpenRasta, Nancy

Page 26: Three Other Web Frameworks. All .NET. All OSS. One Hour. Go

Please rate this sessionScan the code, go online, rate this session

Christian Horsdal@chr_horsdal

horsdal.blogspot.com