Computer programming

A.Y. 2017/2018
Overall hours
Learning objectives
Il corso di Programmazione è un corso di 12 crediti finalizzato all'insegnamento della programmazione. Trattandosi di un corso di base, non richiede alcuna conoscenza specifica pregressa; obiettivo del corso è formare gli studenti alla programmazione in senso tradizionale, mediante l'uso del linguaggio Java.
Expected learning outcomes
Course syllabus and organization

Single session

Lesson period
First semester
Unita' didattica
Course syllabus

· What computer science is
· Algorithms, examples. From algorithms to programs
· Programming languages (machine language, assembly, high-level languages)
· Information (bit, byte,...)
· The computer as a programmable machine
· Computer architecture: von Neumann's machine
· On the digital representation of information
· Computation on a von Neumann's machine
· CPU inner architecture: ALU and CU
· A toy CPU and its assembly language
· The software lifecycle
· High-level languages
· Programming tools
· Translators, editors
· The Java Virtual Machine (JVM)
· Why Java
· Structured programming
· Concepts of variable, type, assignment
· Selection and iteration
· Introducing object-oriented programming
· Syntactic issues: BNF and syntax charts; a brief introduction to Java grammar; first examples of Java programs
· Method invocation
· Constructor invocation
· I/O-related classes
· Prototypes, signatures, overloading
· The String class: constructors and objects
· Classes of variables: primitive types, reference types
· Using the class Frazione
· Control structures in Java
· Selection: if, switch
· The boolean type and logic operators
· Cycles: while, do, for
· Testing palindromes
· Instructions break and continue
· Infinite cycles
· Expressions: type and value
· Side effects
· Lazy evaluation
· Numerical integral types and operators
· Numerical floating-point types and operators
· Type conversions and casting
· Operator +, the toString method
· Char type, its relation with integral types
· Precedence rules
· Constants
· The switch instruction
· Static methods
· Wrapper classes, boxing and unboxing
· Enumerative types, their use in switch statement
· Arrays, examples
· For-each cycle for arrays
· On multi-dimensional arrays
· Parameters to the main method
· The class Sequenza and use of generics
· The Rettangolo class
· The Quadrato class
· Relations between Quadrato and Rettangolo
o Inheritance
o UML representation
o Overriding
o Using references
o Polymorphism
o instanceof
· Example about FigureAreaMax
· The Cerchio class
· An introduction to abstract classes
· Summary: the class hierarchy, the type hierarchy
· The Object class
· Usage of reference types (promotion, casting)
· Dynamic binding
· Examples
· Interfaces
· Interfaces as types
· Implementing classes: the Frazione class
· The Orario class
· Static members and methods
· The final modificator (for attributes)
· Summary about class members
· Garbage collection
· Implementing an interface
· Inheritance (the Quadrato class)
· Constructors and inheritance
· Extending abstract classes
· Variable shadowing: using this
· Using super
· Method and construction overloading
· Access modifiers
· The final modifier for methods and classes
· The equals method
· Examples of classes with inheritance
· Invoking constructors and methods
· Parameter passing
· Varargs
· Memory structure in Java
· Activation records and execution stack
Unita' didattica
Course syllabus

· Operating systems (Windows, Linux)
· Examples of algorithms
· Simple JAVA programs
· Branching and Loops
· Data, variables and expressions. Strings
· Array. Parameters of main()
· Classes, inheritance and polymorphism
· Files
· Implementation of classes
· Design and deployment of a complex project
· Exceptions
· Recursion
Unita' didattica
INF/01 - INFORMATICS - University credits: 9
Lessons: 72 hours
Professor: Mereghetti Carlo
Unita' didattica
INF/01 - INFORMATICS - University credits: 3
Laboratories: 48 hours
Turno A
Professor: Santini Massimo
Turno B
Professor: Vigna Sebastiano
On appointment, via email
Uff. S 6008, VI floor, Dip. Informatica "Giovanni Degli Antoni", via Celoria 18, 20133 Milano, Italy
room S207 via Comelico, 39