5 ms·
I agree. JS is beautiful in the parts where it encourages functional, not object, programming. That link puts it nicely: "You're working in the phony version of
by hughw 11y ago
I agree. JS is beautiful in the parts where it encourages functional, not object, programming. That link puts it nicely: "You're working in the phony version of JavaScript that only exists to dress the language up like Java." In the Mozilla article, I can hardly believe I'm reading discredited perennials like "OOP promotes greater flexibility and maintainability in programming ... Because OOP strongly emphasizes modularity, object-oriented code is simpler to develop and easier to understand later on." That was the promise, in 1985. The reality is, OOP has created a snarl of programs where mutable state is the defining characteristic, justified by a consulting industry that is more promotion than real, grounded theory. They live on.
- uname-s 11y agoThe promise in 1985 was Smalltalk; the reality was Java. Your argument rests on an industry bait-and-switch.
- Sanddancer 11y agoNo, the reality is not just Java. It's Ruby, C#, Objective-C, Python, etc. Other languages have made object systems that aren't as ugly as Java's
- oldmanjay 11y agoYou're vastly overstating what you consider the "reality" of object oriented programming. Systems designed to be OO from the beginning are clearly massively successful at producing incredibly complicated software. The paradigm has not been discredited despite your assertion or your personal idea of beauty.
- Jweb_Guru 11y agoSo have procedural and functional systems. What is your point? There's no practical evidence that those projects were successful because of OOP, and there's no theoretical basis for believing it either. In the meantime, object-oriented programming languages require one to make some pretty uncomfortable tradeoffs (for example, it makes type inference undecidable and practically requires virtual dispatch), so even if they are just a noop, we should still avoid it whenever possible.
- oldmanjay 11y agoMy point, which I felt i made clearly, is that the OP overstated the discrediting of object oriented programming. I'm not sure what you are replying to, but not a single sentence in your post addresses that at all, so I'm not going to bother to address any of your points. They are all tangential.
- Jweb_Guru 11y agoThen your assertion was also tangential, as whether or not people have been successful at producing complicated software with OOP has very little to do with whether or not it has been discredited. People have been very successful at producing complex software that uses goto, but goto has been discredited. This is not because people thought that goto made it impossible to produce complex software, but because people thought that goto did not promote local reasoning well, which is similar to my objections to OOP. Either way, my point was that there are many other paradigms that have been equally successful; that suggests that we should be looking at its other objective downsides in determining whether or not to add it to a programming language, rather than simply assume that it should be there.
- hughw 11y agoNice try, Grady. (edit... y'all, please let me have a little joke)
- hughw 11y agoNope, I knew there'd be a regular humorless hn down voting dickhead. Oh right, I'm not supposed to mention that, or I'll get more dread down votes lol.
- Kiro 11y agoHow about games? I feel OOP makes the most sense when coding games. You want mutable objects (for example enemies) behaving the same.
- chipsy 11y agoIt's awful in games too, although the grain of OO languages makes it a little more compelling at first. OO encourages slicing up code into black boxes, and it just doesn't work. What a game needs is a database view of the world - not a strict formalized model like SQL, but a customized, mixed-paradigm mode of keeping a ton of global state organized. Game actors are not truly independent, they're a view on various fragments of data allocated semi-independently and late bound into some association. They're all part of one world.
- hughw 11y agoYou're exactly right. The problem with OO is that you are really making state changes in what you should think of as an in-memory database, but the languages offer you no support for doing so logically. A logical language, or as you suggest, a mixed-paradigm language, could give you some logical assistance in enforcing consistent state transitions. In OO languages, you have to enforce all the logical constraints yourself, in code. And you get so used to it, you begin to think that's the way it's done, and you embed the knowledge in your Patterns book.