Shary GUO’s Blog

Exercise 9

Posted by: Shary GUO on: 18/04/2009

Exercise 9: Web form design and processing: A basis for e-commerce interaction


1. Design the form
“Retrofit” the form data string above for buying some French perfume into the HTML form fields and submit button on the Web page form.
2. Write the script
Script archives exist for PERL, Python and JavaScript. Search the Web for a script that processes the HTML forms data. Read the code and list the steps involved in processing the form.
3. Can you modify the script to process the form?

CGI alternatives
JavaScript, PHP, Active Server Pages (ASP), Java Server Pages (JSP) and a variety of other proprietary sources such as Cold Fusion, all provide an alternative to CGI interactivity and security. [See Figure 2-4 on Web server-enabling technologies in Conallen, p. 23]
JavaScript has been popular for including event-driven, user interface features (display a pull-down menu) and interactive multimedia (display a message or image when a mouse arrow passes over a screen area), as well as to validate data and user types into a form.
MouseOver event sample:
<A HREF=http://www.csu.edu.au/ onMouseOver=window.status=’Select this to go home’;return true”>Go Home</A>
Many JavaScript samples are available from http://javascript.internet.com
Code generation: Constructing a Program or Script
Constructing a program can be done in various ways:
• Constructing a sequence of machine language instructions to simulate the parsed statements.
• An Interpreter can execute a source program in a one-step process, with no permanent copy of the program being produced or saved. The use of an interpreter is handy when testing a program under development, as found in the Python IDE.
• Programming languages such as Pascal and C use an option to compile the final program file as one that can “stand and run alone” as an independent application. A compiler creates a version in the native machine language of the computer.
• The Java Virtual Machine arises from a process that combines the use of a Compiler and an Interpreter. The original Java source code is translated by a Java compiler into Java bytecodes, which are similar to the machine language form. The Java interpreter on ANY machine can read the bytecodes OR another compiler can translate the bytecode form into the machine language of the host machine. Such is the distinct advantage of Java as it is:
– architecturally neutral;
– portable to all systems.

Java Virtual Machine
The Java language is very secure and platform-independent when compared to alternative languages. Java’s secret is the tightly integrated language model. The steps below show how the Java Virtual Machine implements a Java Program:

1. Coding – Human-readable Java code is produced by the programmer.
2. Building – A Java Development Tool builds the Java program into bytecode, which is saved as a “.class” file.
3. Loading – Via the web or command line, the class file is sent to the Java Virtual Machine (VM) with an attached digital signature. The Java VM is simply an interpreter.
4. Bytecode Verification – The Java VM verifies the digital signature.
5. Isolation – When downloaded remotely, the Java VM isolates the Java program in a restricted part of memory. The Java program is not allowed to access local Hard drives and System resources.
6. Internal Integrity – Verification checks are made to insure that the loaded Java program is well formed. Data types are verified along with other syntax structure.
7. Execution – Program execution begins.
Python – example of a higher level language to rival younger Java
Introducing Python
Programming a computer means giving it a set of instructions. A computer program in many ways resembles recipes or building plans and is often called an algorithm. Computers can’t handle recipes or building plans like a carpet layer, so a computer programmer is needed who can use the algorithm and object or data model to talk in a way that the computer can understand, using a programming language. This practical experience with Python does not teach programming. It provides practical insight into how a programming language works in helping developers to create new software applications, via algorithms. As a fast prototyping tool, the Python interpreter also helps to demonstrate some of the uses and manipulation of character and numeric data via small blocks of source code and various Python scripts. Python can be a useful environment for developing e-business applications, from simple CGI scripts to application servers and object publishing tools like ZOPE, (written mostly in Python – see http://www.zope.org). The XML workshop uses the PyXML modules. Parsing thousands of small XML documents using the SAX API may take about 9 seconds – some XML experts claim that parsing can take up to 70 percent of the processing time.

Who uses Python?
An empirical study on the relative merits of different programming languages (http://wwwipd.ira.uka.de/~prechelt/Biblio/jccpprtTR.pdf) concludes that Python takes half the time to design and code as Java or C++, and can execute faster than Java in many cases. I am not sure how this compares with C# or VB.NET. This issue can save money for large companies. Here is a short list of users
BEA Systems, Walt Disney, GE Aircraft Engines, Google, Hewlett-Packard, IBM, National Center for Atmospheric Research, Microsoft, NASA, Industrial Light + Magic, Red Hat, U.S. Navy, Xerox, Yahoo! and the Zope Corporation.

Leave a Reply

Calendar

April 2009
M T W T F S S
     
 12345
6789101112
13141516171819
20212223242526
27282930  

RSS Cpanil’s Blog

RSS Vu’s Blog

  • An error has occurred; the feed is probably down. Try again later.

RSS Dilini’s Blog