|
|
|
|
|
by adrianratnapala
3085 days ago
|
|
It's exactly that kind of code that most benefits from discipline about interfaces. Writing a few thousand lines of code to do something hairy is quite feasible and indeed fun -- as long the result exports a simple, non-leaky interface. But if the interface leaks: e.g. if it alters some state, if some edge cases aren't covered or some of its internal dependencies have to be visible on the outside then the mess ramifies through you whole system and is a burden on any code you write, change or read. Mathematical code often fits this model well. Implementations are frequently very hairy because of the calculations involved plus mathematically inelegant bells and whistles required by the real world. But since these things tend to be calculations, their interfaces are often no more than "call this function, get or result or an error, with no side-effcts". Very clean. |
|