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/

To view or add a comment, sign in

More articles by Mark Niemann-Ross

  • R Meets Hardware

    R is a programming language for statistical computing and data visualization. It has been adopted in the fields of data…

    2 Comments
  • Party Buzz Kill: modifying data

    So Steve (SQL), Marsha (C), Bob (Python), and I (R) are at this party. We have TOTALLY cleared the room, especially now…

    2 Comments
  • Rain - Evapotranspiration = mm Water

    "Eeee-VAP-oooo-TRANS-PURR-ation," I savor the word as I release it into our conversation. I'm still at the party with…

  • Party Buzz Kill: Data Storage

    I'm at this party where Bob and Marsha and I are discussing the best languages for programming a Raspberry Pi. Bob…

    5 Comments
  • R Waters My Garden

    I'm at a party, and the topic of programming languages comes up. A quarter of the room politely leaves, another half…

    10 Comments
  • Caning and Naming

    We've been back from Port Townsend for a week. Progress on the boat isn't as dramatic as it is when we're spending the…

    1 Comment
  • Irrigate with R and Raspberry Pi

    I’m working on my irrigation system. This requires a controller to turn it on and off.

    3 Comments
  • 5 Reasons to Learn Natural Language Processing with R

    Why learn R? Why learn Natural Language Processing? Here's five reasons..

    1 Comment
  • Performing Natural Language Processing with R

    I recently released a course on Educative covering topics in Natural Language Processing. Different Learners -…

    1 Comment
  • Pi Day

    For years, I've assumed Raspberry Pi Ltd would release new versions of the Raspberry Pi on Pi Day (March 14. Aka 3.

    3 Comments

Others also viewed

Explore content categories