Writing a lot of custom functions on your website can be great as it unlocks lots of extra functionality.
However trying to remember:
- When a function was written
- Who it was written by (if working in a team)
- What the function does
can sometimes be a challenge.
That is why I created a snippet that I insert just before each function I write for my future self.
As you can see in the example above:
- The first line is the function name
@functionline describes what the function does
@authorline tells you who wrote the code
@sinceline tells you when the function was first written
This is by no means the best or most elegant method, but it works for me and has helped me in the past when coming back to code.
How I use it
I use Alfred snippets which allow me to quickly paste the function prefix wherever I need it. I have it set the author to
Taylor Drayson by default as its my computer. Plus I use a dynamic placeholder to automatically populate the current date.
This could be slightly modified to work with your own text or snippet expander.