claus brabrand, itu, denmark scripting, databases, & system architectureaug 31, 2012 claus...

28
Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTURE Aug 31, 2012 Claus Brabrand ((( [email protected] ))) Associate Professor, Ph.D. ((( Theoretical Computer Science ))) IT University of Copenhagen introduction to SCRIPTING, DATABASES, SYSTEM ARCHITECTURE

Upload: harry-newman

Post on 03-Jan-2016

222 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTUREAug 31, 2012 Claus Brabrand ((( brabrand@itu.dk ))) Associate Professor, Ph.D

Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTURE Aug 31, 2012

Claus Brabrand((( [email protected] )))

Associate Professor, Ph.D.((( Theoretical Computer Science )))

IT University of Copenhagen

introduction to SCRIPTING, DATABASES,SYSTEM ARCHITECTURE

Page 2: Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTUREAug 31, 2012 Claus Brabrand ((( brabrand@itu.dk ))) Associate Professor, Ph.D

[ 2 ]Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTURE Aug 31, 2012

Agenda for Today

Course Introduction:WelcomeAbout the CourseCourse Schedule and StructureWeb ServicesLast Year’s Exam: “La Pizzeria ”

Page 3: Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTUREAug 31, 2012 Claus Brabrand ((( brabrand@itu.dk ))) Associate Professor, Ph.D

[ 3 ]Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTURE Aug 31, 2012

Teaching

Lectures: FRIDAYS (09:00 – 11:30)

Auditorium 2

Exercise Classes: FRIDAYS (11:30 – 14:00)

GameLab, 4A56, 4A58

Page 4: Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTUREAug 31, 2012 Claus Brabrand ((( brabrand@itu.dk ))) Associate Professor, Ph.D

[ 4 ]Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTURE Aug 31, 2012

Teachers

Lecturer: Claus Brabrand

Teaching Assistants: Håkan Lane Jacob Glerup Bachmand Andersen Line Juhler Schmidt Victor Golubei TA

Page 5: Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTUREAug 31, 2012 Claus Brabrand ((( brabrand@itu.dk ))) Associate Professor, Ph.D

[ 5 ]Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTURE Aug 31, 2012

EducationAarhus UniversityAarhus, Denmark (1992-07)

Aarhus UniversityAarhus, Denmark (1992-07)

M.Sc. (1999) Ph.D. (2003)

Tenure (2007) ( ITU, Sep ’07)

"Domain Specific Languages for

Interactive Web Services”

(2003)

Ph.D. Dissertation:

Page 6: Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTUREAug 31, 2012 Claus Brabrand ((( brabrand@itu.dk ))) Associate Professor, Ph.D

[ 6 ]Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTURE Aug 31, 2012

Université Louis Pasteur,Strasbourg, France (1995-96)

Université Louis Pasteur,Strasbourg, France (1995-96)

IBM Research CenterNew York, USA (2001)IBM Research Center

New York, USA (2001)

INRIA Research CenterBordeaux, France (2003)

INRIA Research CenterBordeaux, France (2003)

Federal Uni. of PernambucoRecife, Brazil (2010)

Federal Uni. of PernambucoRecife, Brazil (2010)

Abroad…

Page 7: Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTUREAug 31, 2012 Claus Brabrand ((( brabrand@itu.dk ))) Associate Professor, Ph.D

[ 7 ]Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTURE Aug 31, 2012

Goal of the Course

To learn how to use…: “web development techniques for

implementing interactive web services that make use of databases to store information”

Prerequisites: HTML (HyperText Markup Language) CSS (Cascading Style Sheets)

This course: PHP (Hypertext Preprocessor) SQL (Structured Query Language) Web Services = PHP + SQL + HTML

GOAL

Page 8: Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTUREAug 31, 2012 Claus Brabrand ((( brabrand@itu.dk ))) Associate Professor, Ph.D

[ 8 ]Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTURE Aug 31, 2012

Intended Learning Outcomes

After the course, you are expected to be able to…:

Intended Learning Outcomes: 1) plan and develop medium sized web applications

using the scripting language, PHP; 2) design small SQL databases; 3) construct PHP scripts that interact with databases using SQL; 4) describe the techniques behind DB-driven web applications; 5) describe the fundamental system architectural considerations

behind web applications so as to be able to communicate and collaborate with programmers and technologists.

Page 9: Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTUREAug 31, 2012 Claus Brabrand ((( brabrand@itu.dk ))) Associate Professor, Ph.D

[ 9 ]Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTURE Aug 31, 2012

Exam

Exam will “measure” to what degree you have acquired the intended learning outcomes:

Individual 48-hour take-home exam: WINTER 2012-2013 (Some time in January)

Note: you may not solicit collaboration during the exam period (constitutes exam fraud)!

Note: 20% will be asked to step aside for a short validation discussion (not part of exam)

Page 10: Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTUREAug 31, 2012 Claus Brabrand ((( brabrand@itu.dk ))) Associate Professor, Ph.D

[ 10 ]Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTURE Aug 31, 2012

Assignments

11 mandatory assignments: You need 10 out of 11 approved

(by mid December) in order to qualify for the exam

Idea: work on assignment during exercise classes that follows each week’s lecture(individual hand-in, collaboration encouraged)

Assignments are handed in by placing them in your personal folder on the ITU network (W:) according to a naming convention (more later)

Page 11: Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTUREAug 31, 2012 Claus Brabrand ((( brabrand@itu.dk ))) Associate Professor, Ph.D

[ 11 ]Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTURE Aug 31, 2012

83 Students in 4 Groups

You will be divided into 4 groups...:

i.e., each group is assigned a TA who will: be available for help (you can ask the other TAs also) correct and approve your assignments

A B

DC

TA TA

TA TA

Page 12: Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTUREAug 31, 2012 Claus Brabrand ((( brabrand@itu.dk ))) Associate Professor, Ph.D

[ 12 ]Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTURE Aug 31, 2012

Help !

Questions of general interest: Course Blog ( blog.itu.dk/DSDS-E2011 ) Teacher, TA’s, or co-students will respond

Questions about specific assignments: Your TA (ask at the exercise class or send email) Please don’t post “spoilers” (half solutions) on the blog!

Personal issues: Your mom or dad …or contact teacher, if relevant

Page 13: Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTUREAug 31, 2012 Claus Brabrand ((( brabrand@itu.dk ))) Associate Professor, Ph.D

[ 13 ]Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTURE Aug 31, 2012

Course Material

Optional Book: “PHP 6 and MySQL 5”

(by Larry Ullman, 2008)

Slides !

…and online material: HTML: ( www.w3school.com/html ) PHP: ( www.w3school.com/php ) SQL: ( www.w3school.com/sql )

Page 14: Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTUREAug 31, 2012 Claus Brabrand ((( brabrand@itu.dk ))) Associate Professor, Ph.D

[ 14 ]Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTURE Aug 31, 2012

Course Schedule + Structure

Structure:PHP 1+2+3 (scripting)SQL 1+2+3 (databases)Web Services 1+2+3 (system architecture)

Schedule on Homepage:( blog.itu.dk/DSDS-E2012/schedule/ )

Page 15: Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTUREAug 31, 2012 Claus Brabrand ((( brabrand@itu.dk ))) Associate Professor, Ph.D

[ 15 ]Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTURE Aug 31, 2012

Why take this Course?!?

“As graduated DDK student from ITU, you will likely be involved in developing IT solutions that in one way or the other involves web site design.”

“Although much of the web development will (probably) be done by software engineers, you need to understand how they build web sites so you can communicate with them.”

In particular: possibilities and limitations !

Page 16: Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTUREAug 31, 2012 Claus Brabrand ((( brabrand@itu.dk ))) Associate Professor, Ph.D

[ 16 ]Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTURE Aug 31, 2012

Why take this Course?!?

HTML can only be used for static pages (in particular: no interaction with users)

PHP can process input from the user and generate resulting dynamically constructed HTML (using information from a database)

SQL can provide such a database

PHP+SQL: very popular for making web services (e.g., Facebook, YouTube, Wikipedia, …)

Page 17: Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTUREAug 31, 2012 Claus Brabrand ((( brabrand@itu.dk ))) Associate Professor, Ph.D

[ 17 ]Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTURE Aug 31, 2012

What this course will give u!

Basic understanding of different aspects and technologies related to web development

Ability to develop interactive web services

An understanding of possibilities and limitations of interactive web services

Page 18: Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTUREAug 31, 2012 Claus Brabrand ((( brabrand@itu.dk ))) Associate Professor, Ph.D

Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTURE Aug 31, 2012

Questions? Comments? Complaints?

Questions?

Page 19: Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTUREAug 31, 2012 Claus Brabrand ((( brabrand@itu.dk ))) Associate Professor, Ph.D

[ 19 ]Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTURE Aug 31, 2012

Static Web Pages

A client (browser) asks server for an HTML document (using the HTTP protocol)

The server sends back a (static) HTML document (possibly including a CSS stylesheet)

The client displays the document by formatting it (according to the HTML)

http request

html response

link

client

e

www

e

server

Page 20: Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTUREAug 31, 2012 Claus Brabrand ((( brabrand@itu.dk ))) Associate Professor, Ph.D

[ 20 ]Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTURE Aug 31, 2012

Client-Server Architecture

Data that belong to a database is stored in adatabase server

The documents that belongto a web site are “stored” ina web server (e.g., HTML,CSS, pictures, videos, …)

Clients (computers, laptops,cell phones, iPads, …) ask the server for documents they want

Page 21: Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTUREAug 31, 2012 Claus Brabrand ((( brabrand@itu.dk ))) Associate Professor, Ph.D

[ 21 ]Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTURE Aug 31, 2012

Dynamic Web Pages

The user fills out the form and clicks “submit” (which sends the data back to the server)

The server runs a PHP program that treats the data (e.g., reading and writing info in the database)

The server sends back the dynamically constructed HTML document (which is displayed by the client)

http request (url)(+data)

dynamic html response

submit

client

e

www

e

server

42 AB

program(PHP+SQL)

Page 22: Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTUREAug 31, 2012 Claus Brabrand ((( brabrand@itu.dk ))) Associate Professor, Ph.D

[ 22 ]Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTURE Aug 31, 2012

Client-Server Architecture

Data that belong to a database is stored in adatabase server

The documents that belongto a web site are “stored” ina web server (e.g., HTML,CSS, pictures, videos, …)

Clients (computers, laptops,cell phones, iPads, …) ask the server for documents they want

PHP

Page 23: Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTUREAug 31, 2012 Claus Brabrand ((( brabrand@itu.dk ))) Associate Professor, Ph.D

[ 23 ]Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTURE Aug 31, 2012

Web Services

e

e

e WebWebServiceService

client

HTML

HTML

form input

serverwww

HTML

HTML

PHP

PHP

PHP

PHP

Page 24: Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTUREAug 31, 2012 Claus Brabrand ((( brabrand@itu.dk ))) Associate Professor, Ph.D

[ 24 ]Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTURE Aug 31, 2012

Client-Server Architecture

Data that belong to a database is stored in adatabase server

The documents that belongto a web site are “stored” ina web server (e.g., HTML,CSS, pictures, videos, …)

Clients (computers, laptops,cell phones, iPads, …) ask the server for documents they want

SQL

PHP

Page 25: Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTUREAug 31, 2012 Claus Brabrand ((( brabrand@itu.dk ))) Associate Professor, Ph.D

[ 25 ]Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTURE Aug 31, 2012

Web Services

e

e

e WebWebServiceService

client

HTML

HTML

form input

serverwww

HTML

HTML

PHP+SQL

PHP+SQL

PHP+SQL

PHP+SQL

Page 26: Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTUREAug 31, 2012 Claus Brabrand ((( brabrand@itu.dk ))) Associate Professor, Ph.D

[ 26 ]Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTURE Aug 31, 2012

Web Service Development

Separation of concerns: Content (HTML) Presentation (CSS) Functionality (PHP+SQL)

Design on paper; only then start programming(this applies to all software development)

Page 27: Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTUREAug 31, 2012 Claus Brabrand ((( brabrand@itu.dk ))) Associate Professor, Ph.D

[ 27 ]Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTURE Aug 31, 2012

Last Year’s Exam

Last Year’s Exam: “La Pizzeria ” ( http://itu.dk/people/brabrand/DSDS/lapizzeria/ )

Another Web Service Example: “todo list” ( http://itu.dk/people/brabrand/DSDS/todo/ )

LaPizzeria

--- Web Shop ---

Page 28: Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTUREAug 31, 2012 Claus Brabrand ((( brabrand@itu.dk ))) Associate Professor, Ph.D

Claus Brabrand, ITU, Denmark SCRIPTING, DATABASES, & SYSTEM ARCHITECTURE Aug 31, 2012

See you next week for...:Adding PHP to your HTML!

(09:00 in Aud. 2)

Questions?