Content of the course #
This is a programming course for beginners, with an emphasis on:
- (class-based) object-oriented programming and
- functional programming.
Programming languages #
We will use:
- Haskell at the beginning of this course, for a short introduction to functional programming, and
- Java during the rest of the course, for object-oriented and more general techniques.
Note. Many notions seen in this course are not specific to Haskell or Java. Accordingly, some sections may use pseudocode for conciseness.
Scope and limitations.
The introduction to Haskell is very incomplete. This is by design: we will use it briefly, as didactic support only.
The amount of syntax that we provide for both languages is on purpose restricted (yet sufficient for the exam and assignments). Feel free to use alternative constructs in your assignments or during the exam.
Focus #
Problems #
The course puts emphasis on problem solving, rather than syntax.
In particular, most lectures include exercises.
Advice. We encourage you to try to solve these exercises. This is the best way to prepare for the exam.
Foundations #
Some lectures focus on more abstract (albeit simple) notions. These includes elementary mathematical objects or structures: set, tuple, map, relation, preorder, etc.
The purpose is twofold:
- generalize techniques seen in this course to languages other than Java and Haskell,
- provide a widely accepted vocabulary to document/explain your code.
Note. What is considered good communication in computer science may differ from other disciplines. Emphasis is put on clarity, precision and conciseness.
Here is a (caricature of) a poorly documented Java method. Can you improve the method’s description and/or signature?
/** The algorithm looks at the first input collection, and is only guaranteed to
* work if no number is present twice in this collection, in which case it
* loops over the numbers contained in this collection (in no specific order)
* and checks for each number whether it is also present in the second input
* collection (which is also expected to have distinct numbers). The code
* written in this loop adds the current number (from the first collection)
* to the output collection if this number is also present in the second
* collection, and does nothing with this number otherwise.
*/
Collection<Integer> filterNumbersThatAreShared(Collection<Integer> c1,
Collection<Integer> c2);
A simpler signature and description could be:
/**
* Returns the intersection of sets s1 and s2.
*/
Set<Integer> intersection(Set<Integer> s1, Set<Integer> s2);
Topics #
The main topics covered during this course are:
- objects, classes and interfaces (inheritance, encapsulation, value vs reference, comparing objects, cloning objects, etc.),
- abstract data types (set, list, associative array, queue, etc.) and data structures (array, linked list, hash table, tree, etc.),
- parameterized types/generics,
- recursion,
- higher-order and anonymous functions,
- functional patterns (folds, pipelines/streams, etc.),
- multithreading.
Due to limited time, many notions (such as asymptotic cost, hash tables or multithreading) are only briefly introduced in this course. Some of them will be further discussed in other courses of the bachelor.