Introduction to Computer Programming, using Java :: course home page

This course is an introduction to computer programming, using the Java programming language. Due to the nature of Java, object-orientation is at the heart of the course.

This course is currently being offered at McGill University's School of Computer Science (SOCS) from January 4th to April 13th, 2005, (every Monday, Wednesday, and Friday, 12:30-13:30). Click here for SOCS's official information about it.

Course content

Though the syllabus and schedule are subject to change, they are a very good indication of the course content.

Suggested reading

Due to the plethora of online documentation on the subject of computer programming using Java, a physical textbook is not necessary, though if you insist on using one, the course will follow "Java Software Solutions (Fourth Edition, Addison-Wesley)" by John Lewis and William Loftus. If you do decide to buy this book, please take a look at the errata.

Where to buy? A good, locally owned and operated, computer-book store in Montreal is "Info Livres Plus" - and the book costs 112$ with tax.

A really good online Java book is A Little Book on Java, by Fatima Ahmad and Prakash Panangaden. Read it!

While you're programming, it may be helpfull to refer to the Java 2 Platform API. For instance, I looked up the Scanner class when I couldn't create a Scanner object using the static create method, as the following statement in the official course book suggests:

Scanner scan = Scanner.create( System.in );
The API documentation says that it should be done as follows, using the new operator and the Scanner constructor:
Scanner scan = new Scanner( System.in );
The reason for the difference is that the book is based on a "beta" version of Java, one that is a touch older than the current 1.5 release.

What is Java?

Java is an object-oriented computer programming language.

A computer programming language is a standardized communication technique for expressing instructions to a computer. It is a set of syntactic and semantic rules used to define computer programs. A language enables a programmer to precisely specify what data a computer will act upon, how these data will be stored/transmitted, and precisely what actions to take under various circumstances. A programming language can be thought of as a set of formal specifications concerning syntax, vocabulary, and meaning.

Object-oriented programming (OOP) is a computer programming paradigm in which a software system is modeled as a set of objects that interact with each other. Object-oriented programming emphasizes the following concepts: objects, abstraction, encapsulation, polymorphism, inheritance, etc.

The Paradigm of OOP is essentially not that of programming, but one of design, a system is designed by defining the objects that will exist in that system, the code which actually does the work is irrelevant to the object, or to the people using the object due to encapsulation.

Getting started...

Recommended reading:

News

Effective April 17th: The example code I showed in class throughout the term is now available in the "Example code" section. The rest of the lecture notes (chapter 9-11/12) are now available, including the second half of chapter 8.

Assignments

Lecture notes

For your convenience, here are some lecture notes.

Example code

For your convenience, here is the example code used throughout the term in class.

Midterm Exam

Please look at these midterm tips and study hard!
The Reality Check Quiz #2 & #3 and solutions are here.

Final Exam

Make sure you fully understand the "blocks" example code (pay attention to "abstract classes"). Also make sure you understand the "recursion" example code (pay special attention to the "throwing an exception" component of the "recursion" example code).

The final exam is scheduled for April 20th at 9AM at the GYM. For more info: http://www.mcgill.ca/students-information/exam/

Free software awareness

I am an advocate of free (as in freedom) software. Since this is a computer programming course, it requires the use of computers. For a computer to be useful, it needs software, most notably an operating system (and in addition, for this course, a Java platform).

For an operating system, my recommendation depends on who you are. If you are continuing in computer studies and you really want to learn how computers work, I recommend a version of the GNU system. If you are brave, try Gentoo; otherwise, if you prefer an easy installation and a minimal learning curve, then I recommend Mandrake, SuSE, and Ubuntu.

For a Java platform, you will most likely fall to the shackles of the "Java Trap". If you are concerned, please read the full article by Richard Stallman about the Java Trap; here is a quote:

Sun's implementation of Java is non-free. Blackdown is also non-free; it is an adaptation of Sun's proprietary code. The "standard" Java libraries are non-free also. We do have free implementations of Java, such as the GNU Java Compiler and GNU Classpath, but they don't support all the features yet. We are still catching up.

If you develop a Java program on Sun's Java platform, you are liable to use Sun-only features without even noticing. By the time you find this out, you may have been using them for months, and redoing the work could take more months. You might say, "It's too much work to start over." Then your program will have fallen into the Java Trap; it will be unusable in the Free World.

If you're really interested in trying to avoid the Java Trap, please read about GNU and the Java language.

GNU/Linux alternatives to proprietary software

If you're going to give a GNU/Linux distribution a try, the following lists of software alternatives will help you greatly.

Please use the list at the following URL: http://www.sot.com/en/migration/migration.shtml; however, if that link is down, please use this local copy.

The above list is based on the table at the following URL: http://linuxshop.ru/linuxbegin/win-lin-soft-en/table.shtml; however, if that link is down, please use this local copy.