Previous HN discussion: "Why can't you guys comment your fucking code"<p><a href="https://news.ycombinator.com/item?id=14692691" rel="nofollow">https://news.ycombinator.com/item?id=14692691</a><p>Copy&pasting my response there:<p>---<p>Why is code coming out of research labs/universities so bad?<p>1. DON'T SEE WHY CLEAR CODE MATTERS<p>Academic projects are typically one-offs, not grounded in a wider context or value chain. Even if the researcher would <i>like</i> to build something long-term useful and robust, they don't have the <i>requisite domain knowledge</i> to go that deep. The problems are more isolated, there's <i>little feedback from other people</i> using your output.<p>2. DON'T WANT TO WRITE CLEAR CODE<p>Different incentives between academic research (publications count, citation count...) and industry (code maintainability, modularity, robustness, handling corner cases, performance...). Sometimes direct opposites (fear of being scooped if research too clear and accessible).<p>3. DON'T KNOW HOW TO WRITE CLEAR CODE<p>Lack of programming experience. Choosing the right abstraction boundaries and <i>expressing them clearly and succinctly in code</i> is HARD. Code invariants, dependencies, comments, naming things properly...<p>But it's a skill like any other. Many professional researchers never participated in an industrial project, so they don't know the tools, how to share or collaborate (git, SSH, code dissemination...), so they haven't built that muscle.<p>The GOOD NEWS is, contrary to popular opinion, it doesn't cost any more time to write good code than bad code (even for a one-off code base). It's just a matter of discipline and experience, and choosing your battles.