4 ms·
> You did not explain how this is dangerous whatsoever. What about all those companies or teams out there using exclusively functional programming and succeedin
by undecisive 6y ago
> You did not explain how this is dangerous whatsoever. What about all those companies or teams out there using exclusively functional programming and succeeding? Their own experience would be evidence that avoiding OOP is good (as it has been good, demonstrably, for them). If they merely spoke from their own experience and attested to the good things that demonstrably came from avoiding OOP, you would consider that dangerous?
I can't tell whether you're intentionally building a straw-man here. My original example of a downvotable comment had three statements:
"object orientation is dangerous": It clearly isn't. Badly written object oriented software can be dangerous, and you can argue that OO languages could do more to promote safety within themselves, but that doesn't make OO as a theoretical construct a bad thing, or all OO code bad, or all OO developers wrong.
"you must write C++ using functional paradigms": Again, there are separate challenges when writing fully FP-style C++, certainly there is nothing to say you MUST write C++ that way. And many projects would probably not welcome you rewriting their codebase in that way. If someone goes back to their employer / open-source project / teachers and tells them they are doing it wrong because their code contains OO, they may well be laughed out of the door.
"it's the only way to make good programs": This is obviously a lie.
Then, look at the context - I said "answers that are dangerous, vulnerable, misleading, or represent an extreme viewpoint as fact (...)" - I intended the above three statements to be an example of the latter, I figured that people can easily imagine dangerous / vulnerable / misleading SO posts themselves. But yes, while I do consider there to be dangerous effects from stating a subjective viewpoint as an absolute like this, I do think that the above statements take a reasonable yet subjective statement like "Few pieces of advice have served me as well as [avoid OOP]" into a totally unreasonable objective statement "it's the only way to make good programs"
Also, take a look at my later statement "Everything is a balance of strengths and weaknesses, and there are times when OO is the right tool for the job." I thought it would be relatively clear from this that there must always be times where OO is not the right tool for the job. My original statement was not an attempt to bad-mouth FP. But telling beginners to never use X because it's evil for whatever reason does have its dangers, whether that paradigm is FP or OOP.
> any use case solvable by OOP is also solvable with at least equal quality and equal satisfaction of the constraints using functional programming.
I suspect games programmers and kernel devs might disagree with that. But even if not, I would say that the bar you have set is terribly low. To my mind, a good program should also be readable, expressive, and in keeping with the project's coding standards. Generally, that's where I find that even some well-written FP code may fall down. But again, that's not an argument against FP itself, because I would not argue against FP. As I said before...
> A comment like "I would prefer to see this in a functional paradigm, with as few side effects as possible" is absolutely fine.
In fact, I would go as far as to say I might even agree with that statement. I certainly wouldn't downvote it. Sure, I'd like to see better arguments about why the side effects in that case are a problem, and why FP might be able to improve the code. But that is a perfectly valid and true statement. But hopefully now you can see why that statement is materially different to "object orientation is dangerous, you must write C++ using functional paradigms, it's the only way to make good programs".
- mlthoughts2018 6y agoNope, you are completely trying to misrepresent what your original post said. You said that you downvote other ideas because they (the ideas) are “dangerous”, here is your quote: > “ I mean answers that are dangerous, vulnerable, misleading, or represent an extreme viewpoint as fact ("buhh object orientation is dangerous, you must write C++ using functional paradigms, it's the only way to make good programs")” So you are claiming that an idea expressing “OOP is dangerous” is itself dangerous as an idea and that this danger is what merits your downvote. Yet you’ve done nothing to explain such an extreme and unreasonable point of view.
- undecisive 6y agoEither I'm completely misunderstanding you, or you are not reading my words. Specifically you've just replied to this whole paragraph that addresses what you are saying completely: > Then, look at the context - I said "answers that are dangerous, vulnerable, misleading, or represent an extreme viewpoint as fact (...)" - I intended the above three statements to be an example of the latter, I figured that people can easily imagine dangerous / vulnerable / misleading SO posts themselves. But yes, while I do consider there to be dangerous effects from stating a subjective viewpoint as an absolute like this, I do think that the above statements take a reasonable yet subjective statement like "Few pieces of advice have served me as well as [avoid OOP]" into a totally unreasonable objective statement "it's the only way to make good programs" Please quote me the bit where I say that I "downvote other ideas because they (the ideas) are dangerous” - I said very clearly that I downvote answers that are dangerous. An answer is a concrete expression of an idea, but an idea can be correct without the answer being correct. (an extreme example: "We should improve the overall health of our nation" might be a completely valid idea, yet "shoot the disabled" is a completely wrong answer that embodies that idea but takes it in absolutely the wrong direction.) > Yet you’ve done nothing to explain such an extreme and unreasonable point of view. Alright, let's flip it: "Functional Programming is dangerous". I can use FP to write a program that accidentally wipes a hard disk. Therefore FP is dangerous. Argue against that. Functional Programming, when used correctly, mitigates some of the dangers of Object Orientation. Arguably, a correctly written Object Oriented module should not be any less safe than a module correctly written in a Functional style. You can argue (and probably do) that the implementations of Functional Programming that you enjoy using make writing correct code easier. And that is a valid statement. But saying "OOP is dangerous" is no more valid than saying "FP is dangerous". Saying "Haddock are slimy and disgusting which is why I prefer Cod". No, fish are slimy and disgusting, and these are both fish. Maybe there are degrees by which some fish are slimier than others, but that doesn't justify an out-of-context vilification of Haddock. So let me tell you some things that are more dangerous to your code and project than OO: - Using a language or paradigm that your team are not familiar with - Using tools that force you to distance your variable and method names from the domain-specific words that the specification is written in - Premature optimisation - Following every new framework and fad that comes along. So yes, it is extreme and unreasonable to categorically state that "OOP is dangerous". As an answer, it deserves to be downvoted. As an idea, it has merit and deserves to be explored and justified and compared. In a place of ideas (like Hacker News) that statement is perfectly acceptable (if not entirely helpful) In a place of answers (like Stack Overflow), it is misleading and dangerous in that it encourages far more dangerous behaviours.