Timeline for What are the advantages of a 'pure' object oriented language over a non-pure object oriented language?
Current License: CC BY-SA 4.0
35 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Nov 20, 2019 at 12:06 | comment | added | Doc Brown | I put this discussion to chat. | |
| Nov 20, 2019 at 10:19 | comment | added | Filip Milovanović | So the answer to "what are the advantages of a 'pure' object oriented language" depends heavily on what 'pure' actually means, and that is a whole different problem. Furthermore, as pointed out in this answer "Sadly this means that even 'pure' OOP languages aren't forcing you to use the best features of OO", but it's even worse than that - OO design is a skill, and no amount of language features/restrictions can make up for it. Also, I know comments are not for extended discussion, but here we are :) 2/2 | |
| Nov 20, 2019 at 10:18 | comment | added | Filip Milovanović | @DocBrown: you are right to point out that we should not forget the original question, but your discussion with candied_orange came down to (1) what is OOP in its core, and (2) how that fits into the notions of an "OO language" and a "pure OO language". Assuming (hypothetically) that we can agree on (1), then an OOP lang is anything that offers in-built mechanisms for some form of (1). As for "pure" - the notion is ill-defined, and flawed in the sense that "pure" suggests something good in itself, when it's in fact just a design restriction, and its utility depends on other factors. 1/2 | |
| Nov 20, 2019 at 9:45 | comment | added | Doc Brown | ... and it is probably of less importance for an "OO language" or "pure OO language" what mechanism is "abstracted away" in its implementation of polymorphism. Let us not forget the original question was "what is the point of a pure OO language over a multi-paradigm language", so if you know a "pure OO language" developed out of the Scheme or Lisp family of languages, and can tell us some benefits or disadvantages over classic Scheme or Lisp, feel free to post an answer and tell us your experience with that. | |
| Nov 20, 2019 at 9:37 | comment | added | Doc Brown | @FilipMilovanović: I guess one should not take Uncle Bob's blog post about function pointers too literal. He was obviously oversimplifying to make a point in the context of that blog post, and I am pretty sure he is aware of the SICP approach to OO (as well as other approaches). Note also there are several object-oriented successors of Scheme following the CLOS approach which surely deserve the attribute "OO language" ... | |
| Nov 19, 2019 at 22:41 | comment | added | Filip Milovanović | @DocBrown: I didn't say it's a pure OO (or an OO) lang. - I don't care about that, nor did I mean to say anything about Scheme specifically. It was a remark on what OOP itself is (in a more fundamental way then "imposed discipline on function pointers"); getting the inbuilt language mechanisms designed to support OOP out of the picture helps with that insight. The interesting thing about that chapter is that they discuss 3 ways to represent abstractions, irrespective of language: "intelligent operations" (ADTs) vs "intelligent data objects" (OOP) vs what they call "data-directed programming". | |
| Nov 19, 2019 at 20:11 | comment | added | Doc Brown | @candied_orange: AFAIK older versions of Java did not provide any means of lambda expressions or C#-like delegates. So if one wanted a "function pointer", one had to use objects & polymorphism, there was not other mechanism (except reflection, but I guess that does not count). If that's what you think is what makes "pure OO", then older Java versions were indeed "nearer to pure OO". | |
| Nov 19, 2019 at 20:02 | comment | added | Doc Brown | @FilipMilovanović: -The fact one can emulate OO in Scheme in an elegant manner does not hide that Scheme is not a pure OO language - it is actually not even an OO language ;-) | |
| Nov 19, 2019 at 17:38 | comment | added | Filip Milovanović | P.P.S. Note that with this message as a token idea, you have polymorphism even without any form of inheritance and delegation (essentially, it's like duck typing), because client code is written in terms of those messages. | |
| Nov 19, 2019 at 17:33 | comment | added | Filip Milovanović | In some scenarios, though, the ability to control how the instances are stored is important, which is why the game industry came up with ECS, it seems. P.S. See the Message passing section (scroll to the bottom of the page) in Structure and Interpretation of Computer Programs - it's Lisp, but, if you can't read it, the text explains it pretty well. | |
| Nov 19, 2019 at 17:33 | comment | added | Filip Milovanović | @DocBrown & candied_orange: The way I see modern OOP languages is: originally, you had the concept of a "message" as an abstraction of a direct function call, the message being a token that has a well defined meaning as an operation, but that's interpreted as a concrete function by the target object. Then strongly typed languages took that idea and imposed structure in the form of inheritance, codified the form of the message token, and took over control of the dispatch mechanism and instance data storage - which is fine in most scenarios. | |
| Nov 19, 2019 at 17:31 | comment | added | candied_orange | @DocBrown right, but is that an actual requirement of 'pure' OO languages? Not asking if it should be. Asking if the acknowledged 'pure' OO languages actually do prevent you from using any other form of function pointer. Because if so then I missed an enforced feature. | |
| Nov 19, 2019 at 17:04 | comment | added | Doc Brown | @candied_orange: you meant this blog post, I guess? As I understand it, this is just a fancy way of saying "an OO language needs to abstract function pointers away by providing means for polymorphism" - and that is pretty much what you mentioned in your answer as "OOPs biggest feature". | |
| Nov 19, 2019 at 16:51 | comment | added | candied_orange | @DocBrown one thing I've been trying to figure out how to work in is Uncle Bob once defined OOPs defining feature to be "being formal about function pointers" (which I can appreciate after seeing their syntax in c, yuck) but I've never seen anyone list that as a requirement for a 'pure' OO language. | |
| Nov 19, 2019 at 16:43 | comment | added | Doc Brown | Sure (+1), but I guess it makes sense when I don't delete my former comments this time. | |
| Nov 19, 2019 at 16:38 | comment | added | candied_orange | @DocBrown better? | |
| Nov 19, 2019 at 16:38 | history | edited | candied_orange | CC BY-SA 4.0 | added 10 characters in body |
| Nov 19, 2019 at 16:32 | history | edited | candied_orange | CC BY-SA 4.0 | added 10 characters in body |
| Nov 19, 2019 at 14:50 | comment | added | Doc Brown | @candied_orange: call me nitty, but I think your answer would improve heavily when you change the first sentence to something like "... that you (ideally) don't have to keep reminding ...". Let me add, I don't see it as a problem that just providing a "perfect programming language" (whatever this could be) does not make everyone a perfect programmer. | |
| Nov 19, 2019 at 11:57 | comment | added | T. Sar | @DocBrown Hm... Yeah, I think I can see what you mean, now. You have a good point. | |
| Nov 19, 2019 at 11:56 | comment | added | candied_orange | @DocBrown my answers point is that even under the definition, and best examples of, pure OO languages this is all you get. You're saying that not what it should be. I agree with you. But this is what it is. We simply don't have that. Pure OO isn't nearly as cool as pure structural. The "purity" of OO languages is a pale imitation. Thus we have to instill OO in the programmer. Like I said, this situation is not satisfying. | |
| Nov 19, 2019 at 11:48 | comment | added | Doc Brown | @T.Sar-ReinstateMonica: my point was not what experienced people can do in theory, but what unexperienced people actually do in reality. Let me phrase it this way: even if a programming language follows an "OO paradigm", this does not make it really hard for users of that language (especially beginner users) to write non-OO programs. This answer gives me the impression of telling readers a different story. | |
| Nov 19, 2019 at 11:03 | comment | added | T. Sar | @DocBrown That happens because in the end all languages are just abstractions of other languages. A very determined person can cook up a VM on minecraft, even. With enough boilerplate, we can write anything, anywhere. | |
| Nov 19, 2019 at 9:12 | comment | added | candied_orange | @DocBrown I can't disagree with your criticism. But I feel the flaw lies with the very concept of 'pure OO language'. Point me to one single 'pure' OO language that will keep a determined programmer from coding procedurally. I'll adopt it today. | |
| Nov 19, 2019 at 9:08 | comment | added | Doc Brown | The logic of this answer is IMHO flawed, or at least a little bit naive. Developers with no OO training (or simply beginners) find a lot of ways to write procedural code in Java, and that has nothing to do with the availability of primitives. You could forbid usage of primitives, but that would not make such code more OO. Or, citing Dijkstra, you can write FORTRAN in any language | |
| Nov 19, 2019 at 9:07 | history | edited | candied_orange | CC BY-SA 4.0 | verb agreement |
| Nov 19, 2019 at 7:50 | comment | added | candied_orange | @J.AntonioPerez If it was structured programming wouldn't exist. All you're offering is a different paradigm that would also keep goto's spaghetti code at bay. | |
| Nov 19, 2019 at 7:47 | comment | added | Alecto | My point though is that because everything ends up as machine language, recursion with tail call optimization is a perfect replacement for the use of goto. | |
| Nov 19, 2019 at 7:45 | comment | added | candied_orange | @J.AntonioPerez we're talking about what makes a language 'pure'. Everything ends up as machine language anyway so it's pointless to argue that an impure language exists. The purity is just for us humans. Computers don't care. | |
| Nov 19, 2019 at 7:42 | comment | added | Alecto | Even C++ has tail call optimization as a feature implemented by all major compilers, and C++ is about as far from pure as you can get | |
| Nov 19, 2019 at 7:41 | comment | added | candied_orange | @J.AntonioPerez that would work. But now you've simply created another 'pure' language. Instead of structured programming it's tail call programming. | |
| Nov 19, 2019 at 7:38 | comment | added | Alecto | Just use a compiler that has tail call optimization. With tail call optimization, recursive function calls can automatically be transformed into jumps, allowing infinite recursion | |
| Nov 19, 2019 at 6:32 | comment | added | candied_orange | @RobertHarvey Well no, recursion is only a perfect replacement for goto if you have infinite memory. My bus isn't that wide and my wallet isn't that deep. | |
| Nov 19, 2019 at 6:27 | comment | added | Robert Harvey | None of which you need if you have goto -- You don't need goto either. You just need recursion and branching. | |
| Nov 19, 2019 at 5:53 | history | answered | candied_orange | CC BY-SA 4.0 |