In the very early days of the web, it was a source of data - with files of marked up text (in HTML) being sent out to a browser program by a server running on a central computer. Requests to the central server were made in http (Hypertext transfer protocol), and the responses were translated by the browser program to come up with an appropriate screen display. And the fundamentals of this exchange, and of HTML, remain surprisingly little changed to this day.
"Can we include pictures please?" - just about the first update, and the browser makes requests for further data files - this time not text, but images in a format such as .gif or .jpg. And other add-in file type come later, such as Java Applets, Flash movies, downloads, JavaScript, and style sheets. That's still using http for transferring the data; it's simply a different type of data as far as the web server is concerned, and it's sent out with a header to tell the browser what it's getting, so that the browser can work out what do do with it.
"Can we send the output from a program, rather than a plain file from the server, please?". Scenario (one of ours). We can run an onsite course in the UK in any one of 127 different postcode areas. In any one of 32 counties in Ireland. In any one of 25 other countries in the EU ... and many other countries too. Onsite courses can last from 1 to 5 days, and can have any number of delegates up to 15.
If there was an individual web page for each possible quotation, that would be over 10,000 separate web pages, so we can do that via a program which generates the HTML dynamically. The first way that such programs talked to the web server was through CGI (the Common Gateway Interface) as this allows established languages that predate the web to be used, taking inputs from (in essence) the keyboard, the command lin and environment variables which are, within CGI, taken over by the web server to feed in data that the user has entered onto a form.
"But I don't want to write a whole program - there are only a couple of things that change within a page!". It did seem rather messy to write a program to output what's mostly static text for applications like our quotation system. So in addition to CGI, many web servers support programming languages embedded within the HTML of the browser. I call this "HTML++" during our courses; it's the model used for languages such as PHP.
"I need to be able to chain together a series of pages for a user - to turn a simple form based program into a complete application". You
can do so using CGI, or using HTML++. You'll need to remember which user is which, possible through hidden fields but much more commonly done using cookies. A cookie is a piece of data that's send out within an http response in addition to the regular content, and is then returned to the server with each subsequent request. In effect, the user is saying "it's me again". The programs on the server do need to manage the storage of data between form submissions by the same user, and to relink that data back to the continuing application. They also need to be able to manage
sessions which the user has abandoned, and they need to be able to handling the echoing out of forms which weren't filled in correctly so that the user can make amends. Some of this is supported within the languages, or via optional add in modules, as it's such a common requirement.
"But my application is getting all confused and messy with all this stuff!!!". Yes - you can do so much with what I've described above, but the program elements really need some sort of structure to them to help ease the development, testing, use, maintenance and reuse. And that's where the "MVC" model comes in.
Please read on ... via my follow up
Model, View, Controller article.
(written 2012-02-25, updated 2012-03-03)
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
Y306 - Python - The Django web framework [1745] Moodle, Drupal, Django (and Rails) - (2008-08-08)
[3136] A framework with python - Django - first steps - (2011-01-17)
[3138] Django - adding your own views, and then templating your views. - (2011-01-18)
[3139] Steering our Python courses towards wxPython, SQLite and Django - (2011-01-19)
[3140] Django - separating the HTML from the view / model - (2011-01-20)
[3633] Nesting Templates in Django - (2012-03-02)
[3634] Defining database relations in your Django model - (2012-03-02)
[3639] Demonstration of a form using Django - (2012-03-04)
[3640] Sessions (Shopping Carts) in Django - the Python Web Framework - (2012-03-05)
[3698] How to stop forms on other sites submitting to your scripts - (2012-04-15)
[3705] Django Training Courses - UK - (2012-04-23)
[3919] What is a web framework? - (2012-11-10)
[4013] Web Frameworks - nested templates - (2013-02-22)
[4095] Django - first steps - Updated - (2013-05-19)
R202 - Ruby on Rails [1050] The HTML++ Metalanguage - (2007-01-22)
[1302] Ruby, Ruby, Ruby. Rails, Rails, Rails. - (2007-08-13)
[1375] Python v Ruby - (2007-10-02)
[2605] Ruby on Rails - a sample application to teach you how - (2010-01-30)
[2607] Answers on Ruby on Rails - (2010-01-30)
[2609] Scope of variables - important to Ruby on Rails - (2010-01-31)
[3756] Ruby on Rails - how it flows, and where the files go - (2012-06-08)
[3772] Hello World - Ruby on Rails - a checklist of each step - (2012-06-22)
[3777] Multiple views in a single appication - sharing common parts of the template - Ruby on Rails - (2012-06-23)
[3778] Providing a form to allow the user to add data to the model - Ruby on Rails - (2012-06-23)
[3779] Adding validation to form entries and sticky fields - Ruby on Rails - (2012-06-23)
[3780] Ruby of Rails - cleanly displaying model data in the view - (2012-06-23)
[4010] Really Simple Rails - (2013-02-17)
Q915 - Object Orientation and General technical topics - Principles of Model - View - Controller [687] Presentation, Business and Persistence layers in Perl and PHP - (2006-04-17)
[2199] Improving the structure of your early PHP programs - (2009-05-25)
[2612] The Model, View, Controller architecture (MVC) - what, why and how. - (2010-02-01)
[3237] Using functions to keep look and feel apart from calculations - simple C example - (2011-04-09)
[3454] Your PHP website - how to factor and refactor to reduce growing pains - (2011-09-24)
[4066] MVC and Frameworks - a lesson from first principles in PHP - (2013-04-19)
[4114] Teaching CodeIgniter - MVC and PHP - (2013-06-12)
[4320] An example of Model-View-Controller techniques in a Perl / CGI script - (2014-11-20)
[4391] Refactoring Perl applications to give them a rosy future - (2015-01-11)
[4527] Hello Flask world / Python web micro framework - (2015-10-11)
[4641] Using an MVC structure - even without a formal framework - (2016-02-07)
[4691] Real life PHP application using our course training MVC example - (2016-06-05)
Some other Articles
Historic Drawings from near MelkshamMeeting Report - Tuesday 21st Feb - to Melksham Chamber of Commerce from Shadow Community Operations BoardThere is so much to see travelling by train An update on Billy the Greyhound and Gypsy the LurcherWhy do we need a Model, View, Controller architecture?Some TestWise examples - helping use Ruby code to check your web site operationLoading Ruby classes - where does Ruby look?Matching regular expressions, and substitutions, in RubyFinding the total, average, minimum and maximum in a programRuby v Perl - a comparison example