2

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.

rene
  • 41,474
  • 78
  • 114
  • 152
  • Why do you think that UML is not suitable for declarative programming languages? Notice that UML class diagrams and UML state machines can be viewed as declarative visual programming languages. – Gerd Wagner Jun 19 '14 at 13:00

1 Answers1

1

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.

Felix Frank
  • 8,125
  • 1
  • 23
  • 30
  • Thanks a lot. This is the best theoretical answer i got in days. – user3738655 Jun 14 '14 at 18:24
  • 1
    @user3738655 you can experiment with various forms of the "drawing" using the free [yWorks yED](http://www.yworks.com/en/products_yed_about.html). Supports import from xml-based data format so you can generate you drawings automatically. You can annotate shapes with your own information. I have used this tool successfully to visualize various "declarative" or "runtime-only" dependencies. Automatic layout algorithms included – xmojmr Jun 15 '14 at 05:35