1

Is there a general term for the software paradigm/principle where there is a clear separation between Data, State and Logic (Data - 'information' only, immutable with value semantics, State - 'storage' of Data only with clearly defined access/mutation mechanisms, Logic - pure stateless functionality that can mutate the States) ?

This is as opposed to OOP where Data State and Logic are coupled in a 'class'

I see this separation referred to in many places (especially in clojure) but I couldn't find a single name/term for it .. sometime 'functional' is used but there are ie many functional languages (ie Javascript) without such separation ?

(I am not sure if any other Tags are relevant here)

2
  • JavaScript is not generally considered a functional language. Jul 13, 2020 at 6:24
  • so are you saying functional is a good term here ?
    – kofifus
    Jul 13, 2020 at 6:36

1 Answer 1

1

They aren't different things.

Consider a pure functional language. Everything is a function, and I do mean everything. Its called Lambda Calculus and it is Turing Complete.

In this language: values, state, and behaviour are all just functions.

Even in JavaScript the concept is loose. The object is really just the stack frame of a function that decided to return its stack frame. And that is true of everything except a handful of primitives. (Implementations of course will do what they do, we are considering at the language level.)

Consider a String

  • It is a value (a single state)
  • It is a modifiable state, allowing characters to be edited (depending on language, but even with immutable states, it still appears to permit editing which is all we care about from a first hand usage perspective, as variables can be shared.)
  • It is a behaviour - a mini program for how to draw glyphs on a screen.

So which one is it?

Terminology

In a layman perspective. You are probably looking for

  • a functional/logic language for value/behaviour split
  • a imperative language for state/behaviour split

But that is only a surface level understanding.

3
  • I don't understand your String example - String in ie C# is a value (data), it does not appear to permit editing and does not know how to show itself on the screen and is not a State in the sense I referred to in my question .. State here is not a great term maybe 'Store' is better. But to the point - so there is no common term for a paradigm where the emphasis is on separating those three ?
    – kofifus
    Jul 14, 2020 at 2:15
  • A String does not need to know how to draw itself. Another thing such as a label takes a string as instructions on what to draw. String the value does not need to be mutable, but String the argument does not have one value, else wise it could be omitted as an argument. So what is a String? Is it code (as seen by a label component), Is it a value (as seen by the compiler), or is it Stateful (as seen by the function on an argument it has been given)?
    – Kain0_0
    Jul 14, 2020 at 3:22
  • 1
    As for the Terminology i don't believe it exists. You could try the question on a Computer Science/Computer Language forum like Lambda the Ultimate?
    – Kain0_0
    Jul 14, 2020 at 3:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.