Advanced Programming [AP-22]

Code 301AA - 9 Credits


LECTURER

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

Laura Bussi <laurabussi@live.it>
Virtual classroom Advanced Programming Team
To be used only for the first lesson and in case of sanitary emergence.
Timetable Tuesday 9:00 - 11:00, Room L1
Wednesday 9:00 - 11:00, Room A1
Friday 16:00 - 18:00, Room L1
Office hours By appointment sending an email to <andrea@di.unipi.it>.

Page permanently under construction...

Course description

See: https://esami.unipi.it/programma.php?c=56103&aa=2022&docente=CORRADINI&insegnamento=&sd=0

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. The programming assignments have to be submitted at the very latest ten working days before the oral exam. During the oral exam the lecturer may ask questions about any topic 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. Typically, a topic is identified by a number (from 1 to 9) and possibly by one or more letters (eg. 2.b [The JVM Instruction Set], or 6.5 [Type classes in Haskell]). Introductory topics (like 3.a, 5.a, 9.a) will not be accepted.
    In the email proposing the dates for the oral exam (see below) the student has to propose at least two topics among those listed in the syllabus, in decreasing order of preference. 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 a discussion about the progamming assignments.
  3. In the third part the lecturer can ask questions about any topic listed in the syllabus.

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-22] 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. Note: The date of the oral exam can be fixed independently of the date published in the portal, also before that date.

Scheduled Oral Exams

The oral exams are public, and take place in presence. The student can choose the language (either English or Italian). If you are not in Italy, you can ask the lecturer to take the exam online. This is not guaranteed, though.


Programming assignments

  1. First programming assignment
  2. Second programming assignment

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 should inform the lecturer at the beginning of the course, and 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 Object-Oriented programming:

For Functional Programming:

Videos of the lessons of Advanced Programming 2021/22

The videos are accessible here. The topics of each lesson can be found in the page of Advanced Programming, AY 2021/22

Course Schedule

-->
N.
DATE
TOPIC
SLIDES
NOTES
1
Sep. 16, 2021, 16:00-18:00
Presentation of the course Slides: AP-2022-01-CourseOverview.pdf
AP-2021-02-MotivationsIntro.pdf
Video of first lesson
This lesson will be given both in presence and in streaming on Teams. The next lessons will be offered in presence only.
Students attending the course are asked to fill in this FORM, thanks!
2
Sep. 20, 2022
Syntax, Semantics and Pragmatics
Programming languages and Abstract Machines
Compilation and interpretation schemes
Slides: AP-2022-03-Compilation-Interpretation.pdf Suggested readings: Chapter 1 of Programming Languages: Principles and Paradigms by Maurizio Gabbrielli and Simone Martini
3
Sep. 21, 2022
The Java Virtual Machine: architecture and runtime data areas. Slides: AP-2022-04-Intro2JVM.pdf, till page 32. Suggested readings: Chapter 7: Run-time Enviroments Section 7.1, 7.2 and 7.4.1-2 of "The Dragon Book"
4
Sep. 23, 2022
The Java Virtual Machine: Initialization, Verification and Finalization.
The JVM Instruction Set: properties, format and addressing modes.
Slides: AP-2022-04-Intro2JVM.pdf, all.
AP-2022-05-JVM-InstructionSet.pdf, till page 12.
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. 27, 2022
The JVM Instruction Set, end.
Slides: AP-2022-05-JVM-InstructionSet.pdf, all. Suggested readings: Section 2.11 and Chapter 3 of The Java Virtual Machine Specification, Java SE 17 Edition
Java Code To Byte Code - Part One, by James D. Bloom, http://blog.jamesdbloom.com/JavaCodeToByteCode_PartOne.html
6
Sep. 28, 2022
Exercises: Inspecting Java bytecode and the JVM

Proposed Exercises: Inspecting the JVM

Instructions: exercises-1-2022.pdf
Other files: GCstrange.java, 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.
7
Sep. 30, 2022
Software Components: an introduction Slides: AP-2022-06-SoftwareComponentsIntro.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
Oct. 4, 2022
Software Components: the Sun approach, JavaBeans
Slides: AP-2022-07.JavaBeans.pdf
Suggested readings:
9
Oct. 5, 2022
Reflection in Java
Annotations in Java
Slides:
AP-2022-08-Reflection.pdf.
Suggested readings:
The Java Tutorial on Reflection API, excluding Arrays and Enumerated Types.
The Java Tutorial on Annotations.
10
Oct. 7, 2022
Polymorphism:
  • A classification
  • Overloading & Coercion
  • Inclusion polymorphism & Overriding
  • Explicit parametric polymorphism: Templates in C++.
Slides:
AP-2022-09-Polymorphism.pdf
AP-2022-10-Templates.pdf, till page 10.

Compiler Explorer: https://godbolt.org/
(a site for exploring compiled code)

Suggested readings:
11
Oct. 11, 2022
Universal Parametric Polymorphism:
C++ Templates and Java Generics
  • C++ templates
  • Java Generics
  • Bounded type parameters
Slides: AP-2022-10-Templates.pdf (C++ templates) all
AP-2022-11-Generics.pdf (Java Generics), till page 16.

Compiler Explorer: https://godbolt.org/
(a site for exploring compiled code)

Suggested readings:
Java Generics tutorials:
12
Oct. 12, 2022
Exercises: Java Beans, Reflection and Annotations
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
You can send your solutions to the lecturer <andrea.corradini@unipi.it> and to Laura <laurabussi@live.it>, to get a feedback.
13
Oct. 14, 2022
Covariance of Arrays in Java
Limitations of Generics.
The Standard Template Library for C++
Slides: AP-2022-11-Generics.pdf (Java Generics), all.
AP-2022-12-STL.pdf (STL), till slide 15

Suggested readings:
Covariance and Contravariance in C# https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/covariance-contravariance/
  • The Standard Template Library Tutorial, by Johannes Weidl: Page 4, 12 and parts of Chapter 4 "Learning STL"
  • 14
    Oct. 18, 2022
    The Standard Template Library for C++ (cont.)
    Introduction to Functional Programming
    • Historical origins
    • Main concepts
    • Language families: LISP, ML, Haskell
    Slides: AP-2022-12-STL.pdf (STL), all
    AP-2022-13-FP.pdf (Functional Programming), till pag. 11.
    Suggested readings:
    Students are invited to install the Glasgow Haskell Compiler and Interpreter (GHCI) downloadable from https://www.haskell.org/platform/
    15
    Oct. 19, 2022
    Core concepts on Haskell Slides: AP-2022-13-FP.pdf (Functional Programming), all. Suggested readings: see previous lesson
    16
    Oct. 21, 2022
    • 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
    • Other parameter passing mechanisms
    Slides: AP-2022-14-Lambda.pdf Suggested readings:
    17
    Oct. 25, 2022
    More on Haskell
    • List comprehension
    • Algebraic Data Types
    • Higher-order functions and combinators
    Slides: AP-2022-15-Haskell2.pdf, till page 18. Suggested readings:
    18
    Oct. 26, 2022
    Exercises on fuctional programming with Haskell
    Instructions: exercises_3.html
    Students are invited to install the Glasgow Haskell Compiler and Interpreter (GHCI) downloadable from https://www.haskell.org/downloads/
    19
    Oct. 28, 2022
    Type classes in Haskell Slides:
    AP-2022-16-TypeClasses_inference.pdf, till page 37.
    Suggested readings:
    20
    Nov. 02, 2022
    Type inference
    Constructor Classes and Monads in Haskell
    Slides:
    AP-2022-16-TypeClasses_inference.pdf, all. AP-2022-17-Monads.pdf, till page 14.
    Suggested readings:
     
    Nov. 04, 2022
    The lesson of Friday, November 4 is canceled because of unavailability of the lecturer
    21
    Nov. 08, 2022
    More on Constructor Classes and Monads in Haskell
    Input-Output in Hakell: the IO Monad
    Type (un)safety in Haskell: unsafePerformIO
    Slides:
    AP-2022-17-Monads.pdf, all.
    Suggested readings:
    22
    Nov 09, 2022
    Proposed exercises on Type Classes in Haskell Exercises on Type Classes in Haskell: exercises_4.html
    23
    Nov. 11, 2022
    Lambda expressions in Java 8 Slides: AP-2022-18-JLambdas.pdf Suggested readings:
    24
    Nov. 15, 2022
    The Stream API in Java 8 Slides: AP-2022-19-JStreams.pdf. Suggested readings:
    25
    Nov. 16, 2022
    Software Components: the Microsoft way (start)
    Slides: AP-2022-20-20-MS-Components.pdf, till page 44. Suggested readings:
    • Chapter 15 of [COMP], sections 1, 2, 4, 11 and 12.
    26
    Nov. 18, 2022
    This lesson will start at 4:30 PM, in Room L1 as usual.
    Software Components: the Microsoft way (end)
    Slides: AP-2022-20-20-MS-Components.pdf, all.
    Short presentation of the programming assigments on JavaBeans and Reflection in Java.
    Suggested readings:
    Nov. 19, 2022
    Programming assigments on JavaBeans and Reflection in Java. First programming assignment [Suggested deadline: December 20, 2022]
    27
    Nov. 22, 2022
    Frameworks and Inversion of Control Slides: AP-2021-22-IOC.pdf Suggested readings:

    .NET Core and Microsoft Strategies
    Invited lesson by Prof. Antonio Cisternino held on Oct. 22, 2020
    28
    Nov 23, 2022
    Proposed exercises on Java Stream API Exercises on Java Stream API: exercises_5.html
    Auxiliary file: people.csv
    29
    Nov. 25, 2022
    On Designing Software Frameworks Slides: AP-2022-22-DesigningFrameworks.pdf Suggested readings:
    30
    Nov. 29, 2022
    The RUST programming language: An introduction (Part 1) Slides: AP-2022-23-RUST.pdf, till page 25. Suggested readings:
    Reference documentation on Rust:
    31
    Nov. 30, 2022
    The RUST programming language: An introduction (Part 2) Slides: AP-2022-23-RUST.pdf, till page 45. Suggested readings:
    Reference documentation on Rust:
    32
    Dec. 2, 2022
    The RUST programming language: An introduction (Part 3)
    Introduction to Python
    Slides: AP-2022-23-RUST.pdf, all.
    AP-2022-25-Python.pdf.
    Suggested readings:
    33
    Dec. 6, 2022
    An overview of Python concepts:
    • Function definitions and parameter passing
    • Higher order functions and Decorators
    • Namespaces and Scopes
    • Object Oriented programming, Multiple inheritance, Name mangling
    • Iterators and generators
    • Garbage collection and the Global Interpreter Lock
    Slides: AP-2022-26-Python-OOP.pdf. Suggested readings:
    Dec. 24, 2022
    Second programming assignment

    Links