Lecture 4: ASP.NET MVC Framework · Parallel development Front-end developers and back-end...

22
Lecture 4: ASP.NET MVC Framework School of Engineering, The University of Tokyo

Transcript of Lecture 4: ASP.NET MVC Framework · Parallel development Front-end developers and back-end...

Page 1: Lecture 4: ASP.NET MVC Framework · Parallel development Front-end developers and back-end developers can work in parallel Code reuse Same components can be refactored for different

Lecture 4: ASP.NET MVC Framework

School of Engineering, The University of Tokyo

Page 2: Lecture 4: ASP.NET MVC Framework · Parallel development Front-end developers and back-end developers can work in parallel Code reuse Same components can be refactored for different

https://snowballsutokyo.wordpress.com/

Page 3: Lecture 4: ASP.NET MVC Framework · Parallel development Front-end developers and back-end developers can work in parallel Code reuse Same components can be refactored for different

What is a web application framework?

Can you mention some web frameworks?

Why do we need web frameworks?

Page 4: Lecture 4: ASP.NET MVC Framework · Parallel development Front-end developers and back-end developers can work in parallel Code reuse Same components can be refactored for different

A web framework is a software framework designed to support

the development of web applications

Page 5: Lecture 4: ASP.NET MVC Framework · Parallel development Front-end developers and back-end developers can work in parallel Code reuse Same components can be refactored for different

What is a software framework?

A software framework provides standard low-level features to build and deploy applications.

Consists of compilers, code libraries, tool sets, and application programming interfaces (APIs).

Page 6: Lecture 4: ASP.NET MVC Framework · Parallel development Front-end developers and back-end developers can work in parallel Code reuse Same components can be refactored for different

.NET Framework

Page 7: Lecture 4: ASP.NET MVC Framework · Parallel development Front-end developers and back-end developers can work in parallel Code reuse Same components can be refactored for different

Why do we need web frameworks?

Work directly with HTTP request and responses

Make route requests to the appropriate handler

Make it easy to access data in the request

Abstract and simplify database access

Render data

Page 8: Lecture 4: ASP.NET MVC Framework · Parallel development Front-end developers and back-end developers can work in parallel Code reuse Same components can be refactored for different

A Brief History of Web Frameworks

Page 9: Lecture 4: ASP.NET MVC Framework · Parallel development Front-end developers and back-end developers can work in parallel Code reuse Same components can be refactored for different
Page 10: Lecture 4: ASP.NET MVC Framework · Parallel development Front-end developers and back-end developers can work in parallel Code reuse Same components can be refactored for different

Comparison of Popular Web Frameworks

Framework ASP.NET Ruby on Rails ExpressJS Flask

Release Data 2002 2004 2010 2010

Architecture MVC MVC MEAN Stack WSGI

Language C# Ruby JavaScript Python

Platform .NET Ruby NodeJS Python

Open Source Yes (platform is not)

Yes Yes Yes

Page 11: Lecture 4: ASP.NET MVC Framework · Parallel development Front-end developers and back-end developers can work in parallel Code reuse Same components can be refactored for different

What is MVC?A software architecture

Frozen Spots

Hot Spots

Software Framework = +

Define overall architecture of

a software system

(i.e. its basic components and

the relationships between

them)

Added functionality specific

to the developed project

Page 12: Lecture 4: ASP.NET MVC Framework · Parallel development Front-end developers and back-end developers can work in parallel Code reuse Same components can be refactored for different

What are the components in MVC?

• Retrieve data from

database according

to commands from

controller

• Store data to

databaseCONTROLLER

MODEL

VIEW

• Output representation of

information

• User Interface

• Handles user

request

• Convert to

commands for

MODEL and VIEW

• Extra actions such

as data mining

Page 13: Lecture 4: ASP.NET MVC Framework · Parallel development Front-end developers and back-end developers can work in parallel Code reuse Same components can be refactored for different

Where are M, V, C in the code?

Page 14: Lecture 4: ASP.NET MVC Framework · Parallel development Front-end developers and back-end developers can work in parallel Code reuse Same components can be refactored for different

MVC WorkflowExample 1: retrieve Fitbit data

I want to see my sleep data

CONTROLLER MODEL

VIEW

Request or command Data or GUI content

HTTP request

Get Fitbit sleep data

OAuth2Sleep data

Sleep data

Process sleep data

Bar charts

HTTP response

Here you go!

Sleep data

Page 15: Lecture 4: ASP.NET MVC Framework · Parallel development Front-end developers and back-end developers can work in parallel Code reuse Same components can be refactored for different

MVC WorkflowExample 2: log diary data

I want to log my stress

CONTROLLER MODEL

VIEW

Request or command Data or GUI content

HTTP request/ data Update

database

Confirmation

Today’s log saved

HTTP response

Today’s log saved

Stress data

Confirmation

Page 16: Lecture 4: ASP.NET MVC Framework · Parallel development Front-end developers and back-end developers can work in parallel Code reuse Same components can be refactored for different

What MVC is good for?

Page 17: Lecture 4: ASP.NET MVC Framework · Parallel development Front-end developers and back-end developers can work in parallel Code reuse Same components can be refactored for different

What is MVC good for?

Parallel development

Front-end developers and back-end developers can work in parallel

Code reuse

Same components can be refactored for different apps

Easy modification

Future development or modification is easier because of low coupling among components

Page 18: Lecture 4: ASP.NET MVC Framework · Parallel development Front-end developers and back-end developers can work in parallel Code reuse Same components can be refactored for different

What is ASP.NET MVC?

• ASP.NET is an open-source server-

side web application framework.

• ASP.NET MVC places almost the

entire model, view and controller

logic on the server

(thin client approach)

• https://blogs.msdn.microsoft.com/alchemist/2016/05/31/concept-of-software-framework/

• https://developer.mozilla.org/en-US/docs/Learn/Server-side/First_steps/Web_frameworks

Page 19: Lecture 4: ASP.NET MVC Framework · Parallel development Front-end developers and back-end developers can work in parallel Code reuse Same components can be refactored for different

Hands-on Tasks

Deploy SleepBeta to your Azure cloud

Configure continuous deployment (or not)

Page 20: Lecture 4: ASP.NET MVC Framework · Parallel development Front-end developers and back-end developers can work in parallel Code reuse Same components can be refactored for different

Continuous Deployment from DevOps to Azure

Page 21: Lecture 4: ASP.NET MVC Framework · Parallel development Front-end developers and back-end developers can work in parallel Code reuse Same components can be refactored for different

• Build: source code → executable code →standalone artifacts (including dynamic link libraries and executable code) that can be run on a computer

• Deploy: compiling all codes into assemblies, and copying the aspx page and assemblies to the location where it will be run (e.g. cloud)

Page 22: Lecture 4: ASP.NET MVC Framework · Parallel development Front-end developers and back-end developers can work in parallel Code reuse Same components can be refactored for different

Dr. Zilu Liang [email protected]

https://snowballsutokyo.wordpress.com/

Your feedback is appreciated !

All icons are from the Internet. We do not own their copyright.