General statistics
List of Youtube channels
Youtube commenter search
Distinguished comments
About
xybersurfer
Continuous Delivery
comments
Comments by "xybersurfer" (@xybersurfer) on "Declarative vs Imperative in Functional Programming" video.
My feeling is that your tests are a form of declarative "programming", especially when they test the full specifications. The problem i see with the functional example is that there are lots of nested brackets when written in that style. Usually there is some kind of "|>" pipeline operator in functional languages, that passes the result from one lambda onto the next, to prevent some of this: def declarative_words(dictionary) dictionary |> filter (lambda word: 5 == len(word)) |> list |> return Now you can see the steps more clearly. You could argue that the requirement for an order makes this imperative. You could also argue that specifications require you to specify an order in some parts. But calling specifications imperative seems strange (they are declarative). The line is very blurry, but maybe it's because i'm considering some expressions as imperative as opposed to only statements
2