CPSC 331 — Java Development Exercises

Programming Cartoon

Java Development Exercises

Overview

Almost all lectures and tutorialsl in this course will concentrate on the design and analysis of data structures and algorithms. However, assignments will include questions that must be answered by developing Java programs and giving evidence that these correctly and efficiently solve the problems they should.

A small amount of help to set up your Java development environment will be provided during the second week of the course. Students will be expected to make use of the supplied material — available on this page — and work independently to get things running, after that.

Useful Information If You Just Arrived — or Only Use Windows

Most of the students in this course have completed two half-courses in computer science at the University of Calgary and they can probably skip over the beginning of the material that follows. Students who are also familiar with the UNIX/Linux operating system and have already been using it to do course work, for computer science courses, can possibly skip over the rest as well. However, students who have only been using the Windows operating system will need to become familiar with UNIX/Linux and the support for this provided by the Department of Computer Science.

Exercise #1: Waking Up and Smelling the Roses (or the Coffee)

This includes steps to follow in order to make sure that Java can be used with the Department of Computer Science’s systems, along with links to information about the Java programming language.

Exercise #2: Connecting the Dots (or the Class Files)

This includes instructions that you can follow in order to make sure that Java class files are stored, and found, in standard places. This is important, and you should make sure that things work as expected now, because it is not guaranteed that your source code will be compilable by markers when you submit code for assessment, otherwise!

Exercise #3: Enjoying Coffee at Home

This includes instructions that you can follow to set up a Java development on your computer at home (if you do not already have one), so that most of your work can be done without logging onto a compute server at school. Please note, though, that any code that you submit for assessment will be compiled, run and tested using the Department of Computer Science's Unix compute servers — so that marks might be lost, or your code might not be marked at all, if your code cannot be compiled and run in this way.

Exercise #4: Give a Man a Fish... (About Oracle’s Java Documentation)

This includes information about Oracle’s online Java documentation. It also mentions a problem with the Java implementations from Lecture #3 and Tutorial Exercises #3 and #4, and encourages you to try to use the online documentation, being discussed, to develop better Java implementations to solve the problem that has been noticed.

Exercise #5: What Do You Mean, My Code Isn’t Flawless?.... Part One

This discusses the use of the test harness, JUnit, to run tests on Java programs.

Exercise #6: What Do You Mean, My Code Isn’t Flawless?... Part Two

This discusses the use of Unix shell scripts to perform additional tests on programs.

Exercise #7: Documentation on Steroids I — How To Be More Assertive

This discusses the use of “assert” statements to make programs self-checking, in order to make testing and debugging easier, without compromsing the correctness or efficiency of these programs.

Exercise #8: Holy Software Flaw, Batman!!! How Are We Going To Get Out of THIS!?!?!

This introduces the Java code debugger “jdb” and takes you through an example of its use.

Exercise #9: Documentation on Steroids II — Javadoc

This provides more information about the use of “javadoc” to produce online documentation for Java programs.

Exercise #10: Time Keeps on Ticking... Ticking... Ticking...

This describes the UNIX/Linux “time” utility, which can be used to measure the time used by a software execution.

The following shell scripts for use at home are based on the assumption that the GNU time utility has been installed and is available as

/usr/local/bin/time

They will need to be edited if the utility has been installed somewhere else and they cannot be used, at all, if this has not been installed at all — so that the “time” utility that is part of the UNIX/Linux shell is to be used instead.

Exercise #11: A “Profiler” Isn’t Just Somebody Who Catches Bad Guys on TV

This introduces the Java profiler, “visualvm” which can be used to measure and display information about the computing resources used when a program is executed.


University of Calgary Extension of Logo
Department of Computer Science

cpsc 331 computer science faculty of science u of c

cpsc 331 intro and math review analysis of algorithms basic data structures and adts search trees hash tables searching and sorting graph algorithms java develoment exercises assignments tests