Ruby on Rails vs ASP.NET MVC - Bitbucket

burnwholeInternet και Εφαρμογές Web

5 Φεβ 2013 (πριν από 4 χρόνια και 5 μήνες)

100 εμφανίσεις

Real Life ASP.MVC

KEA September 22 2011

Christian Dalager, Eksponent ApS

Me

.NET developer, Eksponent ApS

Lead on Arena365.com

C#, Ruby, Java, PHP, Perl

Background in Nordic Language and
Literature

+ IT University




ASP.NET MVC

MVC a what??

Model View Controller design pattern

Separates data, presentation og logic



MVC parts

View


Webforms view engine <%= ”yay” %>


Alternatives: Razor (MVC3), Spark,Nhaml

Controller


Core framework


public class MyController: BaseController{}

Model


... nothing...

The Missing M

No builtin database/persistence features

Lots of options


Entity Framework / linq2sql


NHibernate / Castle ActiveRecord


Subsonic


External services (WCF
i.e
)


Home made DataAccessLayer with SQL
statements (sooo 2003)


Arena365


Case

Arena365.com

Social tool for active lifestyle, for groups
and individuals

Track your training, manage your teams

Google maps / Routes

Facebook Integration

Campaigns

7
.500 users


Arena365 DEMO

Arena365

NHibernate

Database

Repository

Service

Controllers

Console
App

Windows
service

Repository

Repository

Repository

Service

Views

iCal

XML

CSV

JSON

Service

Facebook, RSS, Maps, Twitter,
GetSatisfaction
,
MailChimp
.

CMS

Cache

ViewModels

Building
blocks

DI Containers

Logging

Caching

Error reporting

Mail sending

Facebook
integration

iCal feeds

Import routes

Import RSS

CMS functionality

Security/ACL

Build scripts

UnitTests

Source Control


Show me the code!

#
lines of
C# code
(LOC) 17 157

# lines of comment 4 010

Percentage Comment 18%

# Assemblies 11

# Namespaces 112

# Types 1 185

# Methods 7 658

# Fields 3 284

Complex Systems are.. complex

Requirements change over time

Build for change

YAGNI (you aint gonna need it)

Pragmatism vs Idealism

Arkitektur

http://www.iwaysoftware.com/solutions/by_integration/DataIntegrationSolutions.html

http://techpubs.sgi.com/library/tpl/cgi
-
bin/getdoc.cgi?coll=linux&db=bks&fname=/SGI_EndUser/GC_Hdwr_UG/ch01.html


http://
www.elbet.rs/sport_betting_software
/

Hands
-
on

Agenda

Skinny controllers

ViewModels

Dependency Injection

AutoMapper

ModelBinders




ASP.NET MVC

Model

View

Controller

Architecture i
MVC

ASP.NET MVC

ViewModel

View

Controller

Data /

Business
logic

Domain model

DB

Architecture

in

MVC

ViewModels

Flattened

classes

Tailor

made for
views

Projections


/product/list

/product/show/3

/product/edit/3


Skinny

Controllers

Keep

your

methods

small

Keep

your

dependency

count

down

Keep

your

controllers
skinny


Benefits


Reusability


Testability


The
essentials

may

always

fit

your

screen


TIME TO DO THE CODES

Dependency

Injection

AutoMapper

ModelBinders

Arkitektur

Solution
-
layout

Ask
Questions

How
big

is
this

beast

gonna

get
?!

How
many

entities

do
you

have?

How
many

controllers
will

you

need
?

How long do
you

expect

your

app

to live?

Are
there

many

stakeholders

that

together

define

the
project

scope
?

Will the
project

change

directions

before

it’s

done? (Funding
will

do
this

to
you
)

Is the
project

an
exploratory

journey

or do
you

know

exactly

where

you

will

end?

How
many

integrationpoints

do
you

have?


Thank you. I love
you

<3

christian@eksponent.com


Blog

dalager.com


Tweets

twitter.com/
dalager


Source Code / Presentation

bitbucket.org/
dalager
/


Job?

job.eksponent.com/