Computer Programming with Java

Introduction and Purpose: This page is maintained by Mike Scott, scottm@cs.utexas.edu. It is designed for students who have been admitted to the Turing Scholars program at the Computer Science Department at the University of Texas at Austin. This page is intended to be used to ensure you have the prerequisite computer programming skills for CS315H, the first course in Programming taken by Turing Scholars during the fall of there freshmen year. If you have never done any computer programming then this page will serve as a guide for you to learn how to program on your own. If you have programming experience then you should pick up at what you feel is the appropriate spot in the guide. If you feel you already have all the prerequisite knowledge this guide covers, then I suggest you do several of the final programming exercises.

"The Process of preparing programs for a digital computer is especially rewarding, not only because it can be economically  and scientifically rewarding, but also because it can be an aesthetic experience much like composing poetry or music."

 -Donald Knuth, 1974 Turing Award Winner, Preface to The Art of Computer Programming

"Having surveyed the relationships of computer science with other disciplines, it remains to answer the basic questions: What is the central core of the subject? What is it that distinguishes it from the separate subjects with which it is related? What is the linking thread which gathers these disparate branches into a single discipline? My answer to these questions is simple -- it is the art of programming a computer. It is the art of designing efficient and elegant methods of getting a computer to solve problems, theoretical or practical, small or large, simple or complex. It is the art of translating this design into an effective and accurate computer program."

C. A. R. Hoare, 1980 Turing Award Winner

Approach: This page serves as a guide for learning to design and implement computer programs using the Java programming language. It makes use of materials available for free on the word wide web.

What is programming? Computer programming is not the same thing as computer science. It is a tool used in the study of computer science. Programming is the design of a solution to a problem and the implementation of this solution in a computer program. Both design and implementation are important in programming although many people, when learning to program, try to skip the design step. For non trivial problems the designing a solution is usually the hardest part. The conundrum is that if you don't know how to program you usually start with fairly simple problems that have an obvious, simple solution, so that you can focus on learning the skill of implementing the solution. (Typical first exercises are creating programs to convert from one temperature scale to another or to calculate the area of geometric figures). Computer programs and computer languages require a level of exactness and non ambiguity many people find infuriating. After an initial period of frustration the implementation becomes easy and more time is spent on designing the solution. (Exercises at this point are limited only by the imagination of the instructor. Some simple examples. Create a simulation of a game of craps and determine how often people win. Create a program to decipher messages encrypted using a substitution cipher. Create a program to play mastermind against a computer opponent. Create a program to compress and decompress text files.)

Textbook and Tools: 

  1. Download the text. The textbook for this guide is Java Au Naturel. This book is available for free via the internet at www.cs.ccsu.edu/~jones/book.htm. You may either download the whole book in a zipped format or look at chapters via the links on the book homepage. The book is in pdf format and you must have the Adobe Acrobat reader. If you do not have the Adobe Acrobat reader you may download it here.
  2. Download and install the Java 2 Standard Edition (J2SE) Follow the instructions on the Java Programming page from the How Stuff Works website.
  3. You can create Java program using any text editor such as notepad. Many people find it helpful to use an Interactive Development Environment. This is a graphical application that allows you to create, edit and run Java programs. One simple IDE is BlueJ. It is available at www.bluej.org. The instructions for installing BlueJ are here. Another option is JCreator which is a little more powerful than BlueJ. The Limited Edition is available for free at www.jcreator.com. The LE version is on the bottom of the download page.

Programming required knowledge:

What is the programming prerequisite to the CS 315H course? You should be able to design and implement a program in Java that solves a non trivial problem. The program will involve 3 - 6 classes and consist of 300 - 500 lines of code. The program will make use of arrays of objects. The program will require the use of functional decomposition along the order of 15 or more methods / functions / procedures. Here are the topics you should be comfortable with. The list is based on the prerequiste knowledge for CS 307, the data structures course at the UTCS department and the ACM Computing Curriculum 2001 Computer Science Volume, December 15, 2001. 

Topics in Computer Programming

1. Basic syntax and semantics of a higher-level language
2. Variables, types, expressions, and assignment
3. Basics of boolean logic (truth tables, and, or, not operators)
4. Conditional control structures
5. Iterative control structures
6. Structured decomposition
7. Arguments and parameters, reference and value parameters
8. The role of algorithms in the problem-solving process
9. The concept and properties of algorithms
10. Arrays
11. 2 Dimensional Arrays
12. Records/Structures/Objects
13. Strings and string processing
14. Data representation in memory
15. The concept of recursion
16. Recursive mathematical functions
17. Simple recursive procedures
18. Implementation of user defined data types (classes / structs)

The skills you must have are:

Skills in Computer Programming

1. Analyze and explain the behavior of simple programs.
2. Modify and expand short programs that use standard conditional and iterative control structures and functions.
3. Design, implement, test, and debug a program that uses each of the following fundamental programming constructs: basic computation, simple I/O, standard conditional and iterative structures, and the definition of functions.
4. Choose appropriate conditional and iteration constructs for a given programming task.
5. Apply the techniques of structured (functional) decomposition to break a program into smaller pieces.
6. Describe the mechanics of parameter passing.
7. Discuss the importance of algorithms in the problem-solving process.
8. Identify the necessary properties of good algorithms.
9. Create algorithms for solving simple problems.
10. Use pseudocode or a programming language to implement, test, and debug algorithms for solving simple problems.
11. Discuss the representation and use of primitive data types and built-in data structures.
12. Describe the concept of recursion and give examples of its use.
13. Identify the base case and the general case of a recursively defined problem.
14. Compare iterative and recursive solutions for elementary problems such as factorial.
15. Describe the divide-and-conquer approach.
16. Design and implement a program in that solves a non trivial problem. The program will involve 3 - 6 classes and consist of 300 - 500 lines of code. The program will make use of arrays of objects/structures. The program will require the use of functional decomposition along the order of 15 or more methods / functions / procedures.

The next step is to go to the course of study. There are several reading assignments and programs. You should pick up the course of study at the point you feel comfortable. The true test of your knowledge is if you can complete the programming assignments.

Course of Study