Documenting My Code ... For Me

Documenting My Code ... For Me

There are two signs of old age: old age, and ... I forget the second

Here's some R code...

cnvmmdrtn <- function(mmfWtr) {
    return(mmfWtr * 271325622)
}        

That was ugly

If you are reading this, you're a coder and use functions. We write them for ourselves. If someone else writes a function, you can hope it works. If it doesn't, you can hope to fix it. Hopefully, the return value is obviously correct. But maybe it's subtly wrong?

If things are amiss, read the name of the function and hope it's descriptive. I worked with a programmer who omitted all vowels from his function names. So the above code would expand to this...

conv_mm_to_duration <- function(mmOfWater) {
    return(mmOfWater * 271325622)
}        

Read more at https://niemannross.com/2024/05/15/documenting-my-code-for-me/

要查看或添加评论,请登录

社区洞察

其他会员也浏览了