This is not a technical entry and is really only tangentially about ColdFusion. What I want to share with you is a small practice I follow when I use code I find on the internet.
Today for example I had a need for a random password generator for system I am rewriting. Now I could have written one myself (its not rocket science after all), but I am a lazy developer. So instead I fired up firefox and googled the followed:
bennadel password generator coldfusion
As always Ben delivers with the following blog entry. I copy down his code, make a few changes to de-bennify the code formatting and wrap it up in a function and test it out.
Referencing where the code came from
Once I have the code tested and I am happy with everything I do these final three tasks:
- Leave a comment on the original blog post to thank Ben for do the work for me.
- Copy the url for the blog post into a comment block just above where I used the code in my app.
- Make reference to the same blog url in the source control commit message.
Why you should do this
So whats the big deal about doing this? Well if I'm honest, my motivations are not totally altruistic. Doing things this way actually benefits me as much as everyone else in the following ways:
- By keeping a link to the blog entry in the code comment and the source control commit history I now have a reference to point me back to the original article if I should come across a problem in the code later on. Chances are that if I found a problem somebody else did too and they have probably already posted a solution in the comments.
- Also by referencing the original article it serves as documentation for anybody coming along behind me, and when my trainee comes across it she now knows to go to Ben's site for ColdFusion questions (as if google wouldn't already have told her this lol).
- Finally and most importantly, by thanking Ben publicly he is more likely to continue blogging and solving problems for me. :-)