01 Introduction To Web Programming Updated
01 Introduction To Web Programming Updated
Programming
Web programming refers to the creation and management of dynamic,
dynamic, interactive websites and web applications. It involves writing code
code which allows the end user to interact with the content and perform
perform specific tasks. Web programming languages like HTML, CSS, and
and JavaScript are used to build and design web pages.
sa
Edited by:
Ts. Dr. Sarina Sulaiman
sarina@utm.my
Contents
o Introduction
o Internet
o World Wide Web
o Web Architecture
o Common Gateway Interface (CGI)
o CGI Programming
o Version Control
o Collaborative Projects
o Summary
Introduction
sa
Importance of Web Programming
Integrated Development Environments (IDEs) Tools for efficient coding, debugging, and project
project management.
Version Control Systems (VCS) Git, SVN, or Mercurial for tracking changes in code
in code and collaboration.
sa
Internet
16
The World Wide Web (History)
1994 1995 1998
Hotmail starts web based email JAVA source code was released Google is founded
1994 1996
The Simplified WWW
• Web browser wants a page from a web server
This is the World
• Pages structured into HTML and referenced via URLs Wide Web
• Get bytes (in this case HTTP packets) from users program Protocol Use
from one machine to another behind
o Web servers
• Programs that provide documents to browsers
• eg. Apache, IIS(Internet Information Services) by
Microsoft
URL
Abbreviation of Uniform The first part of the address For example, the two URLs
Resource Locator, the global indicates what protocol to below point to two different
address of documents and use, and the second part files at the domain
other resources on the World specifies the IP address or the pcwebopedia.com. The first
Wide Web. domain name where the specifies an executable file
resource is located. that should be fetched using
the FTP protocol; the second
specifies a Web page that
should be fetched using the
HTTP protocol:
ftp://www.pcwebopedia.com/stuff.exeftp://
www.pcwebopedia.com/stuff.zip
http://www.pcwebopedia.com/index.html
URL (Continue)
<protocol> <host name> <path>
<host>.<organization>.<org type>
E.g.:
www.utm.my
www.google.com
www.acm.org
www.jpa.gov.my
Organization
Types
o .org: non-profit
organizations
o .com: commercial
hosts
o .net: network hosts
o .edu: educational
institutions
o .int : international
treaty organizations
o .gov: government
agencies and
organizations
o .mil: U. S. military
o .my: Malaysia
o .jp: Japan
URL Examples
Full URL
o http://www.utm.my/
o http://elearning.utm.my/
o http://www.maxis.net.my/
o http://www.lhdn.gov.my/
Web Surfing (Logical View)
Web Architecture
sa
Web Architecture
2 approaches:
Static content Dynamic content
Static vs. Dynamic
o HTML documents are usually static
o The contents can only be changed
manually
o There are needs for dynamic documents
to:
• Search results
• Database access
• Context sensitive reply
o Static
• Page appears exactly as it was
encoded, nothing changes
o Dynamic
• Page is compiled, or able to be
changed
Dynamic Web Pages
HTML doc
1 Web Server
Browser ………….
………….
………….
HTML doc ………….
………….
………….
………….
………….
HTML doc
1 Web Server 2
Browser ………….
………….
………….
HTML doc ………….
………….
………….
………….
………….
2. Web server try to find and read the document at server directory
Web Architecture: Static Content
HTML doc
1 Web Server 2
Browser ………….
………….
3 ………….
HTML doc ………….
………….
………….
………….
………….
Client Server
HTML doc
1 Web Server 2
Browser ………….
………….
3 ………….
HTML doc
………….
………….
………….
………….
………….
Web Architecture: Dynamic Content
o Dynamic contents:
• Common Gateway Interface (CGI)
• Server pages
Common Gateway
Interface (CGI)
sa
Common Gateway
Interface (CGI)
o A CGI program is a program that follows the
CGI specifications.
How it works
???
Common Gateway Interface (CGI)
HTML doc
1 Web Server
Browser ………….
………….
………….
HTML doc
………….
………….
………….
………….
………….
HTML doc
1 Web Server 2
Browser ………….
………….
………….
HTML doc
………….
………….
………….
………….
………….
2. Web server try to find and read the document at server directory
Common Gateway Interface (CGI)
HTML doc
1 Web Server 2
Browser ………….
………….
3 ………….
HTML doc
………….
………….
………….
………….
………….
HTML doc
1 Web Server 2
Browser ………….
………….
3 ………….
HTML doc
………….
…………. 4
………….
CGI Script / Program
………….
………….
Database Server
4. User may click a submit button in the HTML
form that make a call to web server to run CGI
program at server directory
Common Gateway Interface (CGI)
HTML doc
1 Web Server 2
Browser ………….
………….
3 ………….
HTML doc
………….
…………. 4
5
………….
CGI Script / Program
………….
………….
Database Server
5. If CGI program is exist, web server will try to
invoke the OS to run it
Common Gateway Interface (CGI)
HTML doc
1 Web Server 2
Browser ………….
………….
3 ………….
HTML doc
4 ………….
………….
5
………….
CGI Script / Program
………….
…………. 6
Database Server
6. CGI program may make a connection to
database application to retrieve data
Common Gateway Interface (CGI)
HTML doc
1 Web Server 2
Browser ………….
………….
3 ………….
HTML doc
4 ………….
………….
5 7
………….
CGI Script / Program
………….
…………. 6
Database Server
7. CGI program then pass any data requested
by user to the Web server
Common Gateway Interface (CGI)
HTML doc
1 Web Server 2
Browser ………….
………….
3 ………….
HTML doc
4 ………….
………….
8 5 7
………….
CGI Script / Program
………….
…………. 6
Database Server
8. Web server send the data to client browser
Common
Gateway Interface
(CGI)
???
CGI Programming
sa
CGI Programming
o Server-pages languages:
• The CGI codes are embedded into HTML
• eg. PHP, JSP and ASP
o Conventional CGI:
• using common programming languages
• eg. C, Pascal, Perl, Python, etc.
CGI Programming (Continue)
o HTML
• is the main language for delivering document over the web.
• is the only language that web browsers can understand.
o Javascript
• Documents that are created by HTML are static.
• HTML does not support logical features.
• Javascript is used to make the document dynamic.
• E.g. before we can perform any delete operation, the browser should ask the user first for confirmation. This
cannot be done by the HTML. Javascript can.
o CGI
• Javascript is executed at client computers – ie. in web browsers. It is called client-side scripting language.
• Databases or other resources are located at the server computer. We need another programs to access them –
i.e. CGI programs.
• CGI languages such as PHP, JSP, Perl, etc are called server-side scripting languages, because they are executed at
the server.
Our
Objectives…
HTML, CSS,
PHP
& Javascript
SQL
HTMLClients
vs. Javascript vs. CGI
vs. Servers
Server-side Client-side
The first type possible on the Web Generally easier to implement
action occurs at the server may be prepared and
implemented offline action occurs
on the client side (Browser)
57
Client-side Scripting
Client-side Scripting
Advantage Disadvantage
• Easy to learn and use • Browser compatibility issues
• Wide browser support • Not object oriented
• Protection of local resources • Unable to gain access to local
resources
60
Advantage Disadvantage
High functionality
• JVM(Java Virtual Machine) compatibility
issues
• Difficulty to install and configure for local
Object oriented and full graphics functionality access
• Loading time and performance may be poor
Protection of local resources for large application.
Server-side Scripting
Advantages Disadvantages
Allows creation of dynamic web pages • More complicated then HTML (with
debugging)
• Slower to load on the server
Modifies HTML code on the server
before sent to client • Harder to learn
• Web server must be enabled
Uses databases such as Access, MySQL
and Oracle
sa
What is Version
Control?
Version control is a system that records changes to a file or set of files over
time so that you can recall specific versions later. It allows you to track
modifications and work collaboratively with others on a project.
sa
Why Use Version Control
Systems?
• Ensures a centralized repository for all project files, allowing easy
collaboration and tracking changes.
• Facilitates the ability to revert to previous versions, reducing the risk of
permanent data loss.
• Provides a systematic approach to manage different versions of files,
enhancing team productivity.
Introduction to Git
Git is a distributed version control system, enabling developers to track
changes in code files, collaborate with others, and maintain project history.
It is known for its speed, data integrity, and support for non-linear workflows,
making it a crucial tool for modern software development.
Key Features of Git
sa
Introduction to
Collaborative Projects
A collaborative project involves a group of people working together toward a
toward a common goal, sharing responsibilities, and leveraging each other's
other's strengths to achieve success.
s
Benefits of Collaboration
Slack Trello
A real-time communication and messaging platform An intuitive project management tool for task tracking
for seamless team collaboration. and workflow management.
Slack: Communication and Messaging
Platform
Real-time Messaging File Sharing Integration Capabilities
Enable instant communication Easily share files, documents, Seamless integration with other
that keeps teams in sync and and media directly on the tools and services for improved
productive. platform. workflow.
Trello: Project Management and Task
Tracking Tool
Visual Task Management
Organize tasks, projects, and deadlines with a clear visual interface.
Team Collaboration
Facilitate team collaboration through shared boards and task assignment.
Customizable Workflows
Tailor boards and cards to fit various project management approaches.
Google Drive: Document Sharing and
Collaboration
Seamless Collaboration File Storage
Simultaneously edit documents and Effortlessly store and access files with
provide feedback in real time with generous cloud storage space.
collaborators.
1.3M 99 49
Active Users Daily Video Quality Participants Per Call
Over 1.3 million users engage in Enjoy seamless communication Connect with up to 49
remote collaboration on Zoom with high-definition video and participants for productive and
daily. audio. interactive meetings.
YouTube Video
o Static vs Dynamic Website - What's the Difference?
https://www.youtube.com/watch?v=49PQCLiZGN0
sa
Summary
We will learn in this class how to:
o present our contents for web viewing in its most
simple way through (HTML code)
o systematically manage the formatting and
arrangement of content in HTML through CSS
o manage event, interaction and manipulating web
content (html doc) through Javascript
o manage of user and application data through
server-pages scripting (server code encoded in
html doc)
Summary (Continue)
We will learn in this class how to: