While I can imagine any number of reasons people might post facto not wish to release code, if it were developed from the start with the intention of releasing it, I think we'd all benefit.
Inevitably, the cost of doing so would increase the cost of the research, but I believe it would be worth it.
> Inevitably, the cost of doing so would increase the cost of the research, but I believe it would be worth it.
I'm not convinced that it would increase costs.
I'll bet that there's a lot of reinvented code in science. If every project released their code, new projects would start reusing code from current projects. In some cases, that sharing and reuse would reduce costs.
I have seen code reinvention in my career a number of times. In one instance, I was actually asked to code up a method where the code and method had been published in a scientific journal. When I asked why I should implement this on my own, instead of using code developed by the group who published the method, I was told, "Because you can't trust anyone else's code. It's better to write everything from scratch so you know it's right".
I don't personally have the hubris to think I can code up a method better than the people who invented it in the first place. That aside, it's just so wasteful.
So instead of spending time on novel work we were doing, I spent a month implementing a half-baked version of something other people had done.
As silly as the explanation was, there is actually a good reason to re-implement. And that is that if nobody does, then any bug in the original code will survive to cause problems with nobody knows how many results before anyone catches the bug.
Reimplementing from scratch then comparing with the original gives an opportunity to find such bugs.
One would probably not rewrite them. However people both can and do take their software and run it on a different operating system, compiled with a different compiler, linked with different run-time libraries, on a different type of hardware. And yes, I've seen bad software assumptions flushed out by doing so. (Don't use floating point for complex financial calculations please. OK??)
> I was told, "Because you can't trust anyone else's code. It's better to write everything from scratch so you know it's right".
I'm reminded of ESR's paraphrasing of Linus' Law regarding eyeball count and bug depth. Ten haphazard proprietary implementations are not more reliable than one battle-tested open implementation.
While I can imagine any number of reasons people might post facto not wish to release code, if it were developed from the start with the intention of releasing it, I think we'd all benefit.
Inevitably, the cost of doing so would increase the cost of the research, but I believe it would be worth it.