3 ms·
1. What you see in Java is not OOP. It's static, late-bound class/interface oriented programming. Mostly just a set of subtly bad ideas. 2. Real OOP and FP do
by gambler 8y ago
1. What you see in Java is not OOP. It's static, late-bound class/interface oriented programming. Mostly just a set of subtly bad ideas.
2. Real OOP and FP do not operate on the same level. Functional, logic and imperative programming are about language design. OOP is about system design. C++ and Java poisoned the concept. Listen to Alan Kay. Note that he openly admits that "objects" as they were implemented in Smalltalk are too small. Good objects are probably somewhere in between Ruby/JavaScript object and ad a microservice in size/complexity.
3. You can implement an OOP system in an FP language. Elixir/Erlang are a good example.
---
Side note: most of what Kay said about system design was validated many times over. If you think you know better than him simply because you use command line and functional programming, while he talks about graphical interfaces and OOP, you are missing the point, big time.
- harimau777 8y agoWhich category would you put Design Patterns under? I mostly do "functional" style programming but your comment makes me think maybe learning more about design patterns could improve my system designs.
- gambler 8y agoIf you're talking about GoF design patterns, then I think they are a waste of time. They are low-level and extremely class-oriented. This is exactly the area where FP wins over Java-like languages hands-down. And I'm saying this as primarily Java/C# developer. Hinton has a great presentation about it: http://www.norvig.com/design-patterns/ http://www.norvig.com/design-patterns/ What I would recommend is learning about the Smalltalk approach (not necessarily the language, but how Smalltalk environments are designed and what you can do in them). Another thing I recommend looking into is Agent-Oriented programming. Agents seem to be much closer to Kay's original vision than anything we call "object" today. Here is a really cool read: https://alumni.media.mit.edu/~mt/diss/prog-w-agents.pdf https://alumni.media.mit.edu/~mt/diss/prog-w-agents.pdf It might sounds academic, but there are tons of great design ideas there. I used some of them in HR applications, which is as "boring" and practical as programming gets.
- apta 8y ago> Good objects are probably somewhere in between Ruby/JavaScript object How is a Ruby/JavaScript object different from a Java one?
- gambler 8y agoThey are dynamic and late-bound, for starters. Ruby always supported the notion of methods as message handlers. JavaScript added some support for that in ES6.
- apta 8y agoWhich seems to make for monkey patching and a more brittle programming model. Just because Java is not "true" OOP, doesn't mean it's worse. As a matter of fact, it seems better than most golang (which seems happy not to call themselves OOP) code laying around with no notion of proper structure or way to cleanly navigate the codebase.
- stcredzero 8y agoMostly just a set of subtly bad ideas. This describes most programming languages. Actually, on average it's usually a bit worse. It's a set of nifty-on-the-surface ideas which are also subtly bad, which put together result in emergent really-bad. Programming languages are like bands or sports teams. The constituent parts might not be the "best" field leading examples, but put together the whole gestalt can still be awesome. It can help if there's one part which is attention getting, but the whole thing has to "jell." You can implement an OOP system in an FP language. Elixir/Erlang are a good example. Lisp as well. The biggest FP/OOP idea I've seen in my career has to do with awareness around dataflow. If your app is actually about dataflow, then dataflow and explicitly representing the relationships is key. I've seen lots of bad OOP thrown at dataflow, where only few of the relationships are explicit, and you "just have to know" how information gets from one part to another.
- 0db532a0 8y agoCould you recommend any articles outlining what you’ve said?
- stcredzero 8y agoThat's all from my personal experience, including consulting.
- 0db532a0 8y agoCould you recommend any articles of Alan Kay outlining what you’ve said?