Web Programming 1
Web Programming 1
Course goals:
understand the technology and protocols underlying the
World Wide Web
1
Reasonable questions
What is the World Wide Web?
2
What is World Wide Web?
The internet is a
network of computer
networks worldwide
3
Web Internet
Internet: a physical network connecting millions of computers
using the same protocols for sharing/transmitting information (TCP/IP)
◦ in reality, the Internet is a network of smaller networks
4
History of the Internet
the idea of a long-distance computer network traces back to early 60's
◦ Licklider at M.I.T.
◦ Baran at Rand
◦ National Physics Laboratory in U.K.
5
Internet growth
Throughout the 70's, the size of the ARPANET doubled every year
◦ decentralization made adding new computers easy
◦ ~1000 military & academic computers connected by 1984
1994 3,212,000
1988 56,000
1986 5,089
1984 1,024
1982 235
7
Internet growth (cont.)
Date # of Users % World Population
December, 1995 16 millions 0.4 %
Ref: http://www.internetworldstats.com/emarketing.htm
8
History of the Web
the idea of hypertext (cross-linked and inter-linked
documents) traces back to Vannevar Bush in the 1940's
◦ online hypertext systems began to be developed in 1960's
e.g., Andy van Dam's FRESS, Doug Englebert's NLS
◦ in 1987, Apple introduced HyperCard
9
History of the Web (cont.)
the Web was an obscure, European research tool until 1993
10
Web growth
Computers on Web Servers on
Year the Internet the Internet
Statsfrom
Netcraft Web Server Survey. 2002 162,128,493 33,082,657
12
Client-side programming
can download program with Web page, execute on client machine
simple, generic, but insecure
JavaScript
◦ a scripting language for Web pages, developed by Netscape in 1995
◦ uses a C++/Java-like syntax, so familiar to programmers, but simpler
◦ good for adding dynamic features to Web page, controlling forms
and GUI
◦ see www.creighton.edu/~davereed/Memory
Java applets
can define small, special-purpose programs in Java called applets
provides full expressive power of Java (but more overhead)
good for more complex tasks or data heavy tasks, such as graphics
see
www.creighton.edu/~davereed/csc107.F03/Labs/MontePI.html
13
Server-side programming
can store and execute program on Web server, link from Web page
more complex, requires server privileges, but secure
CGI programming
◦ programs can be written to conform to the Common Gateway Interface
◦ when a Web page submits, data from the page is sent as input to the CGI program
◦ CGI program executes on server, sends its results back to browser as a Web page
14
Introduction to Web Development
http://www.google.com/help/index.html
Request-Response type
◦ Client (browser) will open a connection to a server and then
send a request using a very specific format
◦ Server will respond and close the connection
Stateless
◦ Does not maintain any connection information between
transaction information
Feature
◦ Negotiation of data representation, allowing systems to build
indepently of the data being transferred
TCP/IP
Transmission Control Protocol over Internet Protocol
31
Browser Communication with Web
Server
33
2. REQUEST & 3. RESPONSE
Protocol://IP address : port No/ web page name
When a browser connects to web server using
appropriate protocol name. Web Server treats it
as a request.
Request can be of two folds
Web Page itself
The request for objects referenced by web page (images, audio,
video etc)
HTTP request is received, web server try to
locate web page requested
If found responds by providing web page
If not, error message is sent as response
34
2. REQUEST & 3. RESPONSE
After sending web page, the browser reset the
connection with browser.
After receiving web page, the browser identifies
external objects specified with web page
Send request to server for external objects
associated with page.
Such request will result in connection being re
established with Web Server & request being sent
by browser
Web Server responds to request being sent by
browser
35
4. Connection Termination
Server’s responsibility to terminate
TCP/IP connection with browser after it
responds to browser’s request.
Both must manage unexpected closure of
connection any time.
◦ If browser is closed
◦ Crash of browser or Web Server
36
WebSite (Web Brouchers)
vs
Web Application
Web Brochures vs. Web Applications
Instantaneous connections to
internet sites world wide
Disadvantages of Using
Web Applications
Connections can be slow or busy
No standard methods of
organization
Two tier
Three tier
◦ RPC based
◦ Remote object based
◦ Three tier (HTML browser and Web server)
◦ Proprietary application server
◦ Standard application server
N-Tier
Client-server architectures
1-tier Architecture
Entire application exists on single node
◦ Installed on individual machines
Types of systems
◦ Standalone executable
◦ Mainframe applications
Client-server architectures
1-tier Evaluation
Advantages
◦ Simple to build
◦ Natural
◦ No client side management is required
◦ Data consistency is easy to achieve
Disadvantages
◦ Facilitates very little reuse
◦ Maintenance can be expensive
◦ Single point of failure
◦ Scaling systems requires buying bigger, costly hardware
Client-server architectures
2-tier Architecture
Client Server Applications
c2 c3 c4 c12
c11
Server p rocess
c1 s1 s4
c10
c5
Client p rocess
s2 s3 c9
c6
c7 c8
Client-server architectures
2-tier Evaluation
Advantages
◦ Modifications on server propagated to clients
◦ Can distribute processing load
◦ Better scalability by adding server nodes and clients
◦ Database type independence
Disadvantages
◦ Client nodes require more computing power
◦ Development and maintenance more complex
◦ Presentation, data model, business logic are intertwined (at client side),
difficult for updates and maintenance
◦ Data Model is “tightly coupled” to every client: If DB Schema changes, all
clients break
◦ Updates have to be deployed to all clients making System maintenance
nightmare
◦ DB connection for every client, thus difficult to scale
◦ Raw data transferred to client for processing causes high network traffic
A client-server ATM system
AT M
AT M Account serv er
AT M
AT M
3-tier Architecture (General)
In 3-Tier
◦ Each logical partition maps to a layer in the system
Modeling layers and software layers match 1-to-1
Each layer implemented with appropriate technologies
Layers have their own internal architectures
3-tier Evaluation
Advantages
◦ Complete separation of concerns
◦ Control logic can be reused by client applications
◦ Caches results in the controller layer
◦ Maximum flexibility for enterprise-wide applications
Disadvantages
◦ Difficult to integrate legacy stovepipes which represent large investment
◦ Complexity
◦ Speed decreases with levels of indirection and latency
◦ Increases cost and development time
◦ Lack of knowledgeable developers and managers
A 3-tier C/S architecture
An internet banking system
Client
N-tier (multi-tier & multi-layered) Architecture
• Layers and Tiers need not have 1-1 mapping. 3-tier is popular as its
maps to typical IT problems