Search code examples
umlpuppetdeclarative-programming

how to model a declarative language


I am using puppet. And puppet is a declarative language and I need to model my code.

My question is what are the modeling languages for declarative programming languages?

In other words: we use uml to model imperative languages but uml is not suitable for declarative programming languages.


Solution

  • The Puppet DSL models a system state by itself. I don't see need for meta-modeling, but you could try and transform your manifest into a graphical representation.

    You'd need three types of nodes in your graph

    1. class
    2. defined type
    3. resource

    where the two latter ones are rather similar.

    There are two basic types of relation (edges)

    1. include a class
      • always directed at a class
      • originates in a class or defined type
    2. declare a resource (i.e., in the manifest, the resource appears in the body of a definition)
      • directed at a resource or defined type
      • originates in a class or defined type

    Virtual resources are just a variation on resources/defined types, and can be target for multiple realize edges (also originating from classes or defines) in addition to the declare edge.

    I may be missing some other detail, but for simple manifests, those should suffice.