Bài giảng Web technologies and e-Services - Bài 6: Web development models - Trường Đại học Bách khoa Hà Nội
Web Development Models
Content
• Web Application Architecture: client-server
• Programming Languages on client side
• Programming Languages on server side
• 3-tier architecture and MVC model
Client-Server Model
Client side
Server side
Server Roles
§ Manage and store data, including:
§ User data
§ Application data
§ Provide processing services for data
§ Centralize data
§ Manage user authentication, authorization mechanisms
via login function
Client Roles
§ Provide user interface
§ Can store some small data (using cookie)
§ Can process data (check validity of data that are
entered by users
§ Thin client: only provides user interface, centralize data processing
on server side
§ Thick client: realizes data processing on client side
§ Can be accessed from everywhere with minimal
software installation
Client-Server Advantages
§Centralized storage and processing.
§No data redundancy
§Enhance the ability of sharing data
§If data are distributed on multi-systems of users, it will cause difficulties in
sharing the data because each system has its own database architecture
3-Tier Architecture
§ Database Tier (Data Access Layer)
§ Stores and accesses data in low-level
§ Server Tier (Business Logic Layer)
§ Manages application connections and process ta
§ Client Tier (Presentation Layer)
§ Provides interface and processing
Presentation
Layer
Business
Logic
Data
Access
Layer
Layer
3-Tier Architecture Advantages
§Centralized Database can be accessed by many servers at the
same time
§Allow load balance of user connections on many application servers
§Data Access Layer is consistently designed with hardware in order
to serve specific its tasks:
§Data manipulations: update, insert, remove, etc
§Need more reliable hard drives
§Business Logic Layer are designed to provide connection points
for user connections and run multi-applications
§Need more computing power of CPU
Programming Languages
Client
Server
Database
Html
Java, Ruby
Visual Basic
PHP, Perl
Python
SQL
JavaScript
Flash
NoSQL
Client Programming Language
JavaScript
§Event Handling
§Statements (like C / Java)
§Operators
§Variables global (default)
§Or local (e.g. var x = 1)
§Types can change
§Eg. x = 1; x = ‘Hello’
§Function definition (reuse)
§Message Alerts
§Page element access with Document Object Model
§Views HTML page as a tree of elements
Hello World Example
• This provides an annoying popup – try it!
<html>
<body>
onMouseOver="(alert(
'Follow link to search on Google') )">
Search on Google
</a>
</body>
</html>
Server Programming Language
§Java – uses Java servlets, Java Server Pages (JSP) and Java
Beans.
§Ruby on Rails – uses ruby programs and Embedded Ruby (ERB).
§Visual Basic – Uses VB programs and Active Server Pages (ASP).
§Others:
§PHP (Personal Home Page – originally)
§CGI (Common Gateway Interface)
§Perl (Named after the parable of the pearl)
§Python (Named for the Monty Python skits)
§Tcl (Tool Command Language)
PHP
• Very c-like
• Classes, etc., work very much like C/C++
• Designed to work in the world of HTML
• Is run-time interpreted by the web server
Simple PHP Example
§ PHP is meant to be invoked inline with content Page “escapes” into and out of a regular
html document
§ File extension is .php (was .php3 for version 3)
<html>
<head><title>Test page</title></head>
<body>
The time is now
<?php echo date();?>
<hr>
</body>
</html>
JSP Example
<html>
<head><title>Hello JSP</title></head>
<body>
<p> Hello World:
<%= new java.util.Date() %>
</p>
</body>
</html>
Produced
MVC Development Model
§ Architectural Pattern from Smalltalk (1979)
§ Decouples data and presentation
§ Eases the development
MVC – The Model
§ The “Model” contains the data
§ Has methods to access and possibly update it’s contents.
§ Often, it implements an interface which defines the allowed model
interactions.
§ Implementing an interface enables models to be pulled out and
replaced without programming changes.
MVC – The View
§The View provides a visual representation of the model.
§There can be multiple views displaying the model at any one time.
§For example, a companies finances over time could be represented as a
table and a graph.
§These are just two different views of the same data.
§When the model is updated, all Views are informed and given a
chance to update themselves.
MVC – The Controller
§ It interprets mouse movement, clicks, keystrokes, etc
§ Communicates those activities to the model – eg: delete row,
insert row, etc
Tải về để xem bản đầy đủ
Bạn đang xem 20 trang mẫu của tài liệu "Bài giảng Web technologies and e-Services - Bài 6: Web development models - Trường Đại học Bách khoa Hà Nội", để tải tài liệu gốc về máy hãy click vào nút Download ở trên
File đính kèm:
- bai_giang_web_technologies_and_e_services_bai_6_web_developm.pdf