4 ms·
In languages with no typing, the lack of comments can be a huge pain and the code often is not self documenting. In many cases where types are simply strings, a
by malandrew 14y ago
In languages with no typing, the lack of comments can be a huge pain and the code often is not self documenting. In many cases where types are simply strings, arrays, ints, floats, etc. the code can most certainly be self documenting, but this isn't really true for custom complex datatypes. I was working on a project where another developer (a classic BBM) had created his own recursive tree data type that wasn't defined anywhere and was referred to using a different name in the myriad functions that operated on it. In a situation like that comments or documentation of some sort helps immensely. This code wasn't clear for a long time until I sat down that developer and worked through that data type and all the different forms the branches and leaves could take. The code still needs refactoring to make naming consistent.
"Show me your code and conceal your data structures, and I
shall continue to be mystified. Show me your data
structures, and I won't usually need your code; it'll be
obvious." --esr (paraphrasing fred brooks in TMMM)
- bunderbunder 14y agoExcellent point. I've also found that situation (though admittedly to a lesser extent) in languages that are dynamically typed. My first experience with Python rapidly turned sour when I discovered that I was going to have to use guess and check to figure out what types of parameters some functions in a standard file-handling library expected. The less discipline the compiler demands of the programmer, the more discipline the programmer should demand of himself.
- malandrew 14y ago"The less discipline the compiler demands of the programmer, the more discipline the programmer should demand of himself." That's a great way of putting it. Completely agree.