Although this site has been produced for specific courses and groups of students it is designed as a public resource. If you find it useful then please let me know.

If you want to comment feel free to do so and if you find something wrong get in touch.

hide alert

Web pages versus web applications: Two models for building ecommerce (lecture 7)

Written by: Jonathan Briggs

November 14, 2006 [2956 views]

Last week we saw how the web server Apache can be extended using the scripting language PHP and linked to a database such as MySQL. A set of prewritten web pages such as OSCommerce can be installed and customised to provide a web store. In this new lecture we will contrast this approach with a newer one that relies less on web pages and more on seeing a web server as an extendable application.

Basic principles of web pages
  • Documents served on request from a web (HTTP) server
  • Pages may include references to images and links to other pages (local or remote)
  • HTML used to style and format pages but not standard across all browsers
  • HTTP servers were originally stateless and could not remember the progress of a visitor through a sequence of pages
  • Cookies developed to maintain “sessions” or remember a visitor (for personalisation). Cookie is a small file stored on the client and passed (on request) to the server.
  • Client side scripting improves interactivity and initially reduced round-trip traffic to the server. Examples include form data validation, calculation and interface elements.
  • Server side scripting developed to allow increased range of information to be served from the server including links to databases and other applications
  • Scripts are embedded in web pages usually mixed in with HTML code and design layout elements)
  • Scripts may be run on the browser (client side) or on the server (server side)
    Many different scripting languages exist including Perl (for server side), VBScript, *ECMA Script (Javascript), Java, Cold Fusion, PHP and Python
  • Server side scripts are processed by an extension to the web server (such as ASP.DLL or mod-php) before the page is returned to the browser.
Problems with this approach
  1. Design and application logic are mixed together
  2. Designers create sites which developers have to implement which can be slow and difficult.
  3. The alternative of allowing developers to create standard pages to which designers add design tends to produce sites that look templated and ugly.
  4. Application logic is scattered across multiple pages making it hard to debug
  5. Code is hard to update, reuse or structure
  6. Scales poorly and difficult for a team to develop
  7. Approaches such as “includes” improve but do not solve the problems
Application approach to web design
  1. Separate design from content from logic
  2. Replace the simple HTTP server with a more sophisticated controller application such as Tomcat, Websphere or Resin
  3. Extend the controller through the use of a web application framework. This is a library of software components such as Jakarta Struts which supports common tasks such as fetching data from databases, validating data from forms and maintaining sessions
  4. Develop additional software components that reflect the business logic that is needed for your application (such as an ecommerce customer shopping process)
  5. Use templates to capture the design. Ideally use a templating system that provides designers with flexibility without forcing coding of logic into the templates.
  6. This approach supports the “model-view-controller” (MVC) software development pattern. The business, its data and how it works (model), how it looks (view), how these are linked together (controller).
  7. Commercial and open source software tools support this approach.
  8. Wide community of developers using this approach particularly those using Java
  9. MVC pattern can also be supported by tools such as PHP and .Net.
  10. The OTHER media uses this application approach for all its projects including the development of its content management system and its ecommerce software.
In conclusion
  • Think software applications instead of web pages
  • Web pages are simply a view onto a software application and its data
  • Design views that present useful views of this data
  • Controller takes page requests, updates the model and presents a new view
  • MVC approach can improve productivity, reuse and collaborative development

What do you think?







Add your comments