81784 - Computer Programming in Physics (M-Z)

Academic Year 2025/2026

  • Moduli: Carlo Battilana (Modulo 1) Carlo Battilana (Modulo 2)
  • Teaching Mode: Traditional lectures (Modulo 1) Traditional lectures (Modulo 2)
  • Campus: Bologna
  • Corso: First cycle degree programme (L) in Physics (cod. 6639)

Learning outcomes

This course would give students a knowledge of the C++ programming language sufficient to face and solve simple problems in Physics through computer programs. In particular the student would become able to perform any operation of data reading and writing, both in text and binary formats, and to use them according to the needs involved in carrying on physical experiments.

Course contents

Elements of computer architecture and operating systems

Machine languages and high-level programming languages

Why C++

Objects, types, variables, literals

Manipulating objects through expressions

Structuring a program through statements

Definition and use of functions

Definition of new types

Input/output system

Generic programming

Dynamic memory allocation

The C++ Standard Library: containers and algorithms

Dynamic polymorphism (a.k.a. object-oriented programming)

Preventing and managing errors

Elements of software engineering and supporting tools

Readings/Bibliography

Suggested textbook: B. Stroustrup, Programming: Principles and Practice Using C++, 3rd edition, Addison-Wesley

Alternatively, even if not up-to-date with the latest standards of the language: B. Stroustrup, The C++ Programming Language, 4th edition, Addison-Wesley

As reference: C++ reference

Additional online resources will be communicated during the lectures.

Teaching methods

Lectures (in Italian) and (mandatory) training in laboratory.

Participation in laboratory activities is contingent upon the prior completion of Safety Training Modules 1 and 2, which are mandatory for all students and available in e-learning format.

Assessment methods

The exam is in two parts:

  1. A project concerning the development of a C++ program following the instructions given during the lessons. The project is developed in part during the laboratory sessions, in part autonomously
  2. An oral exam including a discussion about the project and questions about theory and practice of programming in C++ based on what presented during the lectures.

An evaluation of "sufficient" for the project is needed to access the oral exam.

More details will be made available during the course.

Adaptations are foreseen for students with special needs.

Teaching tools

All the material used during the lectures and the labs are available in Git repositories under a GitHub organization.

Links to further information

https://github.com/Programmazione-per-la-Fisica

Office hours

See the website of Carlo Battilana

SDGs

Quality education Industry, innovation and infrastructure Responsible consumption and production

This teaching activity contributes to the achievement of the Sustainable Development Goals of the UN 2030 Agenda.