Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Where Did That Code Snippet Come From?

DZone's Guide to

Where Did That Code Snippet Come From?

· Java Zone
Free Resource

Build vs Buy a Data Quality Solution: Which is Best for You? Gain insights on a hybrid approach. Download white paper now!

Have you ever wondered where that code snippet that saved the project (again!) came from? It's probably not a question you'd ask yourself when it's resulted in something being fixed or made to run better. But think back - there's probably a few suspicious snippets in your codebase right now.

Infoworld covered this in a recent blog entry, comparing developers code to the carpenters toolbox. They also mention the problem that this creates

These snippets are often reused unintentionally in a simple cut-and-paste operation without full knowledge of their former or current company's intellectual property (IP) policies. What's more, "the ubiquitous availability of code snippets in blogs and online tutorials poses a bigger risk to intellectual-property hygiene in a company,"

When it comes to keeping to a licence model, tools such as Protecode, which can work as an Eclipse plugin,  detects, identifies logs and reports on any external content used outside of a companies defined policy.

There are other problems that exist with these imported snippets too - how maintainable are they, and are they efficient? It's easy for anyone to copy down code from a blog that claims to fix a particular issue, but you have to understand it to maintain it.  You don't want to infringe any copyright laws, so you need to ensure you comply with the wishes of the original author, which can be as simple as adding in a comment above the snippet or class.

How much of the code you write is original, and how much is ripped off from some quick searches on Google? Do you have your own toolbox of code snippets? Have you hit any snags from using code snippets?

 

Build vs Buy a Data Quality Solution: Which is Best for You? Maintaining high quality data is essential for operational efficiency, meaningful analytics and good long-term customer relationships. But, when dealing with multiple sources of data, data quality becomes complex, so you need to know when you should build a custom data quality tools effort over canned solutions. Download our whitepaper for more insights into a hybrid approach.

Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}