norq
norq

Reputation: 1434

Is function block diagram functional programming?

Is function block diagram that is used for programming plc systems a form of functional programming?

Upvotes: 2

Views: 1044

Answers (2)

Tallak Tveide
Tallak Tveide

Reputation: 369

One way to approach this, is looking at the Wikipedia page for functional programming.

2 Concepts

2.1 First-class and higher-order functions
2.2 Pure functions
2.3 Recursion
2.4 Strict versus non-strict evaluation
2.5 Type systems

To sum up, for FBD programming, we have:

  • 2.1 - Nope
  • 2.2 - Nope (access to global memory in DB, Q and M areas)
  • 2.3 - Disallowed
  • 2.4 - Sort of not applicable, but lazy evaluation is out of the question
  • 2.5 - No. The type system is not user definable, at least not in the FP sense

So, that's a big no I'm afraid

Upvotes: 3

Niclas
Niclas

Reputation: 1230

No, it is not. What puts functional programming apart is that it treats computation as the evaluation of mathematical functions (see Wikipedia). The function blocks in PLC programming is simply a convenient way to group and reuse code in a manner that enables even "non-programmers" to use it.

Upvotes: 1

Related Questions