Top Banner
REAL WORLD HTML5 & MVC LESSONS LEARNED Zoltán Dávid [email protected] György Balássy [email protected]
51

Real World HTML5 + ASP.NET MVC - Lessons Learned

Nov 01, 2014

Download

Technology

Zoltán Dávid

ASP.NET + HTML5 + Azure Experiences.

The session was held in at Ms Days on 29th March, 2012, Sofia, Bulgaria
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Real World HTML5 + ASP.NET MVC - Lessons Learned

REAL WORLD HTML5 & MVC LESSONS LEARNED

Zoltán Dávid

[email protected] György Balássy

[email protected]

Page 2: Real World HTML5 + ASP.NET MVC - Lessons Learned

AGENDA

The story

HTML5 games

Don’t write, sketch

HTML5 sitebuild

A good server-side for a good sitebuild

Cloud – a place to put your stuff

Conclusions & What we learned

Page 3: Real World HTML5 + ASP.NET MVC - Lessons Learned

I HAD A DREAM…

Page 4: Real World HTML5 + ASP.NET MVC - Lessons Learned

GOALS

3 games

Page 5: Real World HTML5 + ASP.NET MVC - Lessons Learned

GOALS

a website

Page 6: Real World HTML5 + ASP.NET MVC - Lessons Learned

GOALS

a tutorial

Page 7: Real World HTML5 + ASP.NET MVC - Lessons Learned

CLIENT TECNOLOGIES

html5

+

javascript

Page 8: Real World HTML5 + ASP.NET MVC - Lessons Learned

TIME

25 days

Page 9: Real World HTML5 + ASP.NET MVC - Lessons Learned

TEAM

Page 10: Real World HTML5 + ASP.NET MVC - Lessons Learned

DEMO

html5jatekok.hu

Page 11: Real World HTML5 + ASP.NET MVC - Lessons Learned

MINI GAME WEBSITE

Page 12: Real World HTML5 + ASP.NET MVC - Lessons Learned

SOFTWARE DEVELOPMENT

PROCESS

buzzword driven development

Page 13: Real World HTML5 + ASP.NET MVC - Lessons Learned

CORE TECHNOLOGIES

Page 14: Real World HTML5 + ASP.NET MVC - Lessons Learned

CORE TECHNOLOGIES

Page 15: Real World HTML5 + ASP.NET MVC - Lessons Learned

THE WHOLE TECHNOLOGY

PICTURE

Page 16: Real World HTML5 + ASP.NET MVC - Lessons Learned

Many project experiences

• Web Development

• ASP.NET WebFroms

• MS SQL

• Entity Framework

• Visual Studio

From the ivory tower

• ASP.NET MVC

• Razor Syntax

• Azure

• HTML5 sitebuild

• Game development

• Javascript Application

development

Page 17: Real World HTML5 + ASP.NET MVC - Lessons Learned

DECISIONS

test early and often

Page 18: Real World HTML5 + ASP.NET MVC - Lessons Learned

DECISIONS

have a Plan B

Page 19: Real World HTML5 + ASP.NET MVC - Lessons Learned

AGENDA

The story

HTML5 games

Don’t write, sketch

HTML5 sitebuild

A good server-side for a good sitebuild

Cloud – a place to put your stuff

Conclusions & What we learned

Page 20: Real World HTML5 + ASP.NET MVC - Lessons Learned

PLAN

Page 21: Real World HTML5 + ASP.NET MVC - Lessons Learned

GRAPHICS

images

Page 22: Real World HTML5 + ASP.NET MVC - Lessons Learned

GRAPHICS

<canvas id="game" width="600" height="480">

canvas not supported…

</canvas>

var canvas = document.getElementById('game');

var context = canvas.getContext('2d');

var pipe= new Image();

pipe.src = 'pipe.png';

context.drawImage(pipe,x,y);

Page 23: Real World HTML5 + ASP.NET MVC - Lessons Learned

ANIMATIONS

var timer = window.setInterval(draw,50);

function draw() {

now = new Date().getTime();

deltat = now – prevtime;

// compute x,y and draw

prevtime = now;

}

Page 24: Real World HTML5 + ASP.NET MVC - Lessons Learned

SOUND

<audio id="main_theme">

<source src="bg_theme.mp3">

<source src="bg_theme.ogg">

</audio>

var music = document.getElementById(‘bg_theme');

music.volume = 0.2;

music.loop = true;

music.play();

Page 25: Real World HTML5 + ASP.NET MVC - Lessons Learned

LARGE JS APPLICATIONS

• Feature detection

• Polyfills

• Structuring code

• Code quality

• Bullet-proof Ajax

• Debugging

That’s not your var

JavaScript best practices

for C# developers

Download from:

http://bit.ly/msbg2012

Page 26: Real World HTML5 + ASP.NET MVC - Lessons Learned

AGENDA

The story

HTML5 games

Don’t write, sketch

HTML5 sitebuild

A good server-side for a good sitebuild

Cloud – a place to put your stuff

Conclusions & What we learned

Page 27: Real World HTML5 + ASP.NET MVC - Lessons Learned

SKETCH BEFORE YOU DRILL

Page 28: Real World HTML5 + ASP.NET MVC - Lessons Learned

SKETCH BEFORE YOU DRILL

• Easy to understand

• Easy to spot the

problems

• Easy to describe what

You want

• Disposable

• Enables fast redesign

Page 29: Real World HTML5 + ASP.NET MVC - Lessons Learned

DEMO

Visually Communicate

Page 30: Real World HTML5 + ASP.NET MVC - Lessons Learned

AGENDA

The story

HTML5 games

Don’t write, sketch

HTML5 sitebuild

A good server-side for a good sitebuild

Cloud – a place to put your stuff

Conclusions & What we learned

Page 31: Real World HTML5 + ASP.NET MVC - Lessons Learned

DEMO

Sitebuild

Page 32: Real World HTML5 + ASP.NET MVC - Lessons Learned

AGENDA

The story

We are no game developers

Don’t write, sketch

Viable HTML5 sitebuild

A good server-side for a good sitebuild

Cloud – a place to put your stuff

Conclusions & What we learned

Page 33: Real World HTML5 + ASP.NET MVC - Lessons Learned

WE HAVE A QUESTION

How to transform sitebuild to MVC code?

Page 34: Real World HTML5 + ASP.NET MVC - Lessons Learned

UNDERSTANDING MVC

Page 35: Real World HTML5 + ASP.NET MVC - Lessons Learned

WebForms

• Url maps to file (.aspx)

• File has Controls

• You parameterize

Controls

• Controls render HTML

MVC

• Url maps to C# Method of

a Class

• You choose an HTML

rendering template

• You collect data for the

template

• You feed the template

with the data

Routing Action

Controller

View

Model

UNDERSTANDING MVC

Page 36: Real World HTML5 + ASP.NET MVC - Lessons Learned

DEMO

Views are templates

Page 37: Real World HTML5 + ASP.NET MVC - Lessons Learned

WE HAVE A QUESTION

How to feed a template?

Page 38: Real World HTML5 + ASP.NET MVC - Lessons Learned

DEMO

ViewModels

Page 39: Real World HTML5 + ASP.NET MVC - Lessons Learned

EXPERIENCE

• Lots of data transformation code

• No HTML or javascript problems

• AJAX was extremly easy to integrate

• Using the sitebuild was straightforward

Page 40: Real World HTML5 + ASP.NET MVC - Lessons Learned

AGENDA

The story

HTML5 games

Don’t write, sketch

HTML5 sitebuild

A good server-side for a good sitebuild

Cloud – a place to put your stuff

Conclusions & What we learned

Page 41: Real World HTML5 + ASP.NET MVC - Lessons Learned

EXPERIENCE

table storage

vs

sql azure

learn from

scratch

slower to

develop

works with EF

management

studio

no database

project

deploy

cheap

easy

Page 42: Real World HTML5 + ASP.NET MVC - Lessons Learned

EXPERIENCE

azure BLOB easy to use

files have

URLs

no fine

access

control

no

web.config

no rewrite

rules

case

sensitive

URLs

Page 43: Real World HTML5 + ASP.NET MVC - Lessons Learned

NO REWRITE RULES

easy “iframe integration”

Page 44: Real World HTML5 + ASP.NET MVC - Lessons Learned

CASE SENSITIVE URLS

• windows developers not used to it

• problem for

• javascript games

• developed on windows box

shot[1] = new Audio('sound/shot.mp3');

shot[1].volume = 0.3;

shot[2] = new Audio('sound/shot.mp3');

shot[2].volume = 0.3;

Page 45: Real World HTML5 + ASP.NET MVC - Lessons Learned

DEMO

Uploading to BLOB

Page 46: Real World HTML5 + ASP.NET MVC - Lessons Learned

EXPERIENCE

Access Control

Service

heavyweight needs WIF

in GAC

works

facebook API

changes

follows

changes

Page 47: Real World HTML5 + ASP.NET MVC - Lessons Learned

INSTALLING WIF IN AZURE VM

Install.cmd

@echo off

sc config wuauserv start= demand

wusa.exe "%~dp0Windows6.0-KB974405-x64.msu" /quiet /norestart

sc config wuauserv start= disabled

exit /b 0

ServiceDefinition.csdef

<Startup>

<Task commandLine="Install.cmd“

executionContext="elevated“

taskType="simple" />

</Startup>

Page 48: Real World HTML5 + ASP.NET MVC - Lessons Learned

AGENDA

The story

HTML5 games

Don’t write, sketch

HTML5 sitebuild

A good server-side for a good sitebuild

Cloud – a place to put your stuff

Conclusions & What we learned

Page 49: Real World HTML5 + ASP.NET MVC - Lessons Learned
Page 50: Real World HTML5 + ASP.NET MVC - Lessons Learned

THANK YOU!

Questions?

György Balássy

[email protected]

http://gyorgybalassy.wordpress.com

@gyorgybalassy

Zoltán Dávid

[email protected]

slides and demos:

http://bit.ly/msbg2012

Page 51: Real World HTML5 + ASP.NET MVC - Lessons Learned

HTTP://HTML5JATEKOK.HU