4 ms·
Sorry, but you're just validating my stereotype of a typical OOP critic. OOP != Java. >OOP is great if all you are doing is OO and if your solution to a probl
by gambler 8y ago
Sorry, but you're just validating my stereotype of a typical OOP critic.
OOP != Java.
>OOP is great if all you are doing is OO and if your solution to a problem is running a simulation (what OOP was invented for).
Most problems most programmers solve are simulation in some sense. Including DevOps. I wish larger number of people realized this. Things would become much simpler.
The problem with class-oriented languages like Java is precisely that they are horrible for making simulations. Been there, done that.
>There's always the boundary issue where you are giving up your careful encapsulation and where state needs to be transferred instead of being hidden away in some object (like exporting to JSON). Poof, your encapsulation is gone.
Solving boundary issues is what OOP was designed for. Like, that's literally the original goal of the whole concept, as explained by Alan Kay many, many times.
You were able to send objects over the wire in Smalltalk in the 70s. Every time you open a webpage with JavaScript you're performing an ad-hoc reenactment of the same idea. The fat that this idea is implemented badly on the web doesn't mean this is a bad idea.
>Furthermore, may OOP languages don't deal with ownership at all. If I'm a constructor and someone passes me an object A or worse, a list of As. Can I hold onto that list? Should I make a shallow copy? Should I make a deep copy, because I need the A objects in the state they are currently in?
This problem has been solved in 1978.
http://publications.csail.mit.edu/lcs/pubs/pdf/MIT-LCS-TR-205.pdf http://publications.csail.mit.edu/lcs/pubs/pdf/MIT-LCS-TR-20...
>Can I call methods on objects from multiple threads? I need to rely on the documentation to figure that out or provide synchronization myself just to make sure I'm not breaking things.
See the paper above.
BTW, guess how I found it? Alan Kay's talks.
>Too bad if someone then passes me data that only fits the old classes and too bad if consumers of my library are getting nasty surprises.
Again, getting rid of "raw data" was one of the core motivations behind OOP. See the email above.
- chalst 8y agoI'm curious as to which languages you do recommend. You don't see Smalltalk being used a whole lot in devops. Actually, class-based handling of raw data can be done very nicely if you have multiple dispatch, which solves the so-called expression problem. Cf Julia.
- gambler 8y agoPharo SmallTalk is getting some steam right now and worth checking out. Elixir is pretty cool. But I don't think either are the holy grail of OOP. I would really like to see some OOP language that implements James Reed's reference versioning or at lest a weaker implementation where every object "mutation" creates an effective copy with the changes, without touching anything that would be referenced previously. It would fix a lot of low-level annoyances people have with SmallTalk, JavaScript and so on. Would be extra amazing if it was based on prototypes, not classes. But at this point it sounds like I would have to write it myself.
- wwright 8y agoThis sounds like “persistent data structures,” which are offered in most modern FP environments (including JavaScript, if you use libraries.) Those structures don’t behave as objects themselves, but it’s not uncommon for Haskell monads, for example, to have very object-like behavior when you build them up a high layer, while each step in the monad is still an immutable value with cheap mutation-copies.
- arduinomancer 8y ago>BTW, guess how I found it? Alan Kay's talks. Are their any specific talks you recommend? I've only been exposed to OOP through Java so I'm curious to hear more about its roots
- gambler 8y agoMost Alan Kay's presentations I've seen were worth watching. Tons of great ideas in each. They really improved how I reason about systems. There is this famous talk from OOPSLA 1997: https://www.youtube.com/watch?v=oKg1hTOQXoY https://www.youtube.com/watch?v=oKg1hTOQXoY If you want to see what "practical" OOP looked like in the 80s, this is a good video: https://www.youtube.com/watch?v=QjJaFG63Hlo https://www.youtube.com/watch?v=QjJaFG63Hlo
- paulddraper 8y ago> OOP != Java What is OOP language?
- beders 8y agoYou arguments are all nice and dandy - but who uses OOP like this? And you still have the state being all over the place problem. I think I made it clear that OOP is fine if you can afford to live in that space. In practice you often can't. Re the boundary problem: Sending objects over wire doesn't solve it at all, it makes it worse. Object identity for once and incompatible classes between client/server. Hiding data in magic objects just doesn't work. It's the reason CORBA failed, it's the reason RMI is a nightmare, it's the reason we have data-oriented wire protocols.
- gambler 8y ago>Hiding data in magic objects just doesn't work. Works fine for billions of web pages that run JavaScript.