EuroPython 2018

Declarative Thinking and Programming

Speaker(s) Florian Wilhelm

Declarative Programming is a programming paradigm that focuses on describing what should be computed in a problem domain without describing how it should be done. The talk starts by explaining differences between a declarative and imperative approach with the help of examples from everyday life. Having established a clear notion of declarative programming as well as pointed out some advantages, we transfer these concepts to programming in general. For example, the usage of control flow statements like loops over-determine the order of computation which impedes scalable execution as well as it often violates the single level of abstraction principle.

Following the theoretical part of the talk, some practical examples are given how declarative programming can be applied easily within Python. This comprises the advantages and disadvantages of using a configuration file, e.g. config.yaml, versus a Python configuration module, e.g. Furthermore, the benefits of avoiding statements of control flow with the help of list and dictionary comprehensions as well as sets are demonstrated.

The talk is concluded by a short, high-level excursion to a logistic programming language, namely PyDatalog in order to build the bridge between logistic and declarative programming. This is accomplished by showing how a mathematical crossword can be easily solved with the help of declarative and logistic programming.

Do you have some questions on this talk?

New comment