This course is the continuation of SINF1160. Its main objectives are the same : teach the students to build programs that are correct right from the start without relying to a trial and error process.
Additional basic programming concepts such as files, graphical interfaces, linked and recursive data structures are introduced. Moreover, basic fundamental concepts of object oriented programming are described (exemplified with Java).
Main themes
- Input/output operations at the machine language level and its relational to multiprogramming
- Sequential files : binary files and text files
- Recursion
- Java classes to build graphical interfaces (AWT)
- Object oriented concepts illustrated with Java
- Logical and physical data structures
- Recursive data structures
- Linked data structures
Content and teaching methods
The teaching is organised in the same way as SINF1160.
The material addressed in the lectures is as follows (presented in that order).
- Input/output operations at the machine language level are considered. Their study motivates the introduction of multiprogramming and consequently of a kernel operating system including a file system.
- Two data models for handling files in Java are proposed. Standard Java classes for files are too complicated to be used in this introductory course. Thus simpler classes based on a data model similar to Pascal files are used. They are completely specified. Only two classes are defined. The first one allows the students to manipulate text files while the other makes it possible to handle arbitrary binary files.
- Recursion is introduced as a reasoning method to build algorithms following a different approach (than previously). The role of local variables (including parameters) in this context is emphasized.
- The basic concept of a ``class defined by the user'' is introduced (for Java). This includes the following notions : instance variables, non static methods, constructors, accessibility of classes and class members.
- Inheritance is introduced as a most fundamental oriented object concept aiming at making it possible to reuse code in a simple and correct way.
- The underlying principles of standard libraries for building graphical interfaces are explained. This is an excellent topic to illustrate the use of inheritance. A very small number of AWT classes are described. But they are sufficient to build simple graphical interfaces and to understand the overall principles of such tools. The event model used by AWT is elicited in full.
- More ``advanced'' concepts of object-oriented programming (in Java) are explained : interfaces, abstract classes, abstract methods, dynamic method calls (how they work exactly). The handling of exceptions is also presented.
- The use of abstract classes to implement recursive data structures is illustrated using binary trees as an exemple.
- Java interfaces are related to the general notion of logical data type.
- Several definitions of lists are presented and discussed to illustrate and contrast notions such as logical versus physical data structures and their relations to interfaces and implementation classes. It is shown how the limited ``multiple inheritance'' mechanism of interfaces in Java allows one to use or reuse a physical data structure (a class) to implement a given logical data structure (an interface).
Classroom exercises and projects are organized and evaluated exactly in the same way as for the course SINF1160.
Other information (prerequisite, evaluation (assessment methods), course materials recommended readings, ...)