Programming 2

A.Y. 2021/2022
6
Max ECTS
60
Overall hours
SSD
INF/01
Language
Italian
Learning objectives
The topic of this course is Object-Oriented Programming through the use of the Java programming language; we aim at presenting the methods and techniques of object-oriented programming and of the specific language adopted, giving an overview of its base syntax.
Expected learning outcomes
Ability of writing programs in the OOP paradigm.
Course syllabus and organization

Single session

Responsible
Lesson period
First semester
More specific information on the delivery modes of training activities for academic year 2021/22 will be provided in the coming months, based on the evolution of the public health situation.
Course syllabus
▪ Introduction to the course
▪ What is information technology [1.1]
▪ From algorithms to programs [1.2]
▪ Programming languages (machine, assembly, high level)
▪ Classification of high-level languages
⁃ imperative languages
⁃ functional languages
⁃ logical languages
⁃ OOP
▪ Software life cycle
▪ Software crisis
▪ Structured programming [1.9]
▪ Concepts of variable, type, assignment [1.10]
▪ Selection (decide if n is even or odd) [1.11]
▪ Iteration (sum of first n numbers; what happens if n = 0 ?; computing a sum of seq.; average; average / even computation; MCD computation) [1.11]
▪ Other examples (x * y by means of iterated sums, x / y by iterated subtractions) [1.11]
▪ Introduction to object-oriented programming [1.12]
▪ Syntactic aspects [1.13]
▪ BNF and syntactic charts [1.13]
▪ Introduction to the Java grammar [1.14]
▪ First examples of Java programs [1.15]
▪ Method invocations [2.1.1]
▪ Invocation of constructors [2.1.1]
▪ Classes for I / O [2.1.1, 2.1.2]
▪ Examples [2.1.2]
▪ Prototypes, signatures, overloading [2.2]
▪ String: constructors and objects [2.3]
▪ Types of variables: primitive vs. reference types [2.4]
▪ Examples (the Fraction class) [3.1]
▪ Use of the Fraction class [3.1]
▪ Best practices: comments, indentation, reference to javadoc ([7.8])
▪ if [3.2]
▪ The boolean type and logical operators [3.3, 3.4]
▪ Iterations: while, do, for [3.5, 3.6]
▪ Examples (including: palyndrome) [3.5, 3.6]
▪ Break and continue instructions [3.7]
▪ Infinite cycles
▪ Expressions: type, value [4.1]
▪ Side effects [4.1]
▪ Lazy evaluation [4.1]
▪ Integers and operators [4.3, 4.2]
▪ Floating-point numeric types and operators [4.4, 4.2]
▪ Type and cast conversions [4.5]
▪ Operator +; the toString method [4.5]
▪ Type char; relation to integer types [4.6]
▪ Rules of precedence
▪ Constants
▪ Switch instruction [4.8]
▪ Static methods [4.9]
▪ Wrapper classes [4.10]
▪ Boxing and unboxing [4.10]
▪ Enumerative types (outline) and their use in switches [4.7]
▪ Arrays with examples [5.1]
▪ Foreach cycles for arrays [5.2]
▪ Notes on multi-dimensional arrays [5.6]
▪ Main: parameters [5.3]
▪ Examples
▪ Sequence and use of generic classes [5.7]
▪ Rectangle Class [6.1]
▪ Square Class [6.3]
▪ Relations between Square and Rectangle [6.4]
▪ Inheritance
▪ UML representation
▪ Overriding
▪ Use of references
▪ Polymorphism
▪ instanceof
▪ Example FigureAreaMax
▪ Circle class
▪ Introduction to abstract classes [6.5]
▪ Summary: class hierarchy, type hierarchy [6.6]
▪ Object class [6.6]
▪ Use of reference types (promotions, cast) [6.7]
▪ Dynamic binding [6.8]
▪ An example [6.9]
▪ Overview of packages
▪ File management [6.10]
▪ Examples [6.11]
▪ Interfaces [6.12]
▪ Interfaces and types [6.12]
▪ Class implementation: the Fraction class [7.1, 7.2]
▪ The Hour class [7.4]
▪ Static methods and fields [7.5]
▪ Final modifier (for attributes)
▪ Summary on class members [7.6]
▪ Garbage collection [7.6]
▪ Implementation of an interface [7.7]
▪ Inheritance (the Square class) [8.1]
▪ Constructors and inheritance [8.2]
▪ Extensions of abstract classes
▪ Shadowing of variables: use of this
▪ Use of super [8.3]
▪ Method and constructor overloading [8.4, 8.5]
▪ Access Modifiers [7.10, 8.13]
▪ Final modifier for methods and classes
▪ The equals method [8.7]
▪ Examples of classes and inheritance [8.9, 8.10, 8.11]
▪ Invocation of constructors and methods [8.2]
▪ Parameter passing [10.1]
⁃ Call by value
⁃ Notes on other methods
⁃ Call by reference
▪ varargs
▪ Memory organisation [10.2]
▪ Stack and activation record [10.2]
▪ Recursive methods [10.3]
▪ Postfix notation
▪ Introduction to exceptions [11.1]
▪ Exceptions [11.2]
▪ Postfix notation with exceptions [11.4]▪ Introduction to the course
▪ What is information technology [1.1]
▪ From algorithms to programs [1.2]
▪ Programming languages (machine, assembly, high level)
▪ Classification of high-level languages
⁃ imperative languages
⁃ functional languages
⁃ logical languages
⁃ OOP
▪ Software life cycle
▪ Software crisis
▪ Structured programming [1.9]
▪ Concepts of variable, type, assignment [1.10]
▪ Selection (decide if n is even or odd) [1.11]
▪ Iteration (sum of first n numbers; what happens if n = 0 ?; computing a sum of seq.; average; average / even computation; MCD computation) [1.11]
▪ Other examples (x * y by means of iterated sums, x / y by iterated subtractions) [1.11]
▪ Introduction to object-oriented programming [1.12]
▪ Syntactic aspects [1.13]
▪ BNF and syntactic charts [1.13]
▪ Introduction to the Java grammar [1.14]
▪ First examples of Java programs [1.15]
▪ Method invocations [2.1.1]
▪ Invocation of constructors [2.1.1]
▪ Classes for I / O [2.1.1, 2.1.2]
▪ Examples [2.1.2]
▪ Prototypes, signatures, overloading [2.2]
▪ String: constructors and objects [2.3]
▪ Types of variables: primitive vs. reference types [2.4]
▪ Examples (the Fraction class) [3.1]
▪ Use of the Fraction class [3.1]
▪ Best practices: comments, indentation, reference to javadoc ([7.8])
▪ if [3.2]
▪ The boolean type and logical operators [3.3, 3.4]
▪ Iterations: while, do, for [3.5, 3.6]
▪ Examples (including: palyndrome) [3.5, 3.6]
▪ Break and continue instructions [3.7]
▪ Infinite cycles
▪ Expressions: type, value [4.1]
▪ Side effects [4.1]
▪ Lazy evaluation [4.1]
▪ Integers and operators [4.3, 4.2]
▪ Floating-point numeric types and operators [4.4, 4.2]
▪ Type and cast conversions [4.5]
▪ Operator +; the toString method [4.5]
▪ Type char; relation to integer types [4.6]
▪ Rules of precedence
▪ Constants
▪ Switch instruction [4.8]
▪ Static methods [4.9]
▪ Wrapper classes [4.10]
▪ Boxing and unboxing [4.10]
▪ Enumerative types (outline) and their use in switches [4.7]
▪ Arrays with examples [5.1]
▪ Foreach cycles for arrays [5.2]
▪ Notes on multi-dimensional arrays [5.6]
▪ Main: parameters [5.3]
▪ Examples
▪ Sequence and use of generic classes [5.7]
▪ Rectangle Class [6.1]
▪ Square Class [6.3]
▪ Relations between Square and Rectangle [6.4]
▪ Inheritance
▪ UML representation
▪ Overriding
▪ Use of references
▪ Polymorphism
▪ instanceof
▪ Example FigureAreaMax
▪ Circle class
▪ Introduction to abstract classes [6.5]
▪ Summary: class hierarchy, type hierarchy [6.6]
▪ Object class [6.6]
▪ Use of reference types (promotions, cast) [6.7]
▪ Dynamic binding [6.8]
▪ An example [6.9]
▪ Overview of packages
▪ File management [6.10]
▪ Examples [6.11]
▪ Interfaces [6.12]
▪ Interfaces and types [6.12]
▪ Class implementation: the Fraction class [7.1, 7.2]
▪ The Hour class [7.4]
▪ Static methods and fields [7.5]
▪ Final modifier (for attributes)
▪ Summary on class members [7.6]
▪ Garbage collection [7.6]
▪ Implementation of an interface [7.7]
▪ Inheritance (the Square class) [8.1]
▪ Constructors and inheritance [8.2]
▪ Extensions of abstract classes
▪ Shadowing of variables: use of this
▪ Use of super [8.3]
▪ Method and constructor overloading [8.4, 8.5]
▪ Access Modifiers [7.10, 8.13]
▪ Final modifier for methods and classes
▪ The equals method [8.7]
▪ Examples of classes and inheritance [8.9, 8.10, 8.11]
▪ Invocation of constructors and methods [8.2]
▪ Parameter passing [10.1]
⁃ Call by value
⁃ Notes on other methods
⁃ Call by reference
▪ varargs
▪ Memory organisation [10.2]
▪ Stack and activation record [10.2]
▪ Recursive methods [10.3]
▪ Postfix notation
▪ Introduction to exceptions [11.1]
▪ Exceptions [11.2]
▪ Postfix notation with exceptions [11.4]
▪ Throwing exceptions [11.6]
▪ Controlled and non-controlled exceptions [11.8]
▪ Throwing exceptions [11.6]
▪ Controlled and non-controlled exceptions [11.8]
Prerequisites for admission
Basic programming skills (Programmazione 1)
Teaching methods
Lessons + guided labs + labs
Teaching Resources
G. Pighizzini, M. Ferrari: Dai fondamenti agli oggetti. Corso di programmazione JAVA, Addison-Wesley, Pearson Education Italia.
Assessment methods and Criteria
Group project + individual oral test, or individual lab project.
INF/01 - INFORMATICS - University credits: 6
Laboratories: 24 hours
Lessons: 36 hours
Professor: Re' Matteo
Professor(s)