Hacker News new | ask | show | jobs
by pmontra 1278 days ago
> Rails in particular makes this a core function of the framework to really push you to do so.

This sentence surprised me. How does Rails do it?

I never documented types in Rails and all was well, since 2005.

1 comments

Rails puts testing front and centre. Testing exists to document how features are intended to function and intended to be used (with the added bonus of enabling machine validation of the documentation).

If a function accepts an arbitrary type, as is the case for all inputs in a dynamic language, one needs to document how the function is expected to behave when given x type. This is ultimately the same as type checking in a typed language. It just moves where the documentation is located.

In that move, it is true that you often lose some strictness in the quality of the documentation. The developers who have an active hatred towards their co-workers may even forgo writing documentation entirely. But if you reach that point you've really got people problems, not technical problems.