5 ms·
In theory this sounds great but in reality every major application, game, operating system and even website is written in an OOP style. Why is that? People shou
by sisu2019 8y ago
In theory this sounds great but in reality every major application, game, operating system and even website is written in an OOP style. Why is that? People should first answer that question.
Yeah, real existing software has flaws like every other thing in reality but at least it exists unlike a significant piece of fp style software. I like fp and I think it has a lot to teach but I think it's a bit presumptuous to advocate against a major paradigm that has actually proven itself with one that has failed to do so for decades.
And if OOP is so horrible why do so many people write OOP style PHP and javascript where they really don't have to?
Personally, I don't think OOP is bad per se, I just think the type systems of the main OOP languages are too limited and inflexible. Even so, you can accomplish amazing stuff in them. Just look at the Spring Framework and what it helps you do with so little code.
- Fellshard 8y agoA fair bit of that can be easily explained as cargo cult - a fair number of developers simply believe, because it's how they've been taught and what's been stated as fact over and over and over, that OOP is just 'how you write code'.
- discreteevent 8y agoOk but objects have been successful for a very long time. And this is in a field where there are more potential early adopters than most. Programmers like new stuff. I think they have been successful because in the end a lot of the world we deal with behaves like objects. Devices, processes, remote machines all accept messages and those messages have 'side effects' in that they change the future behaviour of that thing.
- Fellshard 8y agoMy current understanding (sure to change!) is this: Objects and messaging are best at the boundaries of system components. The internals end up being far simpler to state in functional terms, where the side effects can be pushed to the edges with far less inherent complexity. By assuming that objects are successful everywhere and always, it's really ignoring the regions where objects are more or less useful, painting over the picture with broad strokes. By learning multiple paradigms, you're learning broad principles that map well across all languages, as well as principles that are stronger or weaker in some paradigms than others. This enables you to be much more versatile when creating systems than devoting yourself to the 'One Way To Code' mentality.
- bklaasen 8y agoCredit where it's due; that sounds like Gary Bernhardt's "functional core, imperative shell": https://www.destroyallsoftware.com/screencasts/catalog/functional-core-imperative-shell https://www.destroyallsoftware.com/screencasts/catalog/funct... Previous HN discussion: https://news.ycombinator.com/item?id=18043058 https://news.ycombinator.com/item?id=18043058
- sisu2019 8y agois it really cargo cult if it works though?
- jpochtar 8y agohttp://paulgraham.com/avg.html http://paulgraham.com/avg.html
- mistrial9 8y agofun read -- the last sentence included ! plenty to say about that article.. I get the sense that many commenters here, YNews in 2019, very much fit the description of a "Blub" programmer.. with the added twist that it is -giant-cloud-thing- platform and/or exciting web trends are my thing, to deepen the "Blub" point of view.. .. can't help but chuckle at the repeated and fairly clever jabs at ASM, considering it took M$FT ten years to make a windowing GUI that performed well enough on a PC, after the Mac OS was written in a lot of ASM.
- sisu2019 8y agoBut Lisp's object system is kind of famous. Where are the people beating the averages in pure fp languages? There should be a lot of really amazing software if fp is as good as it's made out to be and employed exclusively by elite non-blub programmers. There really isn't though, except maybe in finance where F# is doing quite well. And that's great but even F# is multi paradigm.
- kazinator 8y agoMy home-grown accounting system, written in a language with great support for functional programming, is based on objects. accounts, transactions, transaction deltas, ledgers, are all objects. Starting from a blank slate, a file is loaded which defines the ledger entries. These definitions are processed one by one, using mutable updates to the object framework. What is left is then the state of the ledger with all those entries and that can be subject to various queries and reports.
- deleted 8y ago[deleted]
- braindouche 8y ago>In theory this sounds great but in reality every major application, game, operating system and even website is written in an OOP style. Why is that? People should first answer that question. Ok, try this on for size: OOP in general has one characteristic that makes it fantastic for large-team development, and that's extending over replacing. OOP makes it easy to never remove or change any existing code, and also "easy" to make changes or fixes by only adding more code. I wouldn't call it a good thing, but it does enable enormous numbers of people to all work on a codebase productively at the same time. I think this, more than anything else, is the power of OOP. > And if OOP is so horrible why do so many people write OOP style PHP and javascript where they really don't have to? Numbers. OOP supports big teams, so there are lots of OOP programmers in the wild. I genuinely think Javascript is sucking up to the Java developers of the world, and PHP is genuinely better for adopting OOP bits and pieces, but I'm not entirely sure why OOP devs and Java devs in particular seem to be immune to the industry mantra of "stay current and learn new things".