CSCI 4300 -- Spring 2010

Instructor: Dr. Dan Everett Office: 217 Boyd GSRC
Office hours: 9-11 TR; 10-12 MWF
Other times by appointment
Telephone: (706) 542-2749
E-mail: drdan at uga.edu TA: TBA
TA Lab hours TBA
Text: Java Servlets and JSP, 2nd ed.
by Joel Murach & Andrea Steelman
Grading:
Lab work 65%
Two in-class exams 20%
Final exam: 15%

Incomplete grades

Incomplete grades will be given in case you have a genuine personal or medical emergency that strikes in the last 1/4 of the class and prevents you from completing the course work. Because time pressure is a fact of student life, no incomplete grades will be given simply to allow you to finish your work.

Humorous adaptation of Chinese revolutionary poster to promote Python
Source: http://www.crummy.com; I don't know the original artist, sorry.

Class schedule: We will have lectures on Mondays and Tuesdays, finishing up if necessary on Thursdays. Most of Thursday classes will be devoted to working exercises in class. Please bring a laptop on Thursday if you have one.

Dates Topic Readings Lecture Notes
 
Jan 7 Programming with NetBeans Chapter 3 ---
Jan 12-14 Applets and XML processing -- --
Jan 19-21 HTTP and CSS Chapters 1, 4 HTML Part 1
HTML Part 2
Jan 26-28 Java Server Pages Chapter 5 Java Server Pages
Feb 2-4 Java Servlets Chapter 6 ---
Feb 9-11 Model-View-Control architecture Chapter 7 ---
Feb 16-18 Sessions and Cookies Chapter 8 ---
Feb 19 Test 1 -- Covers chapters 1, 3-8
Feb 23-25 Using JSP tags Chapter 9 ---
Mar 2-4 JSP Expression Language Chapter 10 ---
 
Mar 9-11 Spring Break! Yippee!
 
Mar 16-18 JSP Standard Tag Library Chapter 11 ---
Mar 23-24 Database access with JDBC Chapters 13-14 ---
Mar 30-31 Object-Relational Mapping --- ---
Apr 1 Test 2 -- Covers chapters 9-11, 13-14, ORM
Apr 6-8 Security Chapters 16-17 ---
Apr 13-15 Using HTTP requests and responses Chapter 18 HTTP
Apr 20-22 Listeners Chapter 19 ---
Apr 27-29 Filters Chapter 20 ---
 
Th, May 6 Final exam: 3:30 PM Final Exam Vocabulary

CSCI 4300 Assignments for Spring 2010

Please name your working directories "Assn1," "Assn2", etc. and send an email to the TA and myself when the assignment is deployed on the Web and ready for grading.

Course coding guidelines

For the required format of variable names, function spec comments, and loop comments, see the Coding Guidelines for this course.

Grading: A grading rubric will be provided for each assignment. You will note that adherence to the course coding guidelines is often worth a significant amout of credit. From previous semesters, I have observed a significant amount of weeping and gnashing of teeth from students who could not believe that I would actually take off points for not commenting code. Just a heads-up here.

Late assignments: An assignment is considered on time if you submit it before midnight on the due date, or as late as you stay up that night to finish it. (If you're persistently staying up after midnight on the due date, this indicates poor planning.) After that time, ten points will be deducted for each week or fraction of a week the assignment is late. This really is not worth it! My recommendation is to go ahead and submit whatever you have completed on time, and get started on the next one.

TA Lab Hours

TBA

The Assignments

Here is a tentative listing of assignments and due dates for Spring 2010:

AssignmentTopicSubmission due
Assn 1Applets and XML processing Monday, Jan 25
Assn 2JSP and JavaBeansMonday, Feb 9
Assn 3Controller ServletMonday, Feb 23
Assn 4JSTL and Expression LanguageMonday, Mar 23
Assn 5Database AccessMonday, Apr 5
Assn 6Object-relational mappingMonday, Apr 26

Software development guidelines for Web programming

Requirements analysis

This step defines what the proposed system needs to do. If the new software is to fit into an existing organization, you need a good understanding of how the organization works. In a class context this part is usually not hard, because the instructor tells you what the software should do!

Software design

Each module (program, script, function, etc) of the software system needs a clear specification. The specification should include:

To make the description more specific, refer to the named inputs whenever their values affect the result. For example, note the use of the named input student_tearjerkers in the following:

/**
 *   Returns the number of non-null values in the array student_tearjerkers
 *   @param student_tearjerkers  array of student excuses
 */
     int n_excuses(String[] student_tearjerkers)
data flow for a software module

Inputs are specific sources of data which must be present before the module runs. The following can be inputs:

Note especially that any information which the module can find by itself should not be listed as an input. An example is the current date and time, which the module can find via an appropriate system call.

The spec is considered a contract between the designer and the implementor. A good spec has the following properties:

  1. For any implementation, it is unambiguous whether that implementation satisfies the spec or not;
  2. If the implementation does satisfy the spec, then it correctly does the task it is designed for;
  3. The spec specifies desired results, but not how those results are obtained.

Most of our specs won't satisfy requirement (2) above, because I am not requiring enough detail to nail down the precise action of the module. Ideally, we should strive for this level of precision.

For a few thousand good examples of spec comments, see the Java APIs at http://java.sun.com/api/index.html

Java error handling

Java provides robust error handling features that we will use to create something a little closer to "industrial strength" code.

Example Design Exercise

Suppose we are asked to design the URLopener class that extracts character data from a remote URL:

Writing code without a design?

Sometimes we do write code without a design:

"I think I understand what the client needs, but I'm not sure." A prototype is a quick-and-dirty implementation that illustrates to the customer how the finished product will work or look.

"This looks like a good application of technology X, but I have never used X." In this case we write some exploratory test code to verify that we can get X, it runs on our system, we can learn it, and it does what we thought it can do.

Note that each of these situations we are writing throwaway code. It is unwise to assume that any code written in advance of the design will make it into the final project.

Design first, then implement!

The worst programming disasters typically result from forcing a bad design. In my experience, one hour of design time saves ten hours of debugging time. I am happy to go over your design with you before you start to code.

Coding Guidelines

As you begin to implement your design, please follow the following coding guidelines. These are intended to make your code easier to read and modify, but you will find that they also make it easier to get your code to run correctly in the first place.

Variable and function names

Loops

Every loop control statement should be followed by a short comment explaining what is accomplished on one iteration of the loop:

while (transactionRecord != null) {
//write contents of transactionRecord to a row of the HTML table
  System.out ("<tr><td>"+transactionRecord.clientID+"<td>...");
  ...
}//while

Again, note that we have used the variable name, transactionRecord, to increase specificity.

If you find it difficult to describe what a single iteration does, then STOP! You may have a serious design problem that can result in hours of wasted debugging time.

Formatting and indenting

Indent the body of any function, loop, if statement, or other code block. Put the opening brace on the line after the function declaration or control statement, and line up the closing brace underneath the left-hand character of the function declaration or control statement.

For code blocks more than a few lines long, comment the ending brace with a short description of the block being ended.

See the code block above for examples.

Module size

Break modules and functions up so that each module has a single, well-defined task and is small enough to be easily understood. Normally the source code for each module should fit on a single printed page, but you may stretch this somewhat for modules which contain a lot of embedded HTML and little or no program logic.

Under construction.

Java Web Programming Lab Exercises

File last modified: Monday, 26-Oct-2009 16:01:12 EDT

Valid XHTML 1.0 Strict