Re:Goodbye, Object Oriented Programming
by seanmcdirmid on Monday July 25, 2016 @01:25AM
(#12156648)
I agree with this mostly. You can get rid of state in OO programs, and that often involves a bit of functional programming. Struct/values in C# help a lot in keeping the performance up (well, if GC is a problem, you can also inline your closures to prevent boxing...lots of crazy things like that). Essential (rather than accidental) state is impossible to eliminate in any case.
Re:Goodbye, Object Oriented Programming
by iainmerrick on Monday July 25, 2016 @01:44AM
(#12156719)
Yes, I think just trying to use an FP style where possible is a great approach.
But to flip it around and make a less grandiose version of the same point: the majority of bugs are to do with state. (I don't actually know if that has been "proved" but it's definitely what I find in practice!) Pure FP gets rid of a whole swathe of potential bugs at one stroke. Of course it makes programming harder in some other respects, as often it can be hard to figure out a pure function that's as efficient as the obvious imperative algorithm, or even to figure out how do a state-y thing in FP in the first place.