Advanced Programming [AP-18]

Code 301AA - 9 Credits


LECTURER

Tutor
Andrea Corradini <andrea@di.unipi.it>

Matteo Busi <matteo.busi@di.unipi.it>
Timetable Monday 11-13, Room Fib A1
Tuesday 9-11, Room Fib C1
Thursday 16-18, Room Fib L1
Office hours Click here
To fix a date, send an email to <andrea@di.unipi.it>

Course description

See: https://esami.unipi.it/esami2/programma.php?c=39364&aa=2018&cid=69&did=13

Syllabus of the course


Evaluation

The final grade is based on the evaluation of the programming assignments that will be proposed along the course, and on a final oral exam. During the oral exam the lecturer may ask questions about any of the topics presented during the course as detailed in the Syllabus of the course.

Structure of the Oral Exam

The Oral Exam consists of three parts:
  1. In the first part of the exam (~15 minutes) the student is invited to present one of the topics of the Syllabus, agreed upon with the lecturer. The presentation has to be oral, without the support of slides.
    In the email proposing the dates for the oral exam (see below) the student has to propose at least three topics among those listed in the Syllabus, in decreasing order of preference. Typically, a topic is identified by a number (from 1 to 9) and possibly by a letter (eg. 2.b [The JVM Instruction Set], or 8 [An overview of the Rust programming language]). However, any topic addressed during the course can be proposed. The lecturer will make the best effort to assign the preferred topic, unless too many students have chosen the same one.
  2. The second part of the oral exam is dedicated to the progamming assignments.
  3. In the third part the lecturer can ask questions about any topic listed in the Syllabus, with the exception of those marked [Optional].

Exam dates

Students can take the oral exam during the exam sessions, fixing a date with the lecturer. Each student should first register for one of the dates published on the portal https://esami.unipi.it/esami2/, which is only possible after filling the evaluation questionnaire. Next the student should send an email to the lecturer with subject "[AP-18] Oral Exam", proposing some dates for the oral exam (not earlier than five days after the date of the email) and proposing the topics for the first part of the oral exam, as explained above.

Scheduled Oral Exams

The oral exams are public. The student can choose the language (either English or Italian). Here are dates and locations of the next oral exams. Warning: changes are possible with short notice. Past exams:
  • Konrad Gnoinski: Date: January 18, Time: 15:30. Location: Sala Riunioni Ovest of Dipartimento di Informatica
  • Dorian Grosch: Date: January 17, Time: 16:00. Location: Sala Riunioni Ovest of Dipartimento di Informatica
  • Simone Schirinzi: Date: January 24, Time: 11:00. Location: Sala Riunioni Ovest of Dipartimento di Informatica
  • Alessandro Di Giorgio: Date: January 24, Time: 14:00. Location: Sala Riunioni Ovest of Dipartimento di Informatica
  • Leonardo Frioli: Date: January 25, Time: 15:00. Location: Sala Riunioni Est of Dipartimento di Informatica
  • Andrea Bongiorno: Date: January 25, Time: 16:30. Location: Sala Riunioni Est of Dipartimento di Informatica
  • Laura Bussi: Date: January 31, Time:9:30. Location: Sala Riunioni Est of Dipartimento di Informatica
  • Stefano Duo: Date: January 31, Time: 11:00. Location: Sala Riunioni Est of Dipartimento di Informatica
  • Matteo Franceschi: Date: February 5, Time: 11:00. Location: Sala Riunioni Ovest of Dipartimento di Informatica
  • Dilshod Quvvatov: Date: February 7, Time: 15:30. Location: Sala Riunioni Ovest of Dipartimento di Informatica
  • Tabriz Hajiyev: Date: February 7, Time: 17:30. Location: Sala Riunioni Ovest of Dipartimento di Informatica
  • Lorenzo Bellomo: Date: February 8, Time: 9:30. Location: Sala Riunioni Ovest of Dipartimento di Informatica
  • Yousuf Arar: Date: February 8, Time: 11:30. Location: Sala Riunioni Ovest of Dipartimento di Informatica
  • William Guglielmo: Date: February 12, Time:11:00. Location: Sala Riunioni Est of Dipartimento di Informatica
  • Flavio Ascari: Date: February 13, Time: 15:30. Location: Sala Riunioni Ovest of Dipartimento di Informatica
  • Giacomo de Liberali: Date: February 19, Time: 9:00. Location: Sala Riunioni Ovest of Dipartimento di Informatica
  • Aldo D'Aquino: Date: February 19, Time: 11:00. Location: Sala Riunioni Ovest of Dipartimento di Informatica
  • Alessandro Pacini: Date: February 20, Time: 16:30. Location: Sala Riunioni Ovest of Dipartimento di Informatica
  • Eugenio Paluello: Date: February 21, Time: 15:30. Location: Sala Riunioni Ovest of Dipartimento di Informatica
  • Francesco Tosoni: Date: February 21, Time: 17:00. Location: Sala Riunioni Ovest of Dipartimento di Informatica
  • Federico Mulas: Date: February 26, Time:11:00. Location: Sala Riunioni Ovest of Dipartimento di Informatica

Programming assignments

  1. First programming assignment [Deadline: November 12, 2018]
  2. Second programming assignment [Deadline: December 20, 2018]
  3. Third programming assignment [Deadline: January 15, 2019]

Prerequisites

In order to take full advantage of the course and of being able to pass the final exam in a reasonable time, students are required to have an undergraduate level knowledge of at least one object-oriented programming language (like Java, C++, C# or others) and of at least one functional programming language (like Haskell, OCaml, Scheme or others). Students having a weak background on such topics are strongly encouraged to review by themselves the core notions of Object-Oriented and Functional Programming at the beginning of the course, possibly exploiting the following online material:

For Functional Programming:

For Object-Oriented programming:


Course Schedule

N.
DATE
TOPIC
SLIDES
NOTES
1
Sep. 17, 2018
Presentation of the course Slides: AP-2018-01.pdf
AP-2018-02.pdf
2
Sep. 18, 2018
Languages and Abstract Machines
Compilation and interpretation schemes
Slides: AP-2018-03.pdf Suggested readings: Chapter 1 of Programming Languages: Principles and Paradigms by Maurizio Gabbrielli and Simone Martini
3
Sep. 20, 2018
Compilation and interpretation schemes
Entry test
Slides: AP-2018-03.pdf The entry test is intented to evaluate if students have the necessary prerequisites of the course, namely knowledge of concepts of Object-Oriented and Functional programming.
4
Sep. 24, 2018
Runtime Systems and Introduction to the JVM
Slides: AP-2018-04.pdf Suggested readings: JVM Internals, by James D. Bloom
http://blog.jamesdbloom.com/JVMInternals.html
Chapter 7: Run-time Enviroments Section 7.1, 7.2 and 7.4.1-2 of "The Dragon Book"
Reference documentation:
The Java Virtual Machine Specification, Java SE 8 Edition
The Java Language Specification, Java SE 8 Edition
5
Sep. 25, 2018
JVM internals
Slides: AP-2018-05.pdf
6
Sep. 27, 2018
The JVM Instruction Set
Slides: AP-2018-06.pdf Suggested readings: Chapter 2 of The Java Virtual Machine Specification, Java SE 8 Edition
Java Code To Byte Code - Part One, by James D. Bloom, http://blog.jamesdbloom.com/JavaCodeToByteCode_PartOne.html
A First Taste of InvokeDynamic, by Charles Nutter, http://blog.headius.com/2008/09/first-taste-of-invokedynamic.html
7
Oct. 1, 2018
Room A1
Exercises: Inspecting the JVM
Students are invited to bring their own laptop.
Instructions: exercises_1.html
Files: javaSources_1.zip
Software needed for the exercises:
8
Oct. 2, 2018
Software Components: an introduction Slides: AP-2018-07.pdf Suggested readings:
Chapters 1 and 4 of [COMP], Software Components: Beyond Object-Oriented Programming. C. Szyperski, D. Gruntz, S. Murer, Addison-Wesley, 2002.
9
Oct. 4, 2018
Software Components: the Sun approach, JavaBeans Slides: AP-2018-08.pdf Suggested readings:
10
Oct. 8, 2018
Reflection in Java Slides: AP-2018-09.pdf Suggested readings:
The Java Tutorial on Reflection API, excluding Arrays and Enumerated Types.
11
Oct. 9, 2018
Software Components: the Microsoft way Slides: AP-2018-10.pdf, till page 29 Suggested readings:
Chapter 15 of [COMP], sections 15.1, 15.2, 15.4, 15.11, and 15.12.
12
Oct. 11, 2018
Software Components: the Microsoft way (cont.) Slides: AP-2018-10.pdf, all.
Reflection in CLR and C#: optional reading.
13
Oct. 15, 2018
Room A1
Exercises: JavaBeans and Reflection in Java
  • Students are invited to bring their own laptop.
  • To optimize the lab activity, students may read the Oracle JavaBeans Tutorial
Instructions: exercises_2.html
Software needed for the exercises:
14
Oct. 16, 2018
Frameworks and Inversion of Control Slides: AP-2018-11.pdf, till page 32. Suggested readings:
15
Oct. 18, 2018
On Designing Software Frameworks Slides: AP-2018-11.pdf, all
AP-2018-12.pdf
Suggested readings:
16
Oct. 22, 2018
  • On Designing Software Frameworks (cont.)
  • Polymorphism
    • A classification
    • Overloading &Amp; Coercion
    • Inclusion polymorphism &Amp; Overriding
    • Explicit parametric polymorphism: Templates in C++.
Slides: AP-2018-12.pdf, all
AP-2018-13.pdf (Polymorphism)
AP-2018-14.pdf (C++ templates), till page 7
Suggested readings:
Oct. 23, 2018
Presentation of programming assigments on NetBeans, JavaBeans and Reflection in Java. First programming assignment [Deadline: November 12, 2018]

Software needed for the exercises:
17
Oct. 23, 2018
Universal Parametric Polymorphism:
C++ Templates and Java Generics
  • C++ templates
  • Java Generics
  • Bounded type parameters
  • Generics and inheritance: invariance, covariance and contravariance
Slides: AP-2018-14.pdf (C++ templates) all
AP-2018-15.pdf (Java Generics)
Suggested readings:
18
Oct. 25, 2018
The Standard Template Library for C++
Slides: AP-2018-16.pdf (STL)
Suggested readings:
19
Nov. 5, 2018
Introduction to Functional Programming
  • Historical origins
  • Main concepts
  • Language families: LISP, ML, Haskell
  • Core concepts of Haskell
  • Lazy evaluation
Slides: AP-2018-17.pdf Suggested readings:
20
Nov. 6, 2018
  • The lambda-calculus: syntax and beta-reduction
  • Church Booleans and Numerals, Arithmetics
  • Fixpoint operator and recursion
  • Evaluation orders in lambda-calculus
  • Call by sharing, by name and by need
  • Laziness in Haskell
  • List comprehension
Slides: AP-2018-18.pdf Suggested readings:
21
Nov. 8, 2018
More on Haskell and on Functional Programming
  • Algebraic Data Types
  • Higher-order functions
  • Higher-order combinators
  • Tail Recursion Optimization
  • Converting recursion into Tail Recursion
Slides: AP-2018-19.pdf Suggested readings:
22
Nov. 12, 2018
Exercises on Functional Programming in Haskell.
Students are invited to bring their own laptop.
Instructions: exercises_3.html Students are invited to install the Glasgow Haskell Compiler and Interpreter (GHCI) downloadable from https://www.haskell.org/platform/
An excellent tutorial on Haskell: http://learnyouahaskell.com
23
Nov. 13, 2018
Type classes in Haskell Slides: AP-2018-20.pdf, all. Suggested readings:
24
Nov. 15, 2018
Constructor Classes and Monads in Haskell
Slides: AP-2018-21.pdf. Suggested readings:
25
Nov. 19, 2018
Exercises on Type Classes and Monads in Haskell.
Students are invited to bring their own laptop.
Instructions: exercises_4.html An excellent tutorial on Haskell: http://learnyouahaskell.com
26
Nov. 20, 2018
Lambda expressions in Java 8 Slides: AP-2018-22.pdf Suggested readings:
27
Nov. 22, 2018
The Stream API in Java 8 Slides: AP-2018-23.pdf Suggested readings:
28
Nov. 26, 2018
Exercises on the Stream API and on partial functions in Java 8.
Students are invited to bring their own laptop.
Instructions: exercises_5.html
Auxiliary file: people.csv
Suggested readings:
Use of Optional in Java, http://www.oracle.com/technetwork/articles/java/java8-optional-2175753.html
29
Nov. 27, 2018
The RUST programming language Slides: AP-2018-24.pdf Suggested readings:
  • Introduction to Rust, slides by Haozhong Zhang
    Reference documentation of Rust:
  • https://doc.rust-lang.org/book/2018-edition/index.html
  • 30
    Nov. 29, 2018
    Scripting Languages Slides: AP-2018-25.pdf Suggested readings:
    31
    Dec. 3, 2018
    Exercises on the Stream API and on partial functions in Java 8 (cont.).
    Students are invited to bring their own laptop.
    Instructions: exercises_5.html
    Auxiliary file: people.csv

    Note: In the last 20 minutes the Second Programming Assignment will be presented

    Suggested readings:
    Use of Optional in Java, http://www.oracle.com/technetwork/articles/java/java8-optional-2175753.html
    Dec. 3, 2018
    Presentation of programming assigment on Haskell and Java 8 Stream API. Second programming assignment [Deadline: December 20, 2018]

    32
    Dec. 4, 2018
    Introduction to Python
    • Basic and Sequence Datatypes
    • Dictionaries
    • Control Structures
    • List Comprehension
    • Function definition
    Slides: AP-2018-26.pdf PythonFunction.pdf Suggested readings:
    33
    Dec. 6, 2018
    More about Python
    • Namespaces and Scopes
    • Object Oriented programming in Python
    • Inheritance
    • Iterators and generators
    • Functions as objects
    • Higher-order functions
    • Importing modules
    Slides: AP-2018-27.pdf Suggested readings:
    34
    Dec. 10, 2018
    Exercises on Python
    Students are invited to bring their own laptop.
    Instructions: exercises_6.html
    Auxiliary files: anagram.txt, people.csv

    Students should install the Python interpreter from https://www.python.org/downloads/
    35
    Dec. 11, 2018
    Even More about Python
    • Higher-order combinators vs. list comprehension
    • Decorators
    • Garbage collection in CPython
    • The Global Interpreter Lock
    • Miscellaneous criticisms to Python
    • Exception handling in Python (sketch)
    Slides: AP-2018-28.pdf Suggested readings:
    36
    Dec. 13, 2018
    Scripting in Python
    • Browsing the Python documentation
    • Builtin functions
    • Python Standard Library
    • Example of scripts in Python
    • Style guidelines for writing scripts
    • Presentation of the third assignment
    Slides: AP-2018-29.pdf Suggested readings:
    Dec. 18, 2018
    Publication of programming assigment on Scripting in Python, presented in the lecture of December 13. Third programming assignment [Deadline: January 15, 2019]

    Links