Programming Styles

Programming Styles

“Programming Styles” is the name of a course offered at USI in the Master of Software and Data Engineering. The course is a journey through the landscape of programming languages and idioms, to let students experience dramatically different programming styles. A style arises from a set of constraints one imposes on the code. Styles are independent of a given programming language.

The course is inspired by the book “Exercises in Programming Styles” by Cristina Videira Lopes.

Labs: Multiple Styles in Multiple Programming Languages

The book features a simple programming task, which is solved using different styles in Python. The labs of this course come in pairs: each style is implemented first in a dynamically-typed language (JavaScript) and then in a statically-typed language (Java).

Styles are selected to illustrate powerful ideas in programming:

  • Pipeline: pure functions, function composition
  • Kick Forward: continuation-passing style
  • The One: identity monad
  • Quarantine: I/O monad

All the labs are publicly available:

Lab   Style / Programming Language
1 Pipeline style in JavaScript
2 Pipeline style in Java
3 Kick Forward style in JavaScript
4 Kick Forward style in Java
5 The One style in JavaScript
6 The One style in Java
7 Quarantine style in JavaScript
8 Quarantine style in Java


History and Contributors

The labs are developed in a collaborative effort at the LuCE research lab at USI. The original version was written by Matthias Hauswirth. Between 2020 and 2022, the labs were improved by Igor Moreno Santos. In 2023 and 2024, the labs have been rewritten by Luca Chiodini to clarify the constraints of each style and provide better guidance.