Using Java
in the
Intro CS Course Sequence
LACS Meeting
July 25, 1997
Java the language
Strengths
Pure object-oriented
Simple conceptual model (compared to C++)
Type safe - mostly static, some dynamic
No unchecked casts
No explicit pointers / garbage collection
Separation between classes and interfaces (abstraction)
Support for information hiding (public, protected, etc.)
Good support for GUI (1.1 better than 1.02)
Support for exceptions, threads
Packages provide some support for name-space control
Fixed some C syntax (booleans)
Weaknesses
C syntax:
Switch statements
Wrong order for declarations
Still too complex
conversions (25 pp. of rules)
static overloading
No support for parametric polymorphism (yet!).
Requires use of Object type for container types.
Requires lots of gratuitous down-casts.
Java compilers
Widely available on multiple platforms
Multi-platform executables, work under browsers
GUI/graphics display not always same
Java 1.1 now out - different GUI philosophy from 1.02
Debuggers slow in coming out - but Metrowerks fine on Mac.
Compilers and interpreters still pretty slow.
What Java makes possible
Teach OO design
Objects early
Adding components to systems
Interface vs class
Code reuse/incremental changes
Focus on interaction
Concurrency
Sample Projects
Josephus assignment
Maze demo
Calculator assignment
Animal assignment
Timer assignment
Problems I encountered
No good Java books to learn on own in 2 weeks.
General dearth of Java-based CS1 and CS2 texts.
Careful selection of examples is key.
Don't expect students to get design on own
Don't throw too much at them too fast
Graphics great, but not same on all platforms/browsers.
Correct use of layout manager takes patience.
Java 1.1 GUI use significantly different from 1.02.
Lessons learned
Don't teach like traditional imperative:
Go with object-oriented philosophy
Teach OO design
Use GUI interface and take advantage of interaction and concurrency
Applets worked well:
make fun to show off projects.
But limited use of files.
Probably do both applets and applications (can package each inside other).
Lots of info available on-line.
Where are we going?
Java now in CS2, graphics.
Probably in CS1 second semester.
Some systems courses might shift to it
Where will students learn C?
Will they use any other languages in course work outside of AI or Programming Languages?
A final question
Is systems design becoming more important than algorithm design?
If so, shouldn't we be teaching that?
Back to:
Kim Bruce's home page
Williams CS Department home page
kim@cs.williams.edu