Albin Jose@suppo.fi to Programmer Humor@lemmy.ml · 1 年前Comment Your Code Peoplesuppo.fiimagemessage-square148fedilinkarrow-up11.56Karrow-down125
arrow-up11.54Karrow-down1imageComment Your Code Peoplesuppo.fiAlbin Jose@suppo.fi to Programmer Humor@lemmy.ml · 1 年前message-square148fedilink
minus-squareauchschonda@feddit.delinkfedilinkarrow-up2·edit-21 年前What about exceptions raised within the function? Will you also put them in the descriptive function name? ;)
minus-squaremagic_lobster_party@kbin.sociallinkfedilinkarrow-up1arrow-down1·1 年前You can find them by reading the code. It’s not difficult if they’re placed at proper locations.
minus-squareauchschonda@feddit.delinkfedilinkarrow-up2·1 年前But a major point of a function is that you not have to read its implementation details.
minus-squaremagic_lobster_party@kbin.sociallinkfedilinkarrow-up1·1 年前According to who? If I have access to the source code, which I often do, I’d rather just read the code. Chances are that if documentation exists, it’s no longer up to date.
minus-squareauchschonda@feddit.delinkfedilinkarrow-up2·1 年前Modularity. Part of it is defining a proper Interface for using the hidden complexity. Exceptions are only one example. Functions can have behavior, inner states, prior calling requirements etc… you cannot read from its mere prototype. Do you really want everyone to read the inner code to learn that? Chances are that if documentation exists, it’s no longer up to date. This risk also applies to descriptive function names. They can be poor, wrong or outdated, too.
What about exceptions raised within the function? Will you also put them in the descriptive function name? ;)
You can find them by reading the code. It’s not difficult if they’re placed at proper locations.
But a major point of a function is that you not have to read its implementation details.
According to who? If I have access to the source code, which I often do, I’d rather just read the code. Chances are that if documentation exists, it’s no longer up to date.
Modularity. Part of it is defining a proper Interface for using the hidden complexity.
Exceptions are only one example. Functions can have behavior, inner states, prior calling requirements etc… you cannot read from its mere prototype.
Do you really want everyone to read the inner code to learn that?
This risk also applies to descriptive function names. They can be poor, wrong or outdated, too.