<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://homeostasis.scs.carleton.ca/wiki/index.php?action=history&amp;feed=atom&amp;title=WebFund_2024F_Lecture_7</id>
	<title>WebFund 2024F Lecture 7 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://homeostasis.scs.carleton.ca/wiki/index.php?action=history&amp;feed=atom&amp;title=WebFund_2024F_Lecture_7"/>
	<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=WebFund_2024F_Lecture_7&amp;action=history"/>
	<updated>2026-04-22T15:57:19Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=WebFund_2024F_Lecture_7&amp;diff=24760&amp;oldid=prev</id>
		<title>Soma: Created page with &quot;==Video==  Video from the lecture for October 1, 2024 is now available: * [https://homeostasis.scs.carleton.ca/~soma/webfund-2024f/lectures/comp2406-2024f-lec07-20241001.m4v video] * [https://homeostasis.scs.carleton.ca/~soma/webfund-2024f/lectures/comp2406-2024f-lec07-20241001.cc.vtt auto-generated captions]  ==Notes==  &lt;pre&gt; Lecture 7 ---------  We&#039;ve got lots of languages on the web  - HTML  - CSS  - JavaScript (client side)  - SQL  - (server side language, which coul...&quot;</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=WebFund_2024F_Lecture_7&amp;diff=24760&amp;oldid=prev"/>
		<updated>2024-10-01T19:15:24Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;==Video==  Video from the lecture for October 1, 2024 is now available: * [https://homeostasis.scs.carleton.ca/~soma/webfund-2024f/lectures/comp2406-2024f-lec07-20241001.m4v video] * [https://homeostasis.scs.carleton.ca/~soma/webfund-2024f/lectures/comp2406-2024f-lec07-20241001.cc.vtt auto-generated captions]  ==Notes==  &amp;lt;pre&amp;gt; Lecture 7 ---------  We&amp;#039;ve got lots of languages on the web  - HTML  - CSS  - JavaScript (client side)  - SQL  - (server side language, which coul...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Video==&lt;br /&gt;
&lt;br /&gt;
Video from the lecture for October 1, 2024 is now available:&lt;br /&gt;
* [https://homeostasis.scs.carleton.ca/~soma/webfund-2024f/lectures/comp2406-2024f-lec07-20241001.m4v video]&lt;br /&gt;
* [https://homeostasis.scs.carleton.ca/~soma/webfund-2024f/lectures/comp2406-2024f-lec07-20241001.cc.vtt auto-generated captions]&lt;br /&gt;
&lt;br /&gt;
==Notes==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Lecture 7&lt;br /&gt;
---------&lt;br /&gt;
&lt;br /&gt;
We&amp;#039;ve got lots of languages on the web&lt;br /&gt;
 - HTML&lt;br /&gt;
 - CSS&lt;br /&gt;
 - JavaScript (client side)&lt;br /&gt;
 - SQL&lt;br /&gt;
 - (server side language, which could be JavaScript or almost anything else)&lt;br /&gt;
   (Python, Java, C#, Ruby, JavaScript)&lt;br /&gt;
&lt;br /&gt;
All of these are programming languages&lt;br /&gt;
 - Normally we think of a full &amp;quot;programming language&amp;quot; as a language that is Turing complete&lt;br /&gt;
    - you can implement a Turing machine in it&lt;br /&gt;
    - classic model of computation&lt;br /&gt;
 - but really, a programming language is just a language that can be used to give a computer instructions on what to do&lt;br /&gt;
    - most config files can be thought of as being written in a programming languge&lt;br /&gt;
    - more specialized languages are known as &amp;quot;domain specific languages&amp;quot;, or DSLs&lt;br /&gt;
&lt;br /&gt;
There is a tendency for DSLs to become Turing complete, but generally that is a sign they have gotten too fancy&lt;br /&gt;
&lt;br /&gt;
A classic strategy for solving problems in CS is:&lt;br /&gt;
 - define a DSL for the problem space&lt;br /&gt;
 - create a solution in the DSL&lt;br /&gt;
&lt;br /&gt;
A programming language is a language for solving problems&lt;br /&gt;
 - different problems &amp;quot;fit&amp;quot; better with different vocabularies, syntax, semantics&lt;br /&gt;
&lt;br /&gt;
For example, C has atrocious string handling capabilities&lt;br /&gt;
 - but you can make it do anything, and people do&lt;br /&gt;
&lt;br /&gt;
Is a markup language a programming language?&lt;br /&gt;
 - I would say yes!&lt;br /&gt;
 - but generally, it isn&amp;#039;t Turing complete and that is okay&lt;br /&gt;
&lt;br /&gt;
Why do we have so many programming languages on the web?&lt;br /&gt;
 - because there are many sub-problems to solve!&lt;br /&gt;
&lt;br /&gt;
When you define a level of abstraction, implicitly you define a language&lt;br /&gt;
 - you may implement that language using objects or an API, but at its heart it is a language just maybe with bad syntax&lt;br /&gt;
&lt;br /&gt;
Original idea of web tech:&lt;br /&gt;
&lt;br /&gt;
HTML - structure, content of a page&lt;br /&gt;
CSS - styling of a page, so a language for talking about the style of HTML&lt;br /&gt;
JavaScript - make a page dynamic! (drop down menus, scroll views, etc)&lt;br /&gt;
&lt;br /&gt;
(And this all was served from static pages on the server)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But what if we want the server to do computation, maintain state beyond a set of files?&lt;br /&gt;
&lt;br /&gt;
CGI - common gateway interface&lt;br /&gt;
 - early form of dynamic web&lt;br /&gt;
 - standard for programs the server would run on request&lt;br /&gt;
&lt;br /&gt;
So, when you requested certain URLs, the server would run a Perl program and return its output rather than return a static page&lt;br /&gt;
&lt;br /&gt;
And then websites became more Perl scripts than files, and so we got Apache keeping the Perl runtime loaded (to make things faster)&lt;br /&gt;
 - Apache was the &amp;quot;main&amp;quot; web server application for many years, still widely used&lt;br /&gt;
 - name came from &amp;quot;a patchy server&amp;quot;, it was a set of patches on an earlier web server&lt;br /&gt;
&lt;br /&gt;
Then we got PHP, a language designed for adding server-side code to HTML documents&lt;br /&gt;
 - unlike Perl, PHP was created with the web in mind and was designed to be&lt;br /&gt;
   mixed with HTML in the same program&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
JavaScript was first created as a client side language, but then developers wanted to move code &amp;amp; data between the server and the client&lt;br /&gt;
 - so why not use the same language on both ends?&lt;br /&gt;
 - also, JavaScript runtimes got really fast, much faster than Python, Perl, and most PHP runtimes&lt;br /&gt;
 - that&amp;#039;s how we got node.js and then deno&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But JavaScript on the server was part of a big change in how web applications were structured&lt;br /&gt;
&lt;br /&gt;
What we&amp;#039;ve seen so far is that the server sends HTML, CSS, and soon JavaScript to the client, and the client sends back GET and POST requests, the latter with user data.&lt;br /&gt;
&lt;br /&gt;
Today, we more send back and forth objects in the form of JSON&lt;br /&gt;
 - GET, POST, other methods are mostly transport for JSON objects&lt;br /&gt;
&lt;br /&gt;
It was a twisty path to get here and we&amp;#039;re going to skip over most of the ugly parts (e.g. XML, SOAP mostly)&lt;br /&gt;
&lt;br /&gt;
The early web was mostly one of a LAMP stack&lt;br /&gt;
 - Linux&lt;br /&gt;
 - Apache&lt;br /&gt;
 - MySQL&lt;br /&gt;
 - PHP/Perl (earlier more Perl, later more PHP)&lt;br /&gt;
&lt;br /&gt;
So we haven&amp;#039;t talked about the third, MySQL, i.e., databases.&lt;br /&gt;
&lt;br /&gt;
MySQL was (initially) a bad but fast implementation of SQL&lt;br /&gt;
SQL is an old language of relational databases&lt;br /&gt;
&lt;br /&gt;
Databases are a solution to an eternal problem - how to manage state&lt;br /&gt;
 - i.e., how do you manage information that changes over time&lt;br /&gt;
&lt;br /&gt;
Mostly up until now you&amp;#039;ve dealt with files&lt;br /&gt;
&lt;br /&gt;
What is the API of files?&lt;br /&gt;
 - open, read, write, seek, close&lt;br /&gt;
 - we mostly open a file, read its contents, and then close it...or&lt;br /&gt;
 - we open a file, write stuff to it, then close it&lt;br /&gt;
&lt;br /&gt;
But really, they are an example of a hierarchical key/value store&lt;br /&gt;
 - the key is the filename&lt;br /&gt;
 - the store is the contents of the file&lt;br /&gt;
 - the hierarchy is that of directories and subdirectories&lt;br /&gt;
&lt;br /&gt;
While you can do incremental changes to files, it gets complicated fast, especially if more than one program wants to modify a file&lt;br /&gt;
 - typically the last writer will overwrite all previous writers&lt;br /&gt;
&lt;br /&gt;
If you&amp;#039;ve ever seen an editor complain about a file having changed on disk when you try saving, you&amp;#039;re seeing the risks of multiple concurrent editors of a file.&lt;br /&gt;
&lt;br /&gt;
Files are great as long as they are mostly being read, or there is clearly only one writer at a time.&lt;br /&gt;
&lt;br /&gt;
This is NOT the situation with a dynamic web server!&lt;br /&gt;
 - every requesting client could potentially require changes to stored data&lt;br /&gt;
 - 1000 web browsers all contacting the same web server, sending POST messages&lt;br /&gt;
   is entirely realistic&lt;br /&gt;
&lt;br /&gt;
This was a really big problem with early web servers because every incoming request was handled by a new process&lt;br /&gt;
 - followed a &amp;quot;fork on request&amp;quot; model&lt;br /&gt;
 - later turned into &amp;quot;new thread on request&amp;quot; or &amp;quot;thread from threadpool&amp;quot; model&lt;br /&gt;
&lt;br /&gt;
(Think about this more for COMP 3000)&lt;br /&gt;
&lt;br /&gt;
Don&amp;#039;t confuse how we test web apps with how they normally run&lt;br /&gt;
 - won&amp;#039;t just be on localhost&lt;br /&gt;
 - won&amp;#039;t just have one person accesing them&lt;br /&gt;
&lt;br /&gt;
SQL (structured query language) is a language designed for interacting with relational databases&lt;br /&gt;
 - relational databases were first developed in the 1960&amp;#039;s&lt;br /&gt;
 - so when the web arose in the 1990&amp;#039;s, was already and old and mature tech&lt;br /&gt;
 - web developers took it off the shelf and used it for their own purposes&lt;br /&gt;
&lt;br /&gt;
Relational databases were originally created for businesses &amp;amp; govt, storing data on people, money, etc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Key data structure in relational databases is a table&lt;br /&gt;
 - rows and columns&lt;br /&gt;
 - columns are fields (categories), e.g. name, address, etc&lt;br /&gt;
 - rows are the values of the fields associated with a specific record&lt;br /&gt;
    - an individual row is a record&lt;br /&gt;
&lt;br /&gt;
You can think of it as a spreadsheet sheet, and indeed spreadsheets can be accessed as databases&lt;br /&gt;
 - but have to have a rigid structure of labeled columns&lt;br /&gt;
&lt;br /&gt;
But where does the &amp;quot;relational&amp;quot; come in?&lt;br /&gt;
 - relations are connections between tables&lt;br /&gt;
 - an invoice table may have a relation with a customer table&lt;br /&gt;
    - the invoice just has a customer ID&lt;br /&gt;
    - to get all the info on the customer, look in the customer table&lt;br /&gt;
    - thus, invoices won&amp;#039;t duplicate customer information&lt;br /&gt;
&lt;br /&gt;
When you retrieve data from a database to build a report, you&amp;#039;ll incorporate data from multiple tables using relations to get a coherent view&lt;br /&gt;
&lt;br /&gt;
SQL is the common language for accessing and manipulating relational databases&lt;br /&gt;
 - THE standard&lt;br /&gt;
&lt;br /&gt;
So we&amp;#039;re going to do VERY BASIC SQL in this course&lt;br /&gt;
 - take 3005 to learn more about databases!&lt;br /&gt;
&lt;br /&gt;
Since it is a standard, there are many implementations of SQL, many database engines&lt;br /&gt;
 - Oracle&lt;br /&gt;
 - IBM DB2&lt;br /&gt;
 - MS SQL Server&lt;br /&gt;
 - AWS, Azure, Google Cloud have multiple database offerings&lt;br /&gt;
 - many other cloud DBs&lt;br /&gt;
&lt;br /&gt;
 - MySQL, MariaDB  &amp;lt;--- forks&lt;br /&gt;
 - Postgres (open source successor to Ingres)&lt;br /&gt;
    - become the standard API that cloud databases emulate&lt;br /&gt;
 - SQLite&lt;br /&gt;
&lt;br /&gt;
SQLite is not like the rest&lt;br /&gt;
 - in-process database&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Soma</name></author>
	</entry>
</feed>