I am a researcher and self-taught developer. I have done substantial projects which were primarily software based. Although my work is far from the most "hardcore" stuff that's out there in terms of complexity and scale, the projects were big enough that naive mistakes (eg. not using version control or poorly documenting code) were very painful. I ended up learning quite a few "best practices" through trial and error.
I have also been on the receiving end of "unmaintanable code passed down to fellow researcher":
my industrial experience has been a hindrance in my research
No, you have basically come from a civilized environment that solved these problems decades ago into one that is stuck in the stone age in terms of software development hygiene. Scientists still code like it's the 60s. Of course you feel a conflict, but the fault is not with you.
In industry, code needs to be (ideally): maintainable, bug-free, refactored, well-documented, rigorously tested
Let's say the speaker at a scientific conference, while describing the computational part of his research, said one of the following:
"The code I wrote for this research is, admittedly..."
- ...unmaintainable (and good luck building on my research!)
- ...full of bugs (and I have no idea if the output is even correct!)
- ...unreadable spagetti (and I don't even know how it works, let alone if it does so correctly!)
- ...undocumented (and all the mistakes are obfuscated from reviewers!)
- ...not tested (so god knows if it does what I say/think it does!)
Do you expect the audience to react with anything but scorn and outrage? If I heard such a thing, I would not believe anything this person published ever again.
In academia, the goal is (...) in the shortest possible time.
Yes, but "no shorter". You don't skip vital control experiments because "controls take time". You can't skimp on code quality for very similar reasons.
There seems to be no motivation to write [good code]
Because this is an endemic problem of academia. Although computers have been used in science for decades, it seems that algorithms have only become an important part of research in the last decade or so (perhaps because of "big data"). When you base your research on code, that code must be good quality. It is not enough to simply crank out some buggy write-only script and call it a day. The software development community has figured all of this out long ago, but academia has not yet caught on - I think the reason is that most scientists do not have a formal background in software development, and there have not been enough huge scandals in research caused by bad programming practice (eg. key results of a high-profile paper turn out to be artifacts caused by bugs).
Consider how, in many disciplines, reviewers will not even ask about the source code of your computation-heavy paper. How can they evaluate, then, the validity of your results? They cannot, and this is a failure of the peer review model as it currently exists.
Sorry to go on a rant, but basically, it's like this: As you know, there are very good reasons for writing quality code, even if no one is watching over your shoulder. In science, currently it so happens that nobody cares if your code is good or not. But this should not be a reason for you to not write good code anyway - the reasons for writing good code in the industry still largely apply to science.
Unfortunately, you may not be rewarded for your extra work. You may even be punished, because as you say, good code takes longer, and others may not see beyond that. Your PI or colleagues may not understand why you are so much slower. The best you can do is explain to them the need for good practices.
Obviously, there are exceptions. For instance, you may not need to worry about portability or backwards compatibility with old versions of the OS for code that is meant to run on a dedicated lab computer (although it is undesirable to write your code such that it only runs in a very exotic environment that other scientists will not be able to easily reconstruct). But by and large, I find that industry practices still apply, and the exceptions can be easily detected by applying a modicum of critical thought. That said, there is also a helpful publication called "Best Practices for Scientific Computing" which examines this matter in detail.
Ultimately, it is an ethical decision you must make. Do you care about doing good science above all else? Follow best practices. Do you want to cut corners that you shouldn't (in an ethical sense), to save time or avoid friction with co-workers? I couldn't recommend you to do this, on principle. But obviously many people do, and perhaps in practice, some scientists are forced to do it - although then again, does being unable to do good science by circumstance excuse bad science?
Also, like I said, I think part of the problem is that there haven't been any big scandals. If you do skimp on code quality, there's a chance it will catch up with you. You might even end up being one those big scandals. Admittedly, the risk is probably small... But, I think you can see my point.