4 ms·
> Aggregation, composition, encapsulation are as are much as fundamental notions in OOP as inheritance. You say that as if these things are not just as easily
by lomnakkus 9y ago
> Aggregation, composition, encapsulation are as are much as fundamental notions in OOP as inheritance.
You say that as if these things are not just as easily expressed in FP -- if not even easier.
Aggregation is just records-of-records.
Encapsulation is just "abstract data types", e.g. ML modules with abstract members, or non-exported data constructors in Haskell. Another option would be simply closing over whatever you're trying to hide. Another option would be existential types. (There's some overlap among all of these.)
Composition... well, actually I'm not sure what exactly you mean by "composition" in the context of OO. Can you explain what you mean?
- bushin 9y agoReminds me of PHP CEO's tweet: "If you had bad experiences with scrum you just did scrum wrong. If you had good experiences making software you just accidentally did scrum".
- soulbadguy 9y ago> You say that as if these things are not just as easily expressed in FP No, that's what you read. What i said what was i wrote... OOP is bigger than inheritance. > -- if not even easier. Again, this kind of statement really sound like empty FP propaganda to me. > Encapsulation is just "abstract data types", e.g. ML modules with abstract members, or non-exported data constructors in Haskell. Another option would be simply closing over whatever you're trying to hide. Another option would be existential types. (There's some overlap among all of these.) Or "abstract data types" is just Encapsulation...
- lomnakkus 9y ago> No, that's what you read. I think you may have misunderstood my intent. I was just trying to say "FP can do these things too". > Again, this kind of statement really sound like empty FP propaganda to me. Right, so any type of even very modest support for X is "empty X propaganda". Can we please assume at least a modicum of good faith here? > Or "abstract data types" is just Encapsulation... Oh, so "semantics" it is then. Oh, well. FWIW, I think I'm right in saying that ADTs were invented quite a bit before OOP & "Encapsulation". I notice that you also didn't answer my question of what Composition actually means in OOP. Do you have an answer? I promise, I wasn't being facetious.
- catnaroek 9y ago> ML modules with abstract members So true! Sadly, most programmers' idea of an “abstract data type” is a class. :-p
- lomnakkus 9y agoBooyakasha! :)
- seanmcdirmid 9y agoOOP is simply programming with objects. You can do that in a language of functions, you can also program with functions with a language of objects.
- lomnakkus 9y agoDefine "objects", please.
- seanmcdirmid 9y agoThat's easy, the word is well defined in the dictionary: a person or thing to which a specified action or feeling is directed. Some people try to call objects entities and claim they are doing something else, but they are just doing the same thing with different words.
- lomnakkus 9y agoUh, how does that relate to the semantics of the language? (Formally, not dictionarily.) EDIT: I was being a bit facetious, but we were discussing programming languages, so maybe not that much of a stretch...?