Is there a visual modeling language or style for the functional programming paradigm?

后端 未结 11 946
离开以前
离开以前 2020-12-12 12:50

UML is a standard aimed at the modeling of software which will be written in OO languages, and goes hand in hand with Java. Still, could it possibly be used to model softwar

相关标签:
11条回答
  • 2020-12-12 13:09

    Yes, Haskell.

    I get the impression that programmers using functional languages don't feel the need to simplify their language of choice away when thinking about their design, which is one (rather glib) way of viewing what UML does for you.

    0 讨论(0)
  • 2020-12-12 13:11

    In Haskell, you model by types.

    Just begin with writing your function-, class- and data signatures without any implementation and try to make the types fit. Next step is QuickCheck.

    E.g. to model a sort:

    class Ord a where
        compare :: a -> a -> Ordering
    
    sort :: Ord a => [a] -> [a]
    sort = undefined
    

    then tests

    prop_preservesLength l = (length l) == (length $ sort l)
    ...
    

    and finally the implementation ...

    0 讨论(0)
  • 2020-12-12 13:12

    You can a data flow process network model as described in Realtime Signal Processing: Dataflow, Visual, and Functional Programming by Hideki John Reekie

    For example for code like (Haskell):

    fact n | n == 0    = 1
           | otherwise = n * fact (n - 1)
    

    The visual representation would be:

    0 讨论(0)
  • 2020-12-12 13:13

    I use USL - Universal Systems Language. I'm learning Erlang and I think it's a perfect fit.

    Too bad the documentation is very limited and nobody uses it. More information here.

    0 讨论(0)
  • 2020-12-12 13:15

    We use theorem provers to do formal modelling (with verification), such as Isabelle or Coq. Sometimes we use domain specific languages (e.g. Cryptol) to do the high level design, before deriving the "low level" Haskell implementation.

    Often we just use Haskell as the modelling language, and derive the actual implementation via rewriting.

    QuickCheck properties also play a part in the design document, along with type and module decompositions.

    0 讨论(0)
  • 2020-12-12 13:17

    I believe the modeling language for Haskell is called "math". It's often taught in schools.

    0 讨论(0)
提交回复
热议问题