Programming and Data Bases

A.Y. 2024/2025
12
Max ECTS
96
Overall hours
SSD
INF/01 ING-INF/05
Language
English
Learning objectives
The aim is to provide a comprehensive overview of computer science applied to the solution of real problems. The course will introduce fundamental and advanced programming techniques, using the Python language. Also, it will provide the conceptual and technical tools required to understand and design the specification of a database and to implement it into a relational database.
Expected learning outcomes
Students will be able to
- design and implement programs in the Python language;
- design a database and implement it into a relational database
Single course

This course cannot be attended as a single course. Please check our list of single courses to find the ones available for enrolment.

Course syllabus and organization

Single session

Lesson period
First semester
Course syllabus
The Programming and Data Bases course is composed of two modules.
The Programming module aims at providing a comprehensive overview of computer science applied to real-world problem-solving. The course will introduce fundamental and intermediate programming techniques using the Python language. The goal of the course is to have the student be able to solve problems through program development, having acquired the basic knowledge (abstraction techniques, fundamental data types and control structures, subprograms, built-in data structures, bases of functional programming structures, object-oriented programming, and hints on recursion).
The Data Bases module aims at providing the conceptual and technical tools required to understand and design the specification of a database and to implement it into a relational database. More specifically, the first part of the module presents (i) the Relational data model, (ii) the notion of query (first as an algebraic abstraction that transforms data into data, then as an application of the SQL language in its full complexity), and (iii) integrity constraints as a means to ensure the correctness and quality of data from which originates the credibility of query results. The second part of the module focuses on the use of the Entity-Relationship model to schematize the conceptualization of a database, and on how this model can be translated into a relational schema, preserving all of its expressiveness.
Seminar lectures and interactive exercise sessions will focus on the topics detailed in the following.

PROGRAMMING:

Introduction
- Computer and information sciences
- Computer architectures and operating systems
- Basics of computer programming and algorithm design
- Boolean algebra and evaluation of predicates

Introduction to the Python programming language: structure and syntax
- Built-in data types
- Variables
- Basic operators
- Input handling
- Conditional execution
- Loops and iterations
- Strings and regular expressions
- Data structures (tuples, lists, sets, dictionaries)

Intermediate programming in Python
- Functions
- List comprehension / higher-order functions
- Recursion (basic hints)
- Files management
- Data visualization techniques

Introduction to object-oriented programming
- Concepts (abstraction and composition)
- Objects, classes and packages
- Attributes and methods (with constructors, getters, and setters)
- Inheritance
- Exceptions

DATABASES:

Introduction
- Data versus information. The notions of Information System, Database, and DBMS. Data types, constraints, and data integrity. Queries and applications: transactional and analytical systems. Users, roles, tools and modules of a DBMS.

Relational Theory
- The Relational Data Model: domains, relations, tuples (informal and formal definitions); null values and primary keys.
- Relational Algebra: basic and derived operators. Simple queries.
- Complex queries; query composability and equivalence.

SQL: Structured Query Language
- Definition of domains and tables; primary and foreign key constraints.
- Simple SQL queries (projection, selection, joins, sorting, aggregates).
- Complex queries (set operators, grouping, nesting, views).
- Modifications (of data and schema).
- Advanced schema specification: generic integrity constraints, reaction policies, triggers and procedures (hints).
- Physical data storage, indexing, and query execution cost (hints).

Conceptual and Logical Design
- The Entity-Relationship model: constructs, identifiers, hierarchies and their properties.
- Phases and abstractions in database design (life cycle, strategies, quality measures).
- Logical design: translation principles, hierarchy resolution, management of identifiers, attributes, and associations. Normalization and physical design (hints).

Other Data Models
- Ordered, nested, hierarchical data models. The case of XML.
- Queries and query languages for non-relational data.

Both modules give equal attention to conceptual and experimental aspects. The course includes final hands-on lab sessions where Python is used in combination with SQL to address biology-related data analysis tasks.
Prerequisites for admission
No prerequisites different from those required for admission to the Master Degree program.
Teaching methods
Class lectures, exercises, and occasionally group assignments to be solved during class using the students' laptops.
Teaching Resources
The slides presented during the course and many solved exercises are available on WeBeep, the portal for the network activities of students and professors at Politecnico di Milano.

Recommended textbooks
Database Systems - Concepts, Languages and Architectures
P. Atzeni, S. Ceri, S. Paraboschi and R. Torlone
McGraw Hill - 1999 - ISBN: 978-0072353877
(Freely available at http://dbbook.dia.uniroma3.it/ . Chapters 1-8, that cover most of the course content and present well established notions, are still perfectly valid)

Updated version (only available in Italian):
Basi di Dati (5a Edizione)
P. Atzeni, S. Ceri, P. Fraternali, S. Paraboschi and R. Torlone
McGraw Hill - 2018 - ISBN: 978-8838694455

Z.A. Shaw, Learn Python the hard way: A very simple introduction to the terrifyingly beautiful world of computers and code. (3rd Edition) (Zed Shaw's Hard Way Series) 3rd Edition
Assessment methods and Criteria
The assessment is based on a written exam at the end of the course, with exercises and open questions on all the topics presented in the course.
INF/01 - INFORMATICS - University credits: 2
ING-INF/05 - INFORMATION PROCESSING SYSTEMS - University credits: 10
Lectures: 96 hours
Professors: Bernasconi Anna, Braga Daniele Maria