Programming Paradigms (PP)

Academic Year:2017/18, 2nd semester Timetable: here
Lecturer:Johann Gamper Lab instructor:Marco Montali, Thomas Tschager
Schedule:TU 10:45-12:45
FR 08:30-10:30, room E2.21
Schedule: FR 14:00-16:00: Ex A (Marco Montali)
FR 14:00-16:00, Ex B (Thomas Tschager)
Office hours:TU 14:00-15:00 or email arrangement Lab office hours:


To learn the key concepts and to get a basic understanding of the most popular programming paradigms and languages, including their strengths and weaknesses. To learn to write small programs in different programming languages.


Students should have a solid mathematical foundation, good programming skills in an imperative or object-oriented language and be familiar with basic data structures and algorithms. These prerequisites are covered in the following courses: Analysis, Introduction to Programming, Programming Project, and Data Structures and Algorithms.


Learning outcomes

Reading List

More details are in the course presentation form.

Timetable and Course Material (year 2016/17)

Week Type Date Topic Slides
1. Lect TU  02.03.2018   Introduction and motivation, programming languages and HCI, programming paradigms, basic elements of programming languages, compiled vs. interpreted, syntax, semantics, data types pdf
2. Lect TU 06.03.2018 Imperative programming, procedural programming, history of imperative programming, abstract data types, information hiding, object-oriented paradigm, objects and classes, messages, inheritance, generics pdf
FR 09.03.2018 Ruby: basic concepts, interpreter, strings, control structures, conditionals, loops, (duck) typing, arrays, hashes, symbols pdf, Ruby web page
3. Lect TU 13.03.2018 Ruby: functions, (named) parameters to functions, code blocks, parameters to code blocks, procs, classes, Ruby metamodel, inheritance, modules, mixins, an sample tree class, insertion sort pdf
Lab FR 16.03.2018 Ruby exercises instructions, exercises
Ruby Homework (deadline: 04.04.2018; responsible TA: Thomas Tschager)
4. Lect TU 20.03.2018 Basics of recursion, tail recursion, efficiency of recursive functions, writing recursive programs, base case, recursive cases, termination pdf
5. No labs and exercises this week
6. Lect TU 03.04.2018 Prolog: logic programming paradigm, basics of Prolog, facts, rules, query processing, goals, atoms, predicates, variables, instantiation, backtracking pdf, Prolog web page
TU 06.04.2018 Prolog: box model, debugging, spy points, trace pdf
Lab FR 06.04.2018 Prolog exercises: knowledge bases, facts, predicates
7. Lect TU 10.04.2018 Prolog: structures, matching structures, equality, comparison operators, arithmetics, lists, splitting lists, enumerating lists, examples (binary search tree, Towers of Hanoi, Sudoku) pdf
FR 13.04.2018 Prolog: accumulators, lists as accumulators, the order of subgoals, the order of clauses/rules, cut operator, cutting the number of solutions, confirming the choice of a rule, cut-fail combination, generate and test pattern, replace cut by not pdf
Lab FR 13.04.2018 Prolog exercises: arithmetics, lists, sorting
8. Lect TU 17.04.2018 Prolog: interactive programs, sorting, insertion sort, mapping lists and structures pdf
FR 20.04.2018 Haskell: introduction, basic concepts, basic functions, conditionals, lists, ranges, list comprehension, basics of the type system, modules pdf, Haskell web page
Lab FR 20.04.2018 (Only Ex B, Thomas Tschager) Prolog exercises: path finding, accumulators, more sorting
9. Lect TU 24.04.2018 Haskell: functions and pattern matching, lazy evaluation, higher order functions, curried functions, user-defined data types, recursive data types, polymorphism, type classes, user-defined type classes, functors pdf
FR 27.04.2018 Haskell: input and output, IO actions, execution of IO actions, file IO, handling errors, MayBe type class pdf
Lab MO 23.04.2018, 16:00-18:00 (Only Ex A, Marco Montali) Prolog exercises: path finding, accumulators, more sorting
10. Lab TH 04.05.2018 Haskell exercises: minimum common divisor, lists
11. Lect FR 08.05.2018 Haskell: functors, applicative functors, pure and impure values, monads, sequenced actions, do notation, mathematical foundation of Haskell pdf
FR 11.05.2018 Erlang: concurrent programming, serial vs. parallel programming, process communication, basic concepts, data types, atoms, variables, pattern matching, lists, tuples pdf, Erlang web page
Lab FR 11.05.2018 Haskell exercises: inner product, sieve of Eratosthenes, sorting
12. Lect TU 14.05.2018 Erlang: modules, functions, local functions, multiple matching possibilities, recursive functions, function evaluation, guards, control structures, anonymous functions, higher-order functions, lists and higher-order functions pdf
FR 18.05.2018 Erlang: processes, creating processes, sending messages, synchronous messaging, asynchronous messaging, realiablity, process links, exception handling, monitoring processes, managing subsystems of processes pdf
Lab FR 18.05.2018 Exercises
13. Lect TU 23.05.2018 Summarization of most important concepts, old exams pdf
Lab FR 25.05.2018 Haskell exercises: operator tree, executables and command-line arguments
14. Lab FR 01.06.2018 Erlang Exercises: sign, string, lists, tuples, simple processes
15. Lab FR 08.06.2018 Erlang exercises: client-server processes


You will get 4 assignments during the semester, one for each programming language. If you hand in the homework, it will be graded and considered to improve your final course mark (for details see below). Each homework will be graded with a mark between 18 and 30 c.l.; if you don't hand in an assignment, it counts with a mark of 18. The final grade of your homework will be determined as the average over the four assignments. The homework is optional.


The assessment of the course consists of a single written exam at the end that covers the whole course:

The first part verifies the ability to solve problems by developing small programs in different programming languages. The second part verifies the understanding of key concepts of different programming paradigms and languages.

If the mark of your homework is greater than the mark of the written exam, the final course exam mark will be computed as the average of the two marks; otherwise, the homework has no impact on the final course mark. Hence, the homework can only increase your final mark.

Previous exams