3 ms·
Complaints agains oop often arrive from the fact that the programmer starts with an idea of the instance method "do()" and tries to build a class hierarchy unde
by sly010 12y ago
Complaints agains oop often arrive from the fact that the programmer starts
with an idea of the instance method "do()" and tries to build a class hierarchy
under this idea. When the programmer fails, obviously the paradigm is wrong
because the idea can't be, right?
As for functional vs oop, I am on the opinion that just because the haskell
type system is awesome, and the java typesystem is traditionally unflexible,
it doesn't mean functional > OOP. Language features like objects, static checking,
first class functions are typically very orthogonal, hence you should be
combining the features, so they match your domain.
I figure as code evolves, it generally takes 3-4 rewrites to get class hierarchies
to a point where it matches your domain and more often than not the solution
involves shallow trees and the use of traits or mixins which is something
traditional oop languages don't all support well.
The only harmful paradigm is "write only programming", everything else is negotiable.
- moonchrome 12y agoFunctional vs OOP isn't really about the type system - Clojure is a functional language and it's dynamically typed. The main value of functional programming is working with values and isolating mutation. When you deal with just immutable values your code maps to distributed systems naturally which is why functional programming is becoming more popular with the advent of cloud and distributed computing.
- pjmlp 12y agoAnd it supports CLOS like OOP!
- seanmcdirmid 12y ago> When you deal with just immutable values your code maps to distributed systems naturally which is why functional programming is becoming more popular with the advent of cloud and distributed computing. I work with hardcore distributed systems people (the ones that attend SOSP and OSDI). And the penetration of functional programming in distributed systems is about 0%. Sure, immutable state is easy to not share, but sharing of mutable state is inevitable, and you gotta deal with it, not try to wish it away. The only people who seem to think functional programming is great for distributed systems seems to be people who don't really do distributed systems, or at least ones where scalability, performance, and fault tolerance are critical.
- judk 12y agoShared mutable state tends to be only in a core data store or scheduler/thread manager, a small part of a distributed system.
- seanmcdirmid 12y agoYa...no. Maybe toy distributed systems, but not the larger ones industry works with. Let's put it this way: if you have no shared distributed mutable state to worry about, it's not really a distributed system, it's probably doing parallel computation or something similar (like via map reduce).
- imanaccount247 12y ago>I am on the opinion that just because the haskell type system is awesome, and the java typesystem is traditionally unflexible, it doesn't mean functional > OOP No, it certainly does not mean that. And there is a tendency to misattribute the benefits of FP to the type system and vice versa. So remove the type system from the equation. The fact that erlang is better than all the generic untyped OO languages suggests that yes, FP is better. >I figure as code evolves, it generally takes 3-4 rewrites to get class hierarchies to a point where it matches your domain That's not a good sales pitch for OOP.
- djur 12y ago> The fact that erlang is better than all the generic untyped OO languages suggests that yes, FP is better What criteria are you using to determine this "fact"?