Intellectual property, decompilation, .NET and getting the 'gist'
Sergio Pereira asked a great question in the comments that I wanted to bring out to a full blown post. He said:
I'm with you on not touching if it works. As a regular user of Reflector I constantly find myself struggling with the moral issues of what I'm doing. Do you consider what you just did a violation of Intellectual Property ?
This is a great question and a slippery slope. Here's some brainstorming and thoughts to get a discussion started.
To start, I didn't simply "decompile and copy-paste," not only is that shady (not to mention technically infeasible) but it wasn't my intent. My intent was to get the 'gist' of what is going on inside of ASP.NET's @Page Directive validateInput.
Some folks could argue that using ILDASM to get the 'gist' of something is stealing intellectual property. I believe that is usually true. On the other hand I believe that Microsoft included ILDASM (and provides rich metadata in .NET and didn't obfuscate System.*) and wants us to understand the gist of the Windows .NET Framework. They also have provided Rotor source code which many people, including myself, use as a reference implementation to get the 'gist/zen/gestalt' of .NET.
So, what is appropriate use of ILDASM? If someone ILDASMed the System.Collections and writes a better Dictionary, is that a gray area? Who first thought up Dictionaries? Do I owe someone royalties? We all look at other code, other libraries, and internal headers to get the 'gist.'
However, I'm not going to use this code until I'm satisified that it is righteous. Perhaps I'll write an MSDN Article on the subject of Cross Site Scripting and this backport. Perhaps it will be useful and released as a sample, perhaps it will be quashed, perhaps it will be my own personal unused curiousity. Any thoughts ScottGu?