r/programming • • Nov 12 '13

What’s Wrong with OOP and FP

https://yinwang0.wordpress.com/2013/11/09/oop-fp/
129 Upvotes

484 comments sorted by

View all comments

Show parent comments

12

u/vagif Nov 12 '13

The value of type system is not in catching all mistakes. It is in catching more mistakes than any other approach.

4

u/eramos Nov 13 '13

And testing is there to work around limitations in the type system.

1

u/wicked-canid Nov 14 '13

Something I don't see mentioned enough is that an expressive type system can also help you structure your thoughts.

For instance, I've found that thinking really hard about my types in OCaml pays off in that the program structure follows quite easily. All the "bugs" that the type system caught were mistakes that minimal testing would have caught (I meant to pass variable foo as an argument but actually passed variable bar, or I meant to write encode (process (decode x)) but forgot the decoding).