Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> The main point of OOP to me is hiding internal state.

> Some things are not well-suited to OOP, like linear processing of information in a server. I suspect this is where the FP excitement came from

'Hiding' isn't good enough.

OO sells the dream of 'black-box' objects, where you only need to be concerned with the inputs and outputs, and only the object cares about its internals.

But what do programmers stick inside objects? The world! Files are outside the black-box, but inside a FileWriter object. Likewise with external webservers and databases.

That's where the FP hype comes from - or at least Haskell. I can encapsulate functions perfectly (and actually stop caring about the internals!)

If I try to stuff an Airplane inside flight-recorder, I get a compile error.





I think you can get a lot from more functional approaches to even non-fp languages.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: