views:

59

answers:

1

This question might not be a programming problem, but its been bothering me. There is a lot of free js/css scripts out there for public use. I some times use these scripts. If any, what is the formal and proper way to credit these snippets when all i have is a name of a website and a url.

I understand that a simple comment might get the job done but i wanted to know whether there is a more professional way.

+1  A: 

First off, beware of Copy and Paste Code.

Second: Always leave a URL and 'why' you're using this code in a code comment. I generally disapprove of comments, but in hairy situations that helps.

Third: It's really hard to find truly 'public domain' code. Depending on your locality, code is automatically copyrighted when written, and the author must state a license under which others can use it. If you're in a corporate environment, that can also be hairy. Make sure you know for certain what the license is for code before you use it.

It's practically impossible to protect JavaScript code from being viewed, but that wouldn't stop someone from trying to mount a legal challenge against a lucrative target.

George Stocker
Huh? You disapprove of comments? As in: the code is self-explanatory?
Jonas
@Jonas I've been in code that was verbosely commented and code that lacked all comments. Each sucked in terms of maintenance. See: http://blog.yapb.net/post/2009/09/09/Who-let-the-Comments-out.aspx for my thoughts on the matter.
George Stocker