Behavioral programming with Petri Nets

Click for: original source

Fabrizio Romano Genovese wrote article about behavioural programming and how to use Petri nets to design software. A Petri net, also known as a place/transition (PT) net, is one of several mathematical modeling languages for the description of distributed systems.

In behavioral programming, as the name suggests, you must think in terms of which properties (behavior) you want your software to have.

In this sense, programming becomes goal-oriented, and starts with a high-level sketch of the software structure. In our context, this means that we will start sketching the code structure, we will test for its behavior and then we will refine it so that it meets our goals.

The article then explains very simple and understandable problem: you have four philosophers at a table which can either think or eat. The catch is that they have to share cutlery, and coordinate between them about this.

Read the article to learn how they model it! There are also links to further resources and video explaining modeling of the problem using Petri nets. Nice read!

[Read More]

Tags programming miscellaneous