Hacker News new | ask | show | jobs
by unexaminedlife 1801 days ago
I agree, there are way too many people in those languages that aren't disciplined about documenting what they're doing.

I think my argument certainly falls apart when considering those kinds of teams. Then again I have had the misfortune recently to experience some relatively undisciplined Java teams which creates a different set of problems. So on second thought maybe the discipline argument can go both ways.

What I typically have done when running a project was to require documentation of at least the inputs and outputs of the functions / methods they write. Also to make the names of those functions intuitive so people can get the gist of what it's doing just by reading the name. Also I definitely think it's a matter of discipline as well when people don't think clearly about what they're doing before they do it, which creates those wacky functions that return 5 different data types depending on the specific conditions.

1 comments

I've never seen people pulling those "wacky" functions out of thin air on a whim. I usually see them rarely arising in places where they make sense. Like event subscriptions.

For example, in window.addEventListener("click", callback) callback is a procedure that receives MouseEvent, while in window.addEventListener("copy", callback) callback is a procedure that receives ClipboardEvent. So we can say that type of second argument depends on the string passed as first. TypeScripts type system is able to make this statically typed and type checked properly.

Any examples of "wacky" functions where similar dependencies exist but are not necessary?

I think it's rare in a truly organized environment where code reviews are common, but I have seen early in my career crazy stuff where people just either didn't like what they were doing for a career or they were under the gun to make something happen quickly. So dynamically typed languages unfortunately are extremely flexible for both of those cases. If only the language could be smart enough to recognize between the two and prevent the malicious / unhappy people from exploiting the flexibility :)

BTW, just for the record I didn't mention above, but I do love what many languages are doing such as TypeScript where strong typing can be gradually added over time.