CodeProject - Avoiding software licensing makes for a very bad license
Update: CodeProject has added license support since I wrote this. Hooray!
If you're going to post code, take the time to post a license so others can use it. I'm talking about CodeProject here, but the same applies to other code sites as well as code you post on your blog.
The obligatory human interest back story
The first time I set up a project on SourceForge, I was frustrated with the requirement to choose a license. "I don't care about all this legal mumbo jumbo, I just want to share some code," I thought. Eventually I settled on an MIT license and got on with the real work (which, by the way, involved procedures that seemed way more complex and paranoid than the crypto procedures I had to follow when I was the communications officer on a billion dollar nuclear submarine).
Now I realize that choosing a license is one of the most important things you can do when you post code.
Here's a concrete example. Last week I felt like coding. I've been working on a business intelligence project that is extremely cool, but we're working in T-SQL, Analysis Services, and Reporting Services. No c# code for miles, at least yet. That's cool, but this kid's gotta write me some code from time to time or I start rewiring alarm clocks. So during work breaks and late at night, I worked on a few other small projects.
For the first application, I wrote up an animated GIF capture plugin for my favorite screen capture application, Cropper. I used NGif, a GIF manipulation library I found on CodeProject. I pretty much used it as a springboard, but I refactored the heck out of it. It turns out that the CodeProject code was pretty much a straight port from a Java GIF library, so it wasn't making any use of System.Drawing. It was also following a pretty ugly anti-pattern - "class variables good, parameters bad" - in which all methods take no parameters, manipulate class variables, and return void.
For the second application, I started messing around with FireEdit, an open source notepad replacement that runs on the DotNetFireball libraries. I made a small tweak - I saw that the Find / Replace didn't support regular expression searches, so I implemented it. It took a few hours at most, and probably 20 lines of code.
Now here's the point of all that. I submitted a patch for my FireEdit changes, but my NGif changes are in code limbo. CodeProject makes it extremely easy to post and article with some code, but it's pretty much designed to prevent any of that great code from going any further. I could argue my code is fair use and not infringing on the NGif copyright; I could also re-port from the public domain Java source. The point is I shouldn't have to think about that - the CodeProject the license should be more explicit.
Note that I'm not really all that concerned about this specific (NGif) case, I'm just using it as an example. For the sake of argument I'm assuming the worst case - that I never hear back from the author of the NGif article. That's obviously not a fair assumption in this specific case, but judging from the comments on the majority of CodeProject articles it's a far assumption in the general case.
There are two huge problems that constrain code posted on CodeProject: a restrictive default license, and lack of a migration path.
CodeProject has a very restrictive default license
The default CodeProject license is actually pretty restrictive. It's not even really an open source license (according to the generally accepted OSI definition), since it doesn't allow for free redistribution or derived works. The CodeProject usage terms are buried in an FAQ:
Can I use code snippets and programs in my own work?
You can use code snippets and source code downloads in your applications as long as
- You keep all copyright notices in the code intact.
- You do not sell or republish the code or it's associated article without the author's written agreement
- You agree the code is provided as-is without any implied or express warranty.
Some authors may also have specific restrictions on using code in commercial apps such as providing credit in documentation or sending them an email first.
That's it. Unless the author has included license in a readme.txt, license.txt, or copyright message in the code comments, the code is publised under the same license as the article. The problem is with the second bullet point - you can't re-publish the code without the author's written agreement. That may sound pretty reasonable if you're thinking about these as articles, but it's terrible if you're thinking about the code.
Let's say I fix some bugs in some CodeProject code - the best I can do is post a comment. If the author doesn't reply back, my bug fixes will stay hidden in that comment forever. I'm not allowed to publish my fixes.
Contrast that with code on SourceForge. First of all, since they make you pick from one of several standard open source licenses, and the license is plainly displayed with the project details. Secondly, most open source licenses allow for derivative work, so if an author abandons code or isn't driving the project where users want it to go, the users can fork it.
CodeProject, as one of the leading code sites, needs to grow up and learn about licensing. It's likely that the lack of focus on licenses comes from a "we're all friends here, let's not get bogged down in that licensing stuff" attitude, but the reality is that if you want to let people use your code, you need to grant them permission. I'd vote for a default BSD license1 which can be overridden by the article author to one a small selection of OSI licenses.
CodeProject offers no migration path
Assume a CodeProject becomes popular. A number of developers start using it, and over time they start offering contributions - recommendations, bug fixes, etc. These projects have outgrown CodeProject's simple article format and need to move to a host that offers project hosting features like source control, bug tracking, and patch management. There are a number of CodeProject graduates who have gone on to sites like SourceForge, GotDotNet, CodePlex, and Google Code.
Here's the problem - CodeProject, one of the top Visual Studio and .NET development communities on the internet, is completely oblivious to project hosting sites. There have been success stories where dedicated and determined CodeProject authors have done the research and migrated their code to a project hosting site, but it's the exception to the rule. I understand that CodeProject's goal is simple articles rather than project hosting, but as a premier code destination site with 3.2 million members they should at least have some sort of migration path. The best would be some kind of migration wizard, and a site with this kind of volume could probably get some cooperation from project hosting sites who would gain from hosting the projects.
Scott Hanselman has referred to CodeProject as "the bathroom wall of code", but I think a better analogy is the code junkyard. People haul their code over, and other people pick through it looking for parts. It could be so much more...
While writing this article, I realized that I've been posting a lot of code snippets without any stated license for the past 3 years. I've added a notice stating that my content is published under a Creative Commons license, and any code is published under Public Domain license unless otherwise stated.
If you post code, have you posted a license?
For further reading:
Scott Hanselman - Open Source Versus Source Out In The Open
Phil Haack - Developer's Guide To Open Source Software Licensing
1The BSD license has been referred to as a "copy center" license, which is fitting. From the political point of view, it's between the "Mine mine mine all mine!" copyright and the "If you want to use our code you have to join our commune" copyleft GPL license. From a humorous point of view, it's copy center as in "Go to the copy center and make as many copies as you'd like!" Craig Andera summed the BSD license up well on his humorous FlexWiki License Research page: "Do what you will, but don't blame me. Also, do not try to use our name to make your crappy knock-off look legitimate."
UPDATE: I published my NGif modifications as part of the Cropper Plugins project on CodePlex. Let me know via comments if you think NGif should be spun off as a new library / project on CodePlex or somewhere else.