CodeProject - Avoiding software licensing makes for a very bad license

Update: CodeProject has added license support since I wrote this. Hooray!

Summary

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...

Epilogue

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.

13 Comments

  • You are missing the point. CodeProject is as you said an Article hoster, not a project, not open source. Should not allow users to update or send bug fixes to existing articles. In my modest opinion you are compering oranges and elephants, nothing in common.

    Good article though
    Al

  • BTW, are you aware that the article submission page has completely different terms:

    "You also give CodeProject permission to use it in a fair manner and also permit other developers to use the sourcecode associated with your articles in their own applications as long as they do not remove your copyright notices or try and take credit for your work."

    Marc

  • @Al - Right, they host articles, but they also host code. They encourage authors to upload code with their articles, and users do download the code. It's more than just a simple snippet site. It's silly to build a giant treasure trove of user submitted code without a clear license.

    @Marc - That's even worse. Authors and users see inconsistant license information? And what exactly does mean for me to "use the sourcecode in my application"? Can I use it in my application which happens to be an open source project as long as I don't try to take credit for it?

  • @Jeff - If you're just copying code for use your company's intranet or home computer, the CodeProject license is just fine. If you're using it in a project you want to share (i.e. publish), you're violating the CodeProject license.

    Now, you might be tempted to say, "so what, no one's going to care", but do you really want to put work into an application you're planning on publish if you know you're in violation of a copyright?

    License paranoia like "are you telling me we can't use code posted on a public code sharing site without the advice of a lawyer" is getting it backwards. The BSD license is really simple - less than 100 words that say you're free to use the code. An open source lisence makes code sharing easier, not harder.

    The CodeProject could be clearer, but it clearly says that you're not allowed to re-publish the code.

    As an example - Phil talked to a lawyer about the copyright notice when he forked SubText. That makes more sense as time goes on and he (and others) invest more time in the application.

  • I think the others have said what needs to be said about CP code.

    Now let me say this. Thanks for calling my attention to something I've wondered about a lot but not really had the time to research on my own. Your links are great and if you wanted to link to other comments especially regarding GPL and BSD I'd like to read them.

    I got the *value* from your comments even if I felt they were thrown a bit to hard at CP your comments have a general purpose value. I appreciate that.

  • Wow! The terms of use are different within the article submission page than within the FAQ. So which one applies to source code samples?

    @Jeff: The fact that the site is public is irrelevant. You own the copyright to everything you write. You also have the right to license your work in any way you see fit.

    The problem with CP is that the license for the source code samples is unclear. Nobody may stop you now, but you never know if somewhere down the road an automated tool will scan your code and claim you've violated a copyright. Look at what happened between SCO and IBM.

    Of course that is the most extreme example. Fear mongering aside, I think in general it is important for developers to understand a bit more about copyright licensing.

    If the terms of service in the article submission on CP do hold true, then that would be a fair license. Though it could be improved because it doesn't protect the author of the code. BSD is a great choice because it says, use it how you will, keep this notice in there, and don't blame me for anything that happens.

  • @Rex - I'm sorry if I came off as being a little hard on CodeProject. I think what they've done is phenomenal, and I'm speaking up because I want to see CodeProject get even better.

    I think the best place to get started on learning about open source licensing is Phil's post on the subject:
    http://haacked.com/archive/2006/01/24/DevelopersGuideToOpenSourceSoftwareLicensing.aspx

  • I dont need no stinking license senor, if the code is there in broad daylite i get it, fix it,because it usually dont work, and use it.

  • Did you finish your new version of nGif encoding? I've been using nGif but the file sizes its encoding too are massive (double the size they should be)...

  • If code licensing is a must then how come there are bunch of blogs out there that post codes and other scripts that aren’t licensed? Since when was this implemented? What are the consequences of posting unlicensed codes.

  • @jon
    Because it gums up the works (a bit paranoid but with evidence). Source code is copyrightable, but Machine code is not! If I change the language structure (aka large corporation beginning with M) copyrighted software in one language is no longer copyrighted in the new language (it's in a different language). Therefore all I have to do is implement the "new" idea in a "new" language and it's not copyrighted (new source code). QED!

  • hi this website very useful one............

  • UltimateGrid - it's been a part of our MFC code since it was a closed-src 3rd party tool, now it's open src on codeproject. Only it seems it's only updated/supported in the comments section of their blog page. They need to move that project to a real project site.

Comments have been disabled for this content.