<?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_18</id>
	<title>WebFund 2024F Lecture 18 - 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_18"/>
	<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=WebFund_2024F_Lecture_18&amp;action=history"/>
	<updated>2026-04-10T10:23:59Z</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_18&amp;diff=24866&amp;oldid=prev</id>
		<title>Soma at 20:27, 19 November 2024</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=WebFund_2024F_Lecture_18&amp;diff=24866&amp;oldid=prev"/>
		<updated>2024-11-19T20:27:40Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 20:27, 19 November 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Video==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Video==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&#039;&#039;&#039;Video is still processing&#039;&#039;&#039;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Video from the lecture for November 19, 2024 is now available:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Video from the lecture for November 19, 2024 is now available:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Soma</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=WebFund_2024F_Lecture_18&amp;diff=24865&amp;oldid=prev</id>
		<title>Soma: Created page with &quot;==Video==  &#039;&#039;&#039;Video is still processing&#039;&#039;&#039;  Video from the lecture for November 19, 2024 is now available: * [https://homeostasis.scs.carleton.ca/~soma/webfund-2024f/lectures/comp2406-2024f-lec18-20241119.m4v video] * [https://homeostasis.scs.carleton.ca/~soma/webfund-2024f/lectures/comp2406-2024f-lec18-20241119.cc.vtt auto-generated captions]  ==Notes==  &lt;pre&gt; Lecture 18 ----------  Lecture will start at 12:35, will go to 1:55 PM (one hour late, as announced on Teams)...&quot;</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=WebFund_2024F_Lecture_18&amp;diff=24865&amp;oldid=prev"/>
		<updated>2024-11-19T19:38:44Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;==Video==  &amp;#039;&amp;#039;&amp;#039;Video is still processing&amp;#039;&amp;#039;&amp;#039;  Video from the lecture for November 19, 2024 is now available: * [https://homeostasis.scs.carleton.ca/~soma/webfund-2024f/lectures/comp2406-2024f-lec18-20241119.m4v video] * [https://homeostasis.scs.carleton.ca/~soma/webfund-2024f/lectures/comp2406-2024f-lec18-20241119.cc.vtt auto-generated captions]  ==Notes==  &amp;lt;pre&amp;gt; Lecture 18 ----------  Lecture will start at 12:35, will go to 1:55 PM (one hour late, as announced on Teams)...&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;
&amp;#039;&amp;#039;&amp;#039;Video is still processing&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Video from the lecture for November 19, 2024 is now available:&lt;br /&gt;
* [https://homeostasis.scs.carleton.ca/~soma/webfund-2024f/lectures/comp2406-2024f-lec18-20241119.m4v video]&lt;br /&gt;
* [https://homeostasis.scs.carleton.ca/~soma/webfund-2024f/lectures/comp2406-2024f-lec18-20241119.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 18&lt;br /&gt;
----------&lt;br /&gt;
&lt;br /&gt;
Lecture will start at 12:35, will go to 1:55 PM&lt;br /&gt;
(one hour late, as announced on Teams)&lt;br /&gt;
&lt;br /&gt;
 - midterm marks will be out by next class, hopefully later today&lt;br /&gt;
 - next class I will discuss interviews, announce process (also on Teams)&lt;br /&gt;
&lt;br /&gt;
Assignment 3 deadline is tomorrow officially, but accepted until Thursday 11:30 AM&lt;br /&gt;
 - would you all like a bit more time?&lt;br /&gt;
 - will extend to Saturday night&lt;br /&gt;
&lt;br /&gt;
Please make sure A3 passes the validator!&lt;br /&gt;
&lt;br /&gt;
A4 is due last day of class, will be coming out this weekend.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
What remains?&lt;br /&gt;
-------------&lt;br /&gt;
sessions&lt;br /&gt;
 - tracked with cookies&lt;br /&gt;
 - per user session (not per user)&lt;br /&gt;
 - normally expire&lt;br /&gt;
 - server maintains state associated with cookie, so normally keeps them in a database&lt;br /&gt;
    - alternatively, cookies are stored encrypted, so client cannot parse data&lt;br /&gt;
&lt;br /&gt;
http local storage&lt;br /&gt;
 - like cookies, but allowing for megabytes+ rather than kilobytes&lt;br /&gt;
 - but similarly cannot be counted on by the server, client can delete at any time&lt;br /&gt;
 - newer standard, so less supported (but pretty common now)&lt;br /&gt;
 - not sent back to the server on every request, just available for JS code to access on the client&lt;br /&gt;
 - useful for offline access (e.g., google docs)&lt;br /&gt;
&lt;br /&gt;
virtual DOMs&lt;br /&gt;
 - DOM is the Document Object Model, the JS-accessible representation of an HTML page&lt;br /&gt;
    - generated for every HTML document a browser loads that has JS&lt;br /&gt;
    - this is the data structure that is accessed and modified when JS code&lt;br /&gt;
      wants to change what is on the page&lt;br /&gt;
&lt;br /&gt;
  - a virtual DOM is a server-side DOM-like data structure that mirrors&lt;br /&gt;
    the DOM on the client&lt;br /&gt;
&lt;br /&gt;
  - the idea of a virtual DOM is to allow the server to send partial updates to the client cleanly, without the programmer having to think about DOM manipulation&lt;br /&gt;
      - changes are &amp;quot;declarative&amp;quot; rather than &amp;quot;procedural&amp;quot;&lt;br /&gt;
      - really, it just means that&lt;br /&gt;
         - developers makes the page they want on the server&lt;br /&gt;
	 - the virtual DOM figures out what info must be sent and how the&lt;br /&gt;
	   DOM must be changed (and what operations to do) in order to keep&lt;br /&gt;
	   the server-side and client-side pages in sync&lt;br /&gt;
&lt;br /&gt;
A modern trend now is to serve fully-formed pages (with the dynamic parts filled in) as static documents&lt;br /&gt;
 - no need for JS to run on the client to get a proper view&lt;br /&gt;
 - but client-side JS can do incremental updates to make things dynamic&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note that all of the above doesn&amp;#039;t involve new mechanisms, it is all built on the technologies you already have seen in this class.&lt;br /&gt;
&lt;br /&gt;
WASM&lt;br /&gt;
 - web assembly&lt;br /&gt;
 - &amp;quot;assembly language for the web&amp;quot; meaning arbitrary languages can be compiled to web assembly and then run in a browser&lt;br /&gt;
    - still need JavaScript glue code to access the DOM&lt;br /&gt;
    - but otherwise your code can be written in C, C++, Rust&lt;br /&gt;
    - dynamic languages can also be ported, WASM now supports a garbage collector&lt;br /&gt;
        - this is relatively new&lt;br /&gt;
     - JavaScript runtimes have AMAZING garbage collectors (super optimized)&lt;br /&gt;
     - without GC support, porting python, ruby, or other dynamic languages&lt;br /&gt;
       to WASM would require also including an entire garbage collector,&lt;br /&gt;
       which would inflate code size and be redundant&lt;br /&gt;
&lt;br /&gt;
WASM + JS is getting so good, it may be the main execution platform going forward&lt;br /&gt;
  - native code may mostly go away for many applications&lt;br /&gt;
  - big holdouts: mobile apps, embedded apps&lt;br /&gt;
&lt;br /&gt;
Garbage collection&lt;br /&gt;
 - any language where you don&amp;#039;t do manual memory management (e.g., alloc/free)&lt;br /&gt;
   you&amp;#039;ll likely have a garbage collector&lt;br /&gt;
     - exception: Swift/Objective-C on iOS/macOS with ARC (automatic reference counting)&lt;br /&gt;
 - all it is doing is keeping track of what data structures can and cannot be accessed: &lt;br /&gt;
  var a = [1,2,3,4,5];&lt;br /&gt;
  var b = a;&lt;br /&gt;
  a = [6,7,8];&lt;br /&gt;
  b = a;&lt;br /&gt;
&lt;br /&gt;
After this code, a and b are equal and are both referring to [6,7,8]&lt;br /&gt;
 - what happened to [1,2,3,4,5]? It became garbage - an allocated&lt;br /&gt;
   data structure which can no longer be accessed&lt;br /&gt;
&lt;br /&gt;
A garbage collector finds and de-allocates garbage automatically&lt;br /&gt;
 - in a language with manual memory management, the above code would result in a memory leak&lt;br /&gt;
&lt;br /&gt;
Java, Python, &amp;amp; JavaScript all generate a lot of garbage&lt;br /&gt;
 - Python&amp;#039;s garbage collection is pretty bad&lt;br /&gt;
   - python itself is not fast at all&lt;br /&gt;
   - but it can call native libraries which are very fast&lt;br /&gt;
     (this is how AI is done efficiently in Python)&lt;br /&gt;
 - Java &amp;amp; JavaScript&amp;#039;s garbage collectors are very good&lt;br /&gt;
   - not due to the languages, but due to lots of engineering&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;quot;native&amp;quot; code means machine code that runs directy on the CPU&lt;br /&gt;
 - e.g., ARM, x86-64, RISC-V&lt;br /&gt;
&lt;br /&gt;
When you compile code in C, C++, or Rust, it is compiled into native machine code&lt;br /&gt;
  - so make sure you compile it for the CPU you will run it on!&lt;br /&gt;
&lt;br /&gt;
You can also compile these to WASM, and then it can run on any system that has a WASM runtime&lt;br /&gt;
 - but will run slower than native code, because it has to be translated&lt;br /&gt;
 - (not strictly true, JIT compilation can make WASM, Java bytecodes very fast)&lt;br /&gt;
 - look up HP&amp;#039;s dynamo if you are curious&lt;br /&gt;
   https://dl.acm.org/doi/pdf/10.1145/349299.349303&lt;br /&gt;
    - they sped up machine code by running it through a just-in-time compiler&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
JavaScript language features&lt;br /&gt;
 - closures (well, covered partially)&lt;br /&gt;
 - objects, prototype-based inheritance&lt;br /&gt;
&lt;br /&gt;
TypeScript&lt;br /&gt;
 - Deno supports it natively, browsers do not however (compile Typescript-JS)&lt;br /&gt;
 - it is just JavaScript + types&lt;br /&gt;
 - not clear if it improves performance&lt;br /&gt;
 - but it can catch type-based bugs&lt;br /&gt;
    - compile-time errors vs runtime errors&lt;br /&gt;
&lt;br /&gt;
With this, you have basic knowledge of the fundamental technologies of the web.&lt;br /&gt;
&lt;br /&gt;
HOWEVER&lt;br /&gt;
 - there&amp;#039;s a bit more to HTML&lt;br /&gt;
 - there&amp;#039;s A LOT to CSS&lt;br /&gt;
 - there is A LOT of Javascript code out there that people use!&lt;br /&gt;
    - both client and server side!&lt;br /&gt;
 - there is A LOT of server-side technologies!&lt;br /&gt;
    - Java, C#, Ruby, Node&lt;br /&gt;
    - many, many frameworks and libraries built on these&lt;br /&gt;
&lt;br /&gt;
So when people talk about the complexity of web development, they really are&lt;br /&gt;
talking about all the tech that&amp;#039;s been built on top of web standards&lt;br /&gt;
 - the code web standards are pretty simple&lt;br /&gt;
 - much of the other stuff in web standards can be mostly ignored&lt;br /&gt;
    (some is just obsolete)&lt;br /&gt;
    example: XMLHttpRequest vs fetch&lt;br /&gt;
 - remember that the web is an *evolving* platform&lt;br /&gt;
   - so backwards compatibility is essential and a big burden&lt;br /&gt;
   - but this burden is mostly carried by web browsers not web servers, apps&lt;br /&gt;
&lt;br /&gt;
As a web developer, you mainly care about the legacy of web tech when dealing with a variety of web clients&lt;br /&gt;
 - many browsers running on many platforms&lt;br /&gt;
 - but much less fragmented than in the past, and getting better&lt;br /&gt;
 - if you look at MDM for any JavaScript or web API, it will tell you compatibility, and it mostly says &amp;quot;widely available&amp;quot;&lt;br /&gt;
&lt;br /&gt;
However, write once debug everywhere is still a thing&lt;br /&gt;
 - just because it runs in Chrome doesn&amp;#039;t guarantee it will run on Firefox&lt;br /&gt;
 - unfortunately, most browsers today are Chrome-like underneath&lt;br /&gt;
&lt;br /&gt;
There are only 3 widely used web rendering engines&lt;br /&gt;
 - Gecko (Firefox)&lt;br /&gt;
 - WebKit (Safari)&lt;br /&gt;
 - Blink (Chrome, Edge, Opera, Brave)&lt;br /&gt;
&lt;br /&gt;
But there is hope! Anybody heard of the Ladybird browser?&lt;br /&gt;
 - cool open source project building a new browser from scratch&lt;br /&gt;
 - was originally part of the Serenity operating system, but&lt;br /&gt;
   now is independent&lt;br /&gt;
 - if you want to contribute to cool projects potentially check them out&lt;br /&gt;
&lt;br /&gt;
React&lt;br /&gt;
 - a &amp;quot;library for web and native user interfaces&amp;quot;&lt;br /&gt;
 - developed by facebook/meta&lt;br /&gt;
 - it is a very capable tool, but is not complete&lt;br /&gt;
   - need to combine it with other tech to get a full web &amp;quot;dev stack&amp;quot;&lt;br /&gt;
 - key features&lt;br /&gt;
   - declarative specification of dynamic interfaces&lt;br /&gt;
     (idea borrowed by Apple for SwiftUI)&lt;br /&gt;
   - so you specify relationships between components, the library&lt;br /&gt;
     takes care of the mechanics of their interaction&lt;br /&gt;
 - without something like react, you have to implement code&lt;br /&gt;
   for every little bit of dynamic behavior&lt;br /&gt;
     - gets complicated with there&amp;#039;s a lot of state to manage&lt;br /&gt;
     - state is the hard problem in most user interfaces, including the web&lt;br /&gt;
&lt;br /&gt;
So a developer just has to manage their internal app state&lt;br /&gt;
 - React will then update the interface as needed when the state changes&lt;br /&gt;
&lt;br /&gt;
Consider a counter&lt;br /&gt;
 - old way: check an internal counter for changes and then update the counter displayed to the user&lt;br /&gt;
 - declarative way: maintain counter (library makes sure interface reflects the counter&amp;#039;s value)&lt;br /&gt;
&lt;br /&gt;
In an MVC model, with a declarative interface you just manage the model and declare the views&lt;br /&gt;
 - the controller part is taken care of automagically&lt;br /&gt;
&lt;br /&gt;
React took off in part because of React Native&lt;br /&gt;
 - do react for native apps&lt;br /&gt;
   - i.e., you write a web app and you get a native app &amp;quot;for free&amp;quot;&lt;br /&gt;
   - (doesn&amp;#039;t work completely in practice but can help with some cross-&lt;br /&gt;
     platform apps)&lt;br /&gt;
&lt;br /&gt;
   - real use case: web app + mobile apps (iOS, Android)&lt;br /&gt;
   - if you aren&amp;#039;t facebook/meta, may be better to just maintain all three apps,&lt;br /&gt;
     hard to get good results otherwise&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Web development&amp;#039;s tech isn&amp;#039;t that complex at its core, but it gets very complex in practice because the underlying problem is hard&lt;br /&gt;
 - how do I make a good distributed app when the UI (on the client) is separated from the core functionality (on the server)&lt;br /&gt;
 - high latency, low reliability connection makes good results hard&lt;br /&gt;
 - complex solutions can mitigate both issues, but at the cost of complexity&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Soma</name></author>
	</entry>
</feed>