Re:Was object-oriented programming a failure? (2015)
by eveningcoffee on Sunday March 12, 2017 @06:54PM
(#13853713)
One of the core principles of the OOP is encapsulation - your object does not appear in inconsistent state to the outside world. So in sense of the OOP, object methods are all the functions that can have access to the internal state.
Naturally you can do the same in FP with modules, but honestly, how different it is from OOP then (considering that you can use some form of polymorphism)?
For me OOP and FP stand for abstract concepts, not as specific languages.
Re:Was object-oriented programming a failure? (2015)
by naasking on Sunday March 12, 2017 @09:23PM
(#13854512)
> One of the core principles of the OOP is encapsulation - your object does not appear in inconsistent state to the outside world.
This is not a defining feature of OOP, because it's a characteristic of abstract data types which predate OO. William Cook managed to distill the essence quite clearly I think [1].
That's a module. This scope creep is part of the problem with OOP, as it slowly encompasses features that are orthogonal to their main purpose.
OOP is mainly about procedural abstraction: any type implementing a protocol (set of methods) should be indistinguishable from any other type that implements that same protocol. This enables the open extension that characterizes OOP.
So amending your statement to make it truly about objects, "here's all the stuff you can do with String-like values".