Advanced Programming [AP-21]

Code 301AA - 9 Credits


LECTURER

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

Laura Bussi <laurabussi@live.it>
Recordings of the lessons RECORDINGS
Syllabus of the course AP-2021-SYLLABUS.pdf

Course Schedule

N.
DATE
TOPIC
SLIDES
NOTES
1
Sep. 14, 2021
Presentation of the course Slides: AP-2021-01.pdf
AP-2021-02.pdf, till page 19
The video of the lesson is accessible on Microsoft Team. If you cannot access it, ask the lecturer.
Poll on Doodle for choosing office hours
2
Sep. 16, 2021
Design patterns
Syntax, Semantics and Pragmatics
Programming languages and Abstract Machines (tbc)
Slides: AP-2021-02.pdf, all
AP-2021-03.pdf till page 19.
Suggested readings: Chapter 1 of Programming Languages: Principles and Paradigms by Maurizio Gabbrielli and Simone Martini
3
Sep. 17, 2021
Compilation and interpretation schemes
Runtime System
The Java Virtual Machine, up to Runtime Data Areas, ...
Slides: AP-2021-03.pdf all.
AP-2021-04.pdf till slide 16 (JVM Runtime Areas).
Suggested readings: Chapter 7: Run-time Enviroments Section 7.1, 7.2 and 7.4.1-2 of "The Dragon Book"
4
Sep. 21, 2021
The Java Virtual Machine: Runtime Areas
Slides: AP-2021-04.pdf, till slide 32. Suggested readings:
JVM Internals, by James D. Bloom http://blog.jamesdbloom.com/JVMInternals.html
Chapters 1 and 2 of The Java Virtual Machine Specification, Java SE 17 Edition
Reference documentation: The Java Language Specification, Java SE 17 Edition
5
Sep. 23, 2021
The JVM: verification, initialition and finalization.
The JVM Instruction Set, start.
Slides: AP-2021-04.pdf, all.
AP-2021-05.pdf, till slide 9.
Suggested readings:
Java Code To Byte Code - Part One, by James D. Bloom, http://blog.jamesdbloom.com/JavaCodeToByteCode_PartOne.html
6
Sep. 24, 2021
The JVM Instruction Set, end.
Slides: AP-2021-05.pdf, all. Suggested readings: Section 2.11 and Chapter 3 of The Java Virtual Machine Specification, Java SE 15 Edition
Java Code To Byte Code - Part One, by James D. Bloom, http://blog.jamesdbloom.com/JavaCodeToByteCode_PartOne.html
7
Sep. 28, 2021
Software Components: an introduction Slides: AP-2021-06.pdf Suggested readings:
Chapter 1 and Chapter 4 of [COMP], Component Software: Beyond Object-Oriented Programming. C. Szyperski, D. Gruntz, S. Murer, Addison-Wesley, 2002.
8
Sep. 30, 2021
Exercises: Inspecting Java bytecode and the JVM
You can upload you solutions in the folder EXERCISES-01, in the File tab of the Team of the course. All your files have to be collected in a single folder with name YYYY-MM-DD-YOURNAME, for example 2021-09-30-CORRADINI

Proposed Exercises: Inspecting the JVM

Instructions: exercises_1.html
Files: javaSources_1.zip
Note:During the lesson the ZIP archive did not contain the right Java files for the exercises: I apologize for that. I updated the ZIP archive. It would be great if you could do or re-do the third exercise on WrongQueue.java
For this lesson, please be sure to have installed:
Any other combination of versions is fine, provided that the three software are compatible and that the JDK has version larger than or equal to 8. Please check that the downloaded software works correctly on you computer.
9
Oct. 1, 2021
Software Components: the Sun approach, JavaBeans
Reflection in programming languages
Slides: AP-2021-07.pdf
AP-2021-08.pdf, up to page 7.
Suggested readings:
10
Oct. 5, 2021
Reflection in Java
Annotations in Java (start)
Slides:
AP-2021-08.pdf, till slide 49.
Suggested readings:
The Java Tutorial on Reflection API, excluding Arrays and Enumerated Types.
The Java Tutorial on Annotations.
11
Oct. 7, 2021
Exercises: Java Beans, Reflection and Annotations
You can upload you solutions in the folder EXERCISES-02, in the File tab of the Team of the course. All your files have to be collected in a single folder with name YYYY-MM-DD-YOURNAME, for example 2021-09-30-CORRADINI
Instructions: exercises_2.html
Suggested activity:
To get ready for the exercises we will propose, practice with Netbeans and with the use/development of Java Beans reading the Oracle JavaBeans Tutorial
12
Oct. 8, 2021
Polymorphism:
  • A classification
  • Overloading & Coercion
  • Inclusion polymorphism & Overriding
  • Explicit parametric polymorphism: Templates in C++.
Slides:
AP-2021-09.pdf
AP-2021-10.pdf, till page 10.
Suggested readings:
13
Oct. 12, 2021
Universal Parametric Polymorphism:
C++ Templates and Java Generics
  • C++ templates
  • Java Generics
  • Bounded type parameters
Slides: AP-2021-10.pdf, till page 10. (C++ templates) all
AP-2021-11.pdf (Java Generics), till page 8.

Compiler Explorer: https://godbolt.org/
(a site for exploring compiled code)
Some C++ code: listings.cpp

Suggested readings:
Java Generics tutorials:
14
Oct. 14, 2021
Generics and inheritance: invariance, covariance and contravariance
Covariance of Arrays in Java
Limitations of Generics.
Slides: AP-2021-11.pdf (Java Generics), all.

Suggested readings:
Covariance and Contravariance in C# https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/covariance-contravariance/
15
Oct. 15, 2021
The Standard Template Library for C++ Slides: AP-2021-12.pdf
An overview of the STL.
Suggested readings:
16
Oct. 19, 2021
Introduction to Functional Programming
  • Historical origins
  • Main concepts
  • Language families: LISP, ML, Haskell
  • Core concepts on Haskell
Slides: AP-2021-13.pdf. Suggested readings:
Students are invited to install the Glasgow Haskell Compiler and Interpreter (GHCI) downloadable from https://www.haskell.org/platform/
17
Oct. 21, 2021
  • Lazy evaluation
  • The lambda-calculus: syntax and beta-reduction
  • Church Booleans, Pairs and Numerals, Arithmetics
  • Fixpoint operator and recursion
  • Evaluation orders in lambda-calculus
  • Call by need in Haskell
Slides: AP-2021-14.pdf Suggested readings:
18
Oct. 22, 2021
More on Haskell
  • List comprehension
  • Algebraic Data Types
  • Higher-order functions and combinators
Slides: AP-2021-15.pdf, till page 16. Suggested readings:
19
Oct. 26, 2021
Type classes in Haskell Slides:
AP-2021-16.pdf, till page 33.
Suggested readings:
20
Oct. 28, 2021
Proposed exercises on fuctional programming with Haskell
You can upload you solutions in the folder EXERCISES-03, in the File tab of the Team of the course. All your files have to be collected in a single folder with name YYYY-MM-DD-YOURNAME, for example 2021-09-30-CORRADINI
Instructions: exercises_3.html
The lesson of Thursday, October 28, will be dedicated to these exercises.
21
Oct. 29, 2021
Type inference
Constructor Classes and Monads in Haskell
Slides:
AP-2021-16.pdf, all. AP-2021-17.pdf, till page 16.
Suggested readings:
22
Nov. 2, 2021
Constructor Classes and Monads in Haskell
Input-Output in Hakell: the IO Monad
Slides:
AP-2021-17.pdf, till page 50.
Suggested readings:
23
Nov. 4, 2021
Type (un)safety in Haskell: unsafePerformIO
Lambda expressions in Java 8
Slides: AP-2021-17.pdf, all. AP-2021-18.pdf, till slide 17. Suggested readings:
24
Nov. 5, 2021
The Stream API in Java 8 Slides: AP-2021-18.pdf, all. AP-2020-21.pdf. Suggested readings:
Nov. 9, 2021
Presentation of the programming assigments on JavaBeans and Reflection in Java. First programming assignment [Suggested deadline: December 5, 2021]

25
Nov. 9, 2021
Software Components: the Microsoft way (start) Slides: AP-2021-20.pdf, till slide 43 (excluding 7-20). Suggested readings:
Chapter 15 of [COMP], sections 15.1, 15.11, 15.12.
Proposed exercises on Type Classes in Haskell and on the JAVA Stream API
Solutions can be uploaded in folder EXERCISES-0405, in the File tab of the Team of the course. All your files have to be collected in a single folder with name YYYY-MM-DD-YOURNAME, for example 2021-11-25-CORRADINI
Exercises on Type Classes in Haskell: exercises_4.html
Exercises on Java Stream API: exercises_5.html
Auxiliary file: people.csv
The lesson of Thursday, November 18, will be dedicated to these exercises.
26
Nov. 11, 2021
Software Components: the Microsoft way (end)
Delegates in C#
Slides: AP-2021-20.pdf, all (excluding 7-20). Suggested readings:
27
Nov. 12, 2021
Frameworks and Inversion of Control Slides: AP-2021-21.pdf Suggested readings:

.NET Core and Microsoft Strategies
Invited lesson by Prof. Antonio Cisternino held on Oct. 22, 2020
28
Nov. 16, 2021
On Designing Software Frameworks Slides: AP-2021-22.pdf Suggested readings:
29
Nov. 18, 2021
Proposed exercises on Type Classes in Haskell and on the JAVA Stream API
Solutions can be uploaded in folder EXERCISES-0405, in the File tab of the Team of the course. All your files have to be collected in a single folder with name YYYY-MM-DD-YOURNAME, for example 2021-11-25-CORRADINI
Exercises on Type Classes in Haskell: exercises_4.html
Exercises on Java Stream API: exercises_5.html
Auxiliary file: people.csv
The lesson of Thursday, November 18, will be dedicated to these exercises.
30
Nov. 19, 2021
The RUST programming language Slides: AP-2021-23.pdf Suggested readings:
Reference documentation on Rust:
31
Nov. 23, 2021
A brief overview of Scripting Languages

Introduction to Python (I)

Slides: AP-2021-24.pdf
AP-2021-25.pdf, till slide 41.
Suggested readings:
32
Nov. 25, 2021
Introduction to Python (II)
  • Dictionaries
  • Control Structures
  • List Comprehension
  • Function definition
  • Functions as objects
  • Higher-order functions
  • Namespaces and Scopes
Slides: AP-2021-25.pdf, all.
AP-2021-26.pdf till slide 25.
Suggested readings:
33
Nov. 26, 2021
More about Python
  • Closures
  • Object Oriented programming in Python
  • Special Methods
  • Multiple Inheritance
  • Name mangling
  • Iterators and generators
  • Typing in Python
Slides: AP-2021-26.pdf till slide 46. Suggested readings:
34
Nov. 30, 2021
  • Garbage collection in CPython
  • The Global Interpreter Lock
  • Miscellaneous criticisms to Python
  • Browsing the Python documentation
AP-2021-26.pdf, all.
34
Nov. 30, 2021
Proposed exercises on Python
Solutions can be uploaded in folder EXERCISES-06, in the File tab of the Team of the course. All your files have to be collected in a single folder with name YYYY-MM-DD-YOURNAME, for example 2021-11-30-CORRADINI
Exercises on Python: exercises_6.html
Auxiliary file: anagram.txt

Dec. 2, 2021
On Thursday, December 2 there will be no lesson. However the lecturer will ve available on Teams from 9:00 to 10:45 for any question about the First Programming Assignment or the Exercises proposed during the course.
35
Dec. 3, 2021
  • "Just in time" to understand, a presentation by Gabriele Pappalardo on Just-In-Time compilation
  • Presentation of the Second Programming Assignment
Link to slides: "Just in time" to understand
Dec. 6, 2021
Second programming assignment [Suggested deadline: January 8, 2022]