Java Lab Reminders/Tips

  1. Local students - Get an account from the system admin.

  2. Off-site: If you have problems getting a web page at your own site (for various reasons), or if you have a firewall at your site, you can put your applets at our site. If you want an account on the CSUC machines see new account . Then see how to make a local web page and on making web pages in general
    Please remember that I have a lot of off-sites students (in satellite, video and masters programs) as well as students on campus. It is not reasonable to receive a hundred pieces of mail with disks in them each month a lab is due. Please submit as much of your lab requirements as is feasible on a web page.

    Also note that I typically grade on my SUN workstation (that does not have a disk drive) and it is not feasible to jump around on machines when I am grading this number of submissions whereas it is feasible for each of you individually to submit via the following. Thanks for your understanding


  3. Follow the turn in instructions to the letter. It really causes me a lot more time to try to track down permissions problems and access problems. First, see whichever of the following applies:

    Even if it is an application, you can submit all the files for the application via a link to a .jar file with all of you application files in it. You should submit one .jar file

  4. No matter which way you submit them, you still need to notify me via the following:

    I cannot believe how many people in these graduate classes do not know what class they are in! Please register to the correct class or I will not see it.

    1. For CSCI 111 (15a): Programming and Algorithms I, see how/where to notify of lab submission
    2. For CSCI 311 (151): Data Structures and Algorithms in Java, see how/where to notify of lab submission
    3. For CSCI 511 (215): OO Programming in Java, see how/where to notify of lab submission
    4. For CSCI 222: Expert Systems, see how/where to notify of lab submission
    5. For CSCI 611 (315): Advanced Java Programming, see how/where to notify of lab submission

Java Lab Tips

  1. Do a good design. Put extra time into your structure chart. Make sure you describe the relationship(s) between each object. How does each object interact with the other objects? See Example Structure charts

  2. Document your code on the object level in the source code. Specifically talk about _what_ the object does and _why_. See Documentation (Offline)

  3. Use in-line documentation in complicated sections of code, where it might not be obvious to the reader what you are doing. Explain why the code is doing what it is. For example:
    bad example:
      /* opens a file */
      file_open("template.html");
    
    good example:
    
      /* template.html defines the main style of how the program will look */
      file_open("template.html");
    
    Anyone with a little coding experience can read _what_ the code is doing, but not _why_. See Documentation (Inline)

  4. If your code takes a while to run (more than 5-10 seconds) give the user visual feedback that "something" is working in the background. Some dots (....) scrolling would suffice, or (showStatus on your Applet, or something more advanced like a ProgressBar.

  5. When using threads, you should turn down the priority of the thread to give other processes time to run. Use the setPriority() method in Java. This is of particular interest for 311's lab 2. In addition, the Thread methods of join and/or sleep will prove valuable in that lab.

  6. Try running your applet/application on as many different platforms as you can to test it. If it does not run on something, and you know it, tell us what platform, compiler, and viewer you are sure that your applet/application runs on (and what doesn't).

  7. Applications can access files to which you have permissions. For applets you could get security violations for a number of reasons. Page 197 in "Java in a Nutshell, Ed 1" or page 139 in "Java in a Nutshell, Ed 2" for specifics. Specifically, applets can open URL's and read from them, but not directly from files. For CSCI 151 students, see lesson 17 and source in How to Turn in your Labs: Applets on Web with I/O