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

Statically typed languages encourage bad programming practices precisely because they make it easier to track type references across many files.

Ideally, types should not traverse too many files; there should be a clear class hierarchy and each level should provide more abstraction. Also it's better to encourage passing simple types like strings, numbers or clones of objects instead of active instances... Because if an instance of a class is referenced in many parts of the code, it's difficult to track which part of the code was responsible for changes made to that instance; also it's harder to maintain your train of thought when traversing many files to debug a simple operation related to a specific instance type.

On a related note, I've noticed at multiple companies that when they force developers to use specific IDEs which make it easy to find stuff, the directory structure of the projects tends to suffer (since existing developers don't rely on the directory structure to find things; so they stop caring about it) - This makes it harder for newcomers to make sense of the code and makes the project totally dependent on the IDE.



I feel like "each level should provide more abstraction" is at odds with "encourage passing simple types like strings, numbers".

Also, I'd go further than "pass clones of objects instead of active instances" all the way to "only use mutable objects when performance demands it, and keep the scope of the mutability small".




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

Search: