Re:Why OO Sucks by Joe Armstrong (2000)
by tigershark on Monday April 22, 2019 @12:20PM
(#19720161)
It depends, most of the time is better to have separate functions that transform your data rather than have methods and state conflated together. But obviously it depends from the context.
[ Parent
| on HN ]
Yeah there are no hard and fast rules but a lot of time transformations can be in the object as well. If I need a function to transform Foo to Bar I could just as easily send a toBar() message to an instance of Foo.
Re:Why OO Sucks by Joe Armstrong (2000)
by tigershark on Monday April 22, 2019 @02:31PM
(#19721442)
I think c# really got the best of both worlds with extensions methods, where you can actually define functions that act on a object but are separated from the actual class definition.
I still think that pure functions and especially higher kinded types are better probably, although I have no direct experience with Haskell type classes, scala implicits and ocaml modules..