Programming Paradigms (PP)

Academic Year:2016/17, 2nd semester
Lecturer:Johann Gamper Lab instructor:Theodoros Chondrogiannis
Schedule:TU 08:30-10:30
TH 08:30-10:30, room E221
Schedule: TH 14:00-16:00, Ex B
FR 10:30-12:30, Ex A
Office hours:TU 11:00-12:00 or email arrangement Lab office hours:TH 17:00-18:00, POS 2.12 or email arrangement (tchond@inf.unibz.it)

Objectives

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.

Prerequisites

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.

Syllabus

Learning outcomes

Reading List

More details are in the course presentation form.

Timetable and Course Material

Week Date Topic Slides Homework External links
1. TU 28.02.2017 Introduction and motivation, programming languages and HCI, programming paradigms, basic elements of programming languages, compiled vs. interpreted, syntax, semantics, data types pdf
TH 02.03.2017 Imperative programming, procedural programming, history of imperative programming, abstract data types, information hiding, object-oriented paradigm, objects and classes, messages, inheritance, generics pdf
No exercises this week
2. TU 07.03.2017 Ruby: basic concepts, interpreter, strings, control structures, conditionals, loops, (duck) typing, arrays, hashes, symbols pdf Ruby HW
Deadline: 29/3/2017

example
Ruby web page
TH 09.03.2017 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
TH 09.03.2017 Ruby exercise: arrays, files, classes, modules, mixins instructions
firstruby.rb

exercises
solutions
FR 10.03.2017
3. TU 14.03.2017 Basic idea of recursion, tail recursion, efficiency of recursive functions, writing recursive programs, base case, recursive cases, termination pdf Prolog HW
Deadline: 3/5/2017

basegraph.pl
Prolog web page
TH 16.03.2017 Prolog: logic programming paradigm, basics of Prolog, facts, rules, query processing, goals, atoms, predicates, variables, instantiation, backtracking pdf
TH 16.03.2017 Prolog exercise: knowledge bases, facts, predicates. instructions
minibase.pl

exercises
family.pl
solutions
FR 17.03.2017
4. No lectures or exercises this week
5. TU 28.03.2017 Prolog: box model, debugging, spy points, trace pdf
TH 30.03.2017 Prolog: structures, matching structures, equality, comparison operators, arithmetics, lists, splitting lists, enumerating lists, examples (binary search tree, Towers of Hanoi, Sudoku) pdf
TH 30.03.2017 Prolog exercise: arithmetics, lists. sorting. exercises
solutions
FR 31.03.2017
6. TU 04.04.2017 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
TH 06.04.2017 Prolog: interactive programs, sorting, insertion sort, mapping lists and structures pdf
TH 06.04.2017 Prolog exercise: path finding, accumulators, more sorting exercises
solutions
FR 07.04.2017
7. TU 11.04.2017 Haskell: introduction, basic concepts, basic functions, conditionals, lists, ranges, list comprehension, basics of the type system, modules pdf Haskell HW
Deadline: 24/5/2017

spatial.hs
Haskell web page
TH 13.04.2017 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
No exercises this week
8. TU 18.04.2017 Haskell: input and output, IO actions, execution of IO actions, file IO, handling errors, MayBe type class pdf
TH 20.04.2017 Haskell: functors, applicative functors, pure and impure values, monads, sequenced actions, do notation, mathematical foundation of Haskell pdf
TH 20.04.2017 Haskell exercise: minimum common divisor, lists instructions
fac.hs

exercises
solutions
FR 21.04.2017
9. No lectures or exercises this week
10. TU 02.05.2017 No lectures this week
TH 04.05.2017
TH 04.05.2017 Haskell exercise: inner product, sieve of Eratosthenes, sorting exercises
solutions
FR 05.05.2017
11. TU 09.05.2017 Erlang: concurrent programming, serial vs. parallel programming, process communication, basic concepts, data types, atoms, variables, pattern matching, lists, tuples pdf Erlang HW
Deadline: 11/6/2017
Erlang web page
TH 11.05.2017 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
TH 11.05.2017 Haskell exercise: operator tree, executables and command-line arguments exercises
solutions
FR 12.05.2017
12. TU 16.05.2017 Erlang: basic concepts of processes, creating processes, sending messages, synchronous messaging, asynchronous messaging, realiablity, process links, exception handling, monitoring processes, managing subsystems of processes pdf
TH 18.05.2017 Summarization of most important concepts, old exams pdf
TH 18.05.2017 Erlang Exercise: sign, string, lists, tuples, simple processes instructions
yam.erl

exercises
flights.txt
solutions
FR 19.05.2017
13. No lectures this week
TH 25.05.2017 Erlang exercise: client-server processes exercises
solutions
FR 26.05.2017

Homework

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.

Exam

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