Frameworks, AI, and the modern web developer
I first started playing with web content in 1994 while in college. Over the years I've see most major changes in web development. From the early days of HTML-only sites, to CGI for server-side processing, to Javascript, Ajax, and many other libraries and frameworks, to AR/VR to now AI. In this post I will try to present a brief history of frameworks and address my views on frameworks and their issues, and why I think we should be careful with AI as it exists at the time of this writing. ## Prehistory: Before Javascript The earliest server-side programming was done with Perl using what's called the [Commong Gateway Interface](https://www.ibm.com/docs/en/i/7.6.0?topic=functionality-cgi) (CGI) and stored in the server's `cgi-bin` directory. ```perl #!/usr/local/bin/perl print "Content-Type: text/html\n\n"; # Note there is a newline between # this header and Data # Simple HTML code follows print " \n"; print "
Hello, world!
\n"; print " \n"; ``` Later, Perl modules like [CGI.pm](https://metacpan.org/pod/CGI) were created to simplify the process of creating CGI scripts in Perl, both form processing and HTML output generation. The methods in the script below were valid when CGI.pm was first released. They are not supported in newer versions of the module. ```perl #!/usr/bin/perl -w # cgi script with CGI.pm. use CGI; my $cgi = CGI->new; print $cgi->header(); print $cgi->start_html(-title => "Hello World!"); print $cgi->h1("Hello World!"); print $cgi->p("This is a simple CGI script."); print $cgi->end_html(); ``` Yes, you could also compile C programs and put them in the `cgi-bin` directory and it would have the same effect but most people went with Perl because it was easier. ## Prehistory: Before frameworks When Javascript was first introduced in 1995 it was a simple language that was used to add interactivity to web pages. As originally conceived, Javascript was meant as a complement to Java apps running on the browser via the [applets](https://www.oracle.com/java/technologies/applets.html) tag. One of the first things I remember seeing were interactive rollovers triggered on hover. The rollover effect had two components. The first one was Javascript that would preload the images to avoid delay on first hover and create functions to handle the rollover and rollout events. ```js // Pre-load the images to avoid delay on first hover if (document.images) { // Declare the image objects var button_on = new Image(); var button_off = new Image(); // Set the image sources // Original button image button_off.src = "/api/placeholder/150/40"; // Highlighted button image button_on.src = "/api/placeholder/150/40"; } // The rollover function function changeImages() { if (document.images) { document.images["button1"].src = button_on.src; } } // The rollout function function restoreImages() { if (document.images) { document.images["button1"].src = button_off.src; } } ``` The second component is the (uppercase) HTML that would call the Javascript functions on the mouseover and mouseout events. ```htmlYou are using Internet Explorer.
"); // IE-specific code document.write("Using document.all for DOM access.
"); } else if (isNetscape) { document.write("You are using Netscape Navigator.
"); // Netscape-specific code document.write("Using document.layers for DOM access.
"); } else if (isW3C) { document.write("You are using a W3C-compliant browser.
"); // W3C standards-compliant code document.write("Using document.getElementById for DOM access.
"); } else { document.write("Your browser is not recognized.
"); } ``` ## Early frameworks: jQuery After the introduction of jQuery in 2006, the need to write different code for different browsers was reduced. jQuery was a library that abstracted the differences between browsers and provided a consistent way to interact with the DOM and handle events. | Framework/Library | Year Released | Key Features/Significance | |:---: | :---: | --- | | [jQuery](https://jquery.com/) | 2006 | One of the earliest and most popular libraries, simplifying DOM manipulation and AJAX calls. | jQuery addressed browser inconsistencies and unify DOM manipulation across browsers that were not compatible as they are today. For those who are not aware, browsers had an almost incompatible way of working with Javascript and the DOM. This is the type of issues jQuery addressed. Rather than writing branching code ourselves, we would use jQuery in two steps: First load the library ```html ``` Then use it to write code like this where jQuery also abstracts browser detection and provides a consistent way to interact with the DOM. ```js $(document).ready(function () { var message = "Your browser is not recognized.
"; if ($.browser.msie) { message = "You are using Internet Explorer.
Using document.all for DOM access.
"; } else if ($.browser.mozilla) { message = "You are using Netscape or a Mozilla-based browser.
Using W3C methods.
"; } $("body").append(message); }); ``` We can also use other jQuery functions to simplify the code. For example, the `append` function is a jQuery function that appends the message to the body of the document before an equivalent functionality was introduced to the Javascript standard. ## Early Frameworks: Backbone and AngularJS As the W3C standardized the DOM, Javascript became an international standard through ECMA, and the work of the [Web Standards Project](https://www.webstandards.org/) (WASP) helped to push the browser vendors to implement the standards, the need for jQuery was reduced but never eliminated. Then frameworks came into the picture. The first one was the Dojo Toolkit in 2005, followed by Backbobe.js, Knockout.js, Sprout Core, AngularJS, Ember.js, React, Meteor, Vue.js, Svelte, Angular, and others. It is challenging to understand why did these new technologies come into place and why they are important. The first generation of frameworks worked to establish foundational concepts and best practices for web development. They introduced concepts like MVC (Model-View-Controller), routing, and other concepts essential to Single Page Applications (SPA). The table below shows a sample of early libraries and frameworks. | Framework/Library | Year Released | Key Features/Significance | |:---: | :---: | --- | | [Dojo Toolkit](https://dojotoolkit.org/) | 2005 | The Dojo Toolkit is an open-source modular JavaScript library (or more specifically JavaScript toolkit) designed to ease the rapid development of cross-platform, JavaScript/Ajax-based applications and web sites. | | [Backbone.js](https://backbonejs.org/) | 2010 | A lightweight framework that introduced MVC (Model-View-Controller) architecture, influencing later frameworks. | | [Knockout.js](https://knockoutjs.com/) | 2010 | Knockout is a standalone JavaScript implementation of the Model–View–ViewModel pattern with templates. | | [Sprout Core](https://sproutcore.com/) | 2010 | SproutCore is an open-source JavaScript web framework. Its goal is to allow developers to create web applications with advanced capabilities and a user experience comparable to that of desktop applications. | | [AngularJS](https://angularjs.org/) | 2010 | Google's framework focused on building complex web applications with a structured approach. | | [Ember.js](https://emberjs.com/) | 2011 | Another early framework, known for its conventions and focus on building robust web applications. | | [Meteor](https://www.meteor.com/) | 2013 | A full-stack JavaScript framework, simplifying application development with real-time data synchronization. | One end of the first generation of frameworks is Backbone.js. Backbone.js was a lightweight framework that introduced the [MVC (Model-View-Controller) architecture](https://www.freecodecamp.org/news/the-model-view-controller-pattern-mvc-architecture-and-frameworks-explained/) to Javascript. It was a simple framework that provided a way to structure code and separate concerns. The other end is AngularJS. AngularJS is a framework that provided a way to build complex web applications with a structured approach. Through directives, AngularJS also introduced a way to extend HTML with custom elements and attributes. This is an AngularJS single page application example: ```html{{ greeting }}
Hello, World! 👋
You clicked {count} times
Hello, World! 👋
You clicked {{ count }} times
Hello, World! 👋
You clicked {{ count }} times