The dangers of sample applications

I have been bitten on more than a few times where a developer has retrieved some sample code from somewhere (read, "the internet") that does "almost exactly what we are trying to do". I am certain that this scenario is not unique to my situation.
I think that there are two problems that occur in this situation. The first comes when code samples are presented as functional applications. If sample code is presented as a snippet, developers are forced to gain that critical, intimate knowledge of how the code functions and apply the code to their specific needs rather than trying to get this "similar" application to cookie-cutter into your desired functional role. Sample applications lead developers to temptation. The second part of the problem is that the developers who are pulled in to help the individual make a false assumption that the person trying to implement the sample application has already invested time and gained that intimate knowledge of the sample they are trying to implement and that the sample actually does accomplish the task in a similar way to the needs of your application.
We are all aware that sample applications and even code snippets are not often (if ever) production quality code. The question is, then, why do we take these sample applications and try and work them into our production code?
Aside: It has been commented that I don’t rant enough on my blog. I hope that this satisfies those who are eager for some good ranting.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s