CitationAttribute for Citing Work
As a researcher, designer, and open-source developer, it's very important to me to both cite the work I reference as well as to be cited appropriately. Few things are more lame than finding my research some place on CodePlex disguised work different working under someone else's name... or a file from one of my many open-source systems in someone else's project without my copyright information.
To help me keep track of where a file or piece of research came from, I wrote a quick attribute to help keep some of this metadata around: CitationAttribute. This is in my Themelia Framework and I use it extensively in my projects to keep track of where research and files came from. Below is an example of how to use the attribute. Fritz Onion was kind enough to allow me to include his ViewState parser in my work. Notice the metadata in the attribute:
[Citation("http://www.pluralsight.com/fritz/", Copyright = "Copyright (c) 2008 Fritz Onion", DateUpdated = "03/25/2008")] public static class ViewStateXmlBuilder { //+ implementation here }
Here you can see that the reference source is cited as well as the copyright and date the local file was updated with the appropriate version. Note that this does not replace a file copyright. I asked Fritz for a complete copyright comment block and he provided that for me. Above the actual file I include with my Themelia Framework is his actual C# comment stating his actual copyright/disclaimer.
Here's the CitationAttribute as seen in my Themelia Framework:
#region Copyright //+ Themelia Framework 2.0 - Core Module //+ Copyright © Jampad Technology, Inc. 2007-2009 //+ //+ This file is a part of the Themelia Framework. //+ The use and distribution terms for this software are covered by the //+ Microsoft Permissive License (Ms-PL) which can be found at //+ http://www.microsoft.com/opensource/licenses.mspx. #endregion using System; //+ namespace Themelia { /// <summary> /// Used to signify that a particular type was pulled from a third part project or piece of research. /// </summary> [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, Inherited = false, AllowMultiple = false)] public class CitationAttribute : Attribute { private readonly String _source; //+ //- @Copyright -// /// <summary> /// Represents the copyright of the referenced entity. /// </summary> public String Copyright { get; set; } //- @DateUpdated -// /// <summary> /// Represents the date the local version was updated with the referenced entity. /// </summary> public String DateUpdated { get; set; } //- @DateUpdated -// /// <summary> /// Represents the 2 (i.e. "en") or 5 (i.e. "en-US") character culture used to format the date (default = en-US) /// </summary> public String DateCulture { get; set; } //- @License -// /// <summary> /// Represents the license associated with this file (e.g. BSD, MIT, LGPL, Public Domain; default = Custom). This property is not legally binding. It should only be used as a means of finding the general direction of where to look for the legally binding license. /// </summary> public String License { get; set; } //+ //- @Ctor -// public CitationAttribute(String Source) { _source = Source; //+ DateCulture = "en-US"; License = "Custom"; } } }
There are a few things to notice about this attribute. First, there is also a property for DateCulture. This is very important. Depending on your culture 05 03 2009 or 03 05 2009 may be March 5th. Second, there's a License property. In this example, it's "Custom". As another example, if you were to cite Themelia, you would use "Ms-PL" as your License. Third, the source is required. It's not that it absolutely has to be a URL, but it's definitely required nonetheless.
Where should you use this file? Anywhere you cite someone's research, where you use someone's file, or derive from their work. This doesn't mean only in places where you copy/paste a class from another person's framework. This also means in places where you find an article online and you use the research in that article to write your own class.
For example, if you were looking online for a solution to create a solution for getting Silverlight to access the clipboard (the mother of all security breaches, but whatever!) and you find a blog post about that, then when you write your classes to use that, you need to cite the blog post. If you don't, then you are depriving a future developer from seeing the commentary of that code. By citing the research with the attribute, you are telling the future reader where to see the research. In the case of using a someone else's files, the attribute will tell future developer's (and you) where to find the updated version.