4 ms·
> Is this your whole point? That your definition of OOP, FP and design is different from my definition but you understand what I'm talking about? Or is there an
by zodiac 7y ago
> Is this your whole point? That your definition of OOP, FP and design is different from my definition but you understand what I'm talking about? Or is there another point you're trying to make?
Let C1 be the following claim: "function composition is better behaved than object composition and procedure composition".
Let C2 be the following claim: "the most important part of FP is function composition".
I'm saying that you've provided arguments for C1 (that I mostly agree with). So let's say that I agree with C1. However, you haven't shown why C1 => C2, and I disagree with C2.
So to answer your question, I understand your rationale for C1 (and I agree with it), but I don't understand your rationale for C2, or for why C1 => C2.
- crimsonalucard 7y ago>Let C1 be the following claim: "function composition is better behaved than object composition and procedure composition". >Let C2 be the following claim: "the most important part of FP is function composition". C9 = functional programming is better designed than OOP and procedural programming. I claim C1 to be true (you agree.) I claim C2 to be true. I claim C9 to be true. I do not claim C1 => C2 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Reasoning for C2: C3 = The primary task of High level programming languages is to simplify assembly instructions. C4 = The simplification of assembly instructions is done through Composition. C5 = Different High level programming languages/paradigms simplify assembly primitives in different ways. C6 = High level programming languages/paradigms are, in essence just different ways of composing assembly primitives. (C3, C4, C5) => C6 C7 = If programming languages are all just different ways of composing assembly primitives than how they compose assembly primitives is the most important part of the language and the main differentiator between one high level language and another high level language. C8 = function composition is the primary form of composition for functional programming. (C6, C7, C8) => C2 --------------------------------------- In short: - High level programming languages/paradigms are, in essence just different ways of composing assembly primitives. - If programming languages are all just different ways of composing assembly primitives than how they compose assembly primitives is the most important part of the language and the main differentiator between one high level language and another high level language. - function composition is the primary form of composition for functional programming. Therefore: the most important part of FP is function composition. ------------------------------------------- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Reasoning for C9: C8 = "A Design for a programming language" is just another phrase for "a method of composition for a programming language". (C1, C8) => C9 ----------------------------------------------- In short: - function composition is better behaved than object composition and procedure composition - "A Design for a programming language" is just another word for "a method of composition for a programming language" Therefore: functional programming is better designed than OOP and procedural programming. ------------------------------------------------ I like this format, thanks for introducing it. I think it allows us to clearly see which axioms we disagree with and need to think about.
- zodiac 7y agoI guess the claim I disagree with is C8: C8 = function composition is the primary form of composition for functional programming. Most people consider Haskell to be a language that heavily encourages a "functional programming" style. If you take a look at idiomatic Haskell code, yes, you see a lot of function composition. But I think you also see a lot of composition that are distinct from "simple" function composition: - Parametric polymorphism - 'Monadic' composition (i.e. `>=>`) - Applying higher-order functions
- crimsonalucard 7y ago- Parametric Polymorphism is a way to define types or functions that are generic over other types. There is no composition going on here. So I disagree with you here. - You bring up a good point about monadic composition and other forms of more advanced function composition. Although I don't explicitly mention these types of compositions my words encompass these forms of compositions as well. Additionally, technically the >=> is still "function composition" and "point free programming" as the operands and resulting composition are all still functions getting composed. - Applying higher order functions? Do you mean function factories that take a function and return a new function? So like C = A(B) where A, B, C are all functions and C is the "composition" of A and B? The above shares an isomorphism with dependency injection. If A B and C were objects the syntax is exactly the same. So I mention this in my second link as one of the caveats of OOP. This type of composition is equivalent to dependency injection or object composition. "A" cannot exist on it's own without "B." This is a bad form of composition. as "A" is dependent on "B". If you do too much of this in your programs, then, like doing an excessive amount of dependency injection or object composition in OOP, your program will lose flexibility as it becomes a network of dependent primitives. Qualitatively, it also makes your code look like a giant mess if you do this everywhere. That is why the above form of composition is not primary. If used at all it is only used sparingly and usually only on well known higher order functions like map, reduce or compose. Caveat: It does get blurry here as the composition operator is in itself a function that takes in functions and produces a new function. This is where the isomorphisms between OOP, FP and procedural programming I talk about in the comments on that Quora post begins to meld the paradigms together.