First Course in Java, EDP 311944, Fall 2009

Schedule and Syllabus

Schedule

Session

Date

Topic (and link to lecture notes)

Chapter in Textbook

Homework is due before 5 p.m. on the Saturday day before the next session

1

14 SEP

Java Fundamentals

1
(pp. 1-34)

Homework #1: Download the SDK, run HelloWorld, and write a program that does some  arithmetic

see lecture1/index.htm#Homework Assignment

and lecture1/index.htm#PATH and CLASSPATH

2

21 SEP

Introducing Data Types and Operators

2
(pp. 35-70)

Homework #2: Write a program that does conversion and casting

3

28 SEP

Program Control Statements

 

Introducing Classes, Objects, and Methods

3
(pp. 71-114)

4
(pp. 115-150)

Homework #3: Write a program that defines the Animal class with a speak method and a feed method. Create at least two instances that display different property values and different behavior when their methods are called. See ../session3/index.htm#Homework

(For those who do not have 4 points for every assignment: Write a program with a nested for loop, and rewrite it with a nested while loop)

4

05 OCT

Introducing Classes, Objects, and Methods

4
(pp. 115-150)
Homework #4: Write a program that performs at least one string operation on an array of strings. You can also use other String methods on one or more Strings that are not in an array of Strings.

Study the Strings examples at

http://java.sun.com/docs/books/tutorial/java/data/strings.html

and/or at  http://javaalmanac.com/egs/java.lang/pkg.html#Strings

and write a program that does something with Strings that you consider useful.

  • One use case might be to remove the prefix "Mr. or Mrs." from a list of names. Another might be to remove the suffix ", Jr." and ", Sr."

  • Another use case might be to compare two strings and find any differences

5

12 OCT

More Data Types and Operators (arrays and their length, the for-each style loop, string operations, command-line args, the ? operator)

A Closer Look at Methods and Classes

5
(pp.151-184, so we skip pp. 185-200)

6
(pp. 201-250)

Homework #5: Write a program with overloaded constructors and methods. Examples at:
http://write-technical.com/126581/session6/index.htm#Overloading%20a%20method

 

 


Prepare for Midterm

6

19 OCT

MIDTERM: The first 60 minutes. We then grade the midterm as a group.

Homework #6: Write an abstract class called Animal that has at least one abstract method and one non-abstract method. Extend the abstract class by implementing the abstract method it inherits. Override a non-abstract  method it inherits.

Examples for Homework #6

Agenda
6:30 - 7:30 Midterm Exam
7:30 - 7:40 Break
7:40 - 8:10 Grade Midterm
8:10 - 8:30 Calculate Final Course Grades
8:30 - 8:45 Preliminary Course Evaluation (please fill out a form)

7

26 OCT

Jar instructions

 

Inheritance

 

 

 

7
(pp. 251-300)

 

Homework #7: Make an IAnimal interface in one file named IAnimal.java
the interface specifies the speak() and feed() methods. In the Dog.java file, implement the two methods required by the interface. You can have Cat.java or other animal files, too. Instead of emailing me a .zip archive of the various files, send me an executable jar file that includes the .java files, the .class files, and the manifest file that specifies the main class. See the instructions at Jar instructions
 

 

8

02 NOV

Packages and Interfaces

 

 

Exception Handling

8
(pp. 301-332)

9
(pp. 333-364)

Package concepts:
http://write-technical.com/126581/session6/index.htm#ENCAPSULATION

 

http://write-technical.com/126581/session6/index.htm#Homework%20Assignment

 

Homework #8: Add exception handling to one of your previous programs. Get 5 points instead of 4 if, in addition to standard exception handling, you also throw your own custom Exception object. You might even consider calling printStackTrace() for debugging.

9

 09 NOV

javadoc and IO

Appendix B: (pp. 655-663) or Chapter 9 (pp. 365-406)

Homework #9 is one of the following:

Add javadoc (with you @author) to the program of Homework #8 or a different program

or work with IO package (input from keyboard or file; output to file or console) - see ../session9/io/io.htm

http://write-technical.com/126581/session9/index.htm has
examples for exceptions, applets, packages, javadoc, and the final

10

16 NOV

FINAL EXAM

 

Agenda
6:30 - 7:30 Final Exam
7:30 - 7:40 Break
7:40 - 8:10 Grade Final
8:10 - 8:30 Calculate Final Course Grades
8:30 - 8:45 Course Evaluation (please fill out a form)


Tally of grades


Syllabus

Textbook (required)


4th Edition (2007)

by Herbert Schildt
McGraw Hill/Osborne
623 pages.

4th Edition: ISBN: 0072263849 ($39.99 list price; $26.39 + shipping on Amazon)

Other Books To Consider (in the past 2 years, book prices have dropped, from say $45 to $30)

An introduction that assumes the reader is new to programming.
Java Demystified: A Self-Teaching Guide

Jim Keogh
McGraw Hill/Osborne (2004)
300 pages
ISBN 0-07-225454-8 ($16)

An introduction similar to our textbook, but more comprehensive and with less guidance for the non-programmer:
Java 2 The Complete Reference
Seventh Edition (2006)
by Herbert Schildt
McGraw Hill/Osborne
1024 pages
ISBN: 0072263857 ($33)

Innovative teaching style: photos, cartoons, puzzles, and whatever else might keep you from getting bored.
Head First Java, 2nd Edition
by Kathy Sierra & Bert Bates
O'Reilly (2005)
ISBN: 0596007736 ($30)
http://www.oreilly.com/catalog/hfjava/?CMP=IL7015

Handy reference if you do not want to use http://java.sun.com/j2se/1.4.2/docs/api/
(also has a brief introduction for people who are already programmers):
Java in a Nutshell, 5th Edition

bDavid Flanagan
2005
Series: In a Nutshell
ISBN 0-596-00773-6
992 pages, $30

More thorough and detailed than what we cover in this introductory course.
Best for people with a C/C++ background.
Learning Java, 3rd Edition (2005)

Patrick Niemeyer & Jonathan Knudsen
O'Reilly
0596008732
856 pages, $30


Course Description 

http://www.unex.berkeley.edu/cat/course346.html
X429.9 (2 semester units in EECS)
Java, with its platform independence and support for animation, graphics, and sound, is heavily used in interactive Web pages that work on Windows, Macintosh, UNIX, and other platforms. Learn the Java programming language even if you aren't a programmer. Examine fundamental programming concepts and statements and basic object-oriented programming, and get an introduction to Java applets. On successful completion of the course you are able to write simple Java applications and applets and be prepared to undertake advanced courses in Java.

Our Focus:
Applets (logic within a web browser) and Swing (graphical user interface) will be briefly introduced. Today, Java is heavily used in servlets and middleware (business logic that runs on a server without a graphical user interface). One example would be web services, such as https://www.discoverygate.com/webservice/1.0/. This introductory course for nonprogrammers focuses on the Java programming language and covers fundamental programming concepts and basic object-oriented programming. On successful completion of the course, you will be able to write simple Java applications and be prepared to undertake courses that assume some background in computer programming and/or the ability to learn Java skills rapidly.


Grading

Criteria for Grading the Homework, Midterm, and Final

  • Homework
    • Is the homework emailed on time?
    • Does the header comply with the required format?
    • Does the code compile?
    • Does the code run?
    • Does the code address the assignment problem?
    • Does the code solve the assignment problem?
  • Adherence to structured design methodology and, when appropriate, object-oriented design
  • Simplicity: is the implementation sufficient, without unnecessary complexity?
  • Naming:
    • Do variables and members have consistent names that adhere to standard Java conventions?
    • Are the names indicative?
  • Documentation (code comments)
    • Do the comments explain briefly the big picture at the top: approach, algorithm, usage tips?
    • Do the comments make the code easier to understand and maintain, without stating the obvious or causing clutter?

Attendance

You are responsible for your work. You do not have to contact the instructor with a reason of absence.

Withdrawing

If you decide to withdraw, it is your responsibility to make sure that U.C. Berkeley Extension processes your withdraw request and removes your name from the final grading form. If your name appears on the official grading form, the instructor will assign you the grade you earned at the end of the five weeks.

Grading Options for UCBX Courses

·        CLG - Credit-Letter-Grade is the normal grading option.
 

·        P/NP - Pass/No-Pass. Requires 70% for a Pass.
 

·        C/NC - Credit/No-Credit. A grade of No Credit will be assigned if you have done
insufficient work for any of the other grading options.
 

·        W - Withdraw. If you cannot complete the course, you will normally be assigned a
grade of NC. Under certain circumstances, you might be eligible to "Withdraw" from the
course. You must initiate this action directly with UC Berkeley Extension.
 

·        INC - Incomplete. If you have completed 60% of the course work, but cannot finish the
work by the end of the term, you are eligible for an Incomplete. You must get the form from Extension and have me sign the form by the last day of class, then make a copy for your records. I will submit the form along with the course grades and keep a copy for clearing the incomplete. See the section below: "Clearing Incompletes".

Method of Assigning Course Grades

·        If you earned a 'B' or better, I assign the earned grade.
 

·        If you have at least a 70% AND you have requested the P/NP option, I assign a grade of Pass.
 

·        If you have not completed 60% of the course work, I assign a grade of No Credit.

If you have done 60% - 79% of the course work and have not requested P/NP, I assign an Incomplete.

Clearing Incompletes

If you received an Incomplete, you have 90 days from the last class meeting.
to submit all remaining work. For this class, that would be 14-NOVEMBER-2005.
To clear an incomplete, email all the remaining work on one day in a zip.

Remember to identify each assignment with your full name, the term it pertains to, and the name
and EDP number of the course it pertains to.

Clearing incompletes involves significant administrative overhead on my part. To minimize
the work, I only address the clearing of incompletes once a month, on the last weekend of the
month. Therefore, it may actually be several weeks before I clear an incomplete once all work
has been submitted. When you see the updated grades on the website tally, contact
Extension directly to get an updated transcript.

Academic Dishonesty

The mid-term and final exam must be the individual work of each single without the help of others, books, or notes.
If you cheat, you fail that exam.

Tally Page for Homework, Midterm, and Final

See explanations on the Tally page.


Submitting Homework

  • I do not accept floppy disks because of the risks of a computer virus.
  • Attach each homework’s source code file to an email as a text file attachment, such as MyHelloWorld.java.
  • Do NOT
    • insert your source code in the body of the email (formatting lost)
    • send compiled bytecode (unnecessary because I want to compile your codce)
    • attach a ZIP archive (unnecessary unless your project has multiple source code files)
  • BEFORE you send the email to me, please verify the following:
    • your work addresses the assignment (if you have any doubts, email me beforehand)
    • your source code file is named correctly for the class it contains
    • your source code compiles (using only the command-line compiler)
    • the resulting class file runs (using only the command-line)
    • your comments explain what your code does in a clear, brief manner
    • your formatting and naming of class members and variables conform to Java conventions
    • the header comment of the source code file provides
      • sample output
      • any special usage information (for example, if a user must type a special argument at the command line)
         
The email Subject line should follow this format:
·        
Email Header: First Course in Java Homework #1, Student 03hj

The attached Java source code file must contain the following:

  • a comment header that:

    • identifies you

    • provides sample output

    • details any usage instructions necessary to run the program

  • your source code

 

The header comment should follow this format:

/* First Course in Java, EDP311720
   Homework 1
   Student 03hj, HENDRIX, Jimi
    Sample output:
    Hello World!
*/
/*
 * The HelloWorld class is an application that
 * displays "Hello World!" to the standard output.
 */
 public class HelloWorld {
 // Display "Hello World!"
 public static void main(String[] args) {
      System.out.println("Hello World!");
      }
   }

  • The timestamp of your email of the current week's homework to java@WORDesign.com must be before 5:00 p.m. on Sunday.
  • If you email the homework by 5:00 p.m. Saturday, I can probably help you solve any problem you might be having with the homework.
  • Note: I do not check email during regular working hours (Monday - Friday: 8 a.m. to 6 p.m.)
  • Each day your homework is late, it loses a grade, for example, an A (4) becomes a B (3).
  • To verify that I received your homework, please check the Tally page after 12:00  noon Monday.

How to copy from the output of the DOS prompt

  1. Click the icon for the command prompt, which is in the top left corner. A menu appears.
  2. Select Edit > Mark.
  3. Drag your cursor over the characters that you want to mark for saving. This copies the text.
  4. Paste the text in your source code file.

Download the Java Development Kit, Standard Edition - J2SE 6.0

Download Sun's JDK (Java Development Kit) for your computer's platform:

For Windows or Linux, you can see Sun's instructions at http://java.sun.com/docs/books/tutorial/getStarted/cupojava/
but it links to an older version of Java. Instead, download the current version of Java Development Kit (JDK 5.0), which is at  http://java.sun.com/javase/downloads/index.jsp

  1. Go to http://java.sun.com/
  2. On the Downloads menu, click Java SE (standard edition).
  3. Download the Java SE Development Kit (JDK) for JDK 6 Update 14.

For MacOS, Java is already built-in, and Apple users should read: http://developer.apple.com/java/

Many users have issues getting their applications to compile and run. You might want to read lecture1/index.htm#PATH and CLASSPATH

For documentation,

  1. Go to http://java.sun.com/
  2. On the Documentation menu, use the link: http://java.sun.com/javase/reference/index.jsp
  3. Note the array of offerings at http://java.sun.com/javase/6/docs/technotes/guides/index.htm

 

Use a Text Editor

For this First Course in Java, we recommend that you write your source code using a text editor you like.
Some text editors feature "syntax highlighting", that is, color to your source code to indicate the type (comments, keywords, strings, brackets, numbers).
Some provide shortcut keys that make it easier to compile and run a command-line application.

  • TextPad: http://www.textpad.com ($30, easy to use, with useful features for this course)
  • Notepad++ (free with good features) - just google Notepad++
  • UltraEdit-32: http://www.ultraedit.com/ ($40: with more features)
  • JEdit, a text editor written in Java: http://sourceforge.net/projects/jedit/ and perhaps a good choice for Mac users
  • Notepad - no color coding (free with Windows, but not the best choice for learning Java)
  • Word--save as text - (free with Windows, but not the best choice for learning Java)
  • vi or emacs (UNIX)
  • SimpleText (Mac)

There are integrated development environments (IDEs) with sophisticated features, but I do not recommend them for the first course because gaining familiarity with a new tool costs time, can distract the student from the fundamental language concepts, and can complicate the submission of your homework by email. The instructor lists some IDEs for your information only.


About the instructor

Thomas Albert has taught First Course in Java in the following terms:

  • Fall 2009 (EDP 311944)
  • Summer 2009 (EDP 305375)
  • Fall 2008 (EDP 318402)
  • Spring 2007 (EDP 306969)
  • Summer 2006 (EDP 304758)
  • Fall 2005 (EDP 321299)
  • Summer 2005 (EDP 305789)
  • Spring 2005 (EDP 126581)
  • Fall 2004 (EDP 128645)
  • Summer 2004(EDP 124115)
  • Spring 2004 (EDP 123158)
  • Summer 2003 (EDP 135277)
  • Spring 2003 (EDP 306704)

He is Advisory Technical Writer for Software Developer Documentation at Symyx Technologies, a Silicon Valley firm that serves the biotech and pharmaceutical chemistry industries.
He writes sample code, syntax reference, and developer guide documentation involving Java, .NET, and the Cheshire scripting language for chemical structure database normalization.
He has 12 years experience in publishing technical information about software and 8 years experience teaching at the college level.
He holds a UC Berkeley Extension Certificate in Computer Information Systems, a doctoral degree in English, and a bachelors degree (with High Honors) in Political Science from U.C. Berkeley.
For more information, see http://www.WORDesign.com


last updated: 14-NOV-2009
Copyright © 2002 - 2009 granted to the Regents of the University of California