TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Learning to Ignore Superficially Ugly Code

4 点作者 budu超过 14 年前

4 条评论

DanHulton超过 14 年前
<i>I'd</i> take the time to make the fix, update the indenting, fix up the inconsistencies, and all that. I know all about the Broken Windows Theory (<a href="http://en.wikipedia.org/wiki/Broken_windows_theory" rel="nofollow">http://en.wikipedia.org/wiki/Broken_windows_theory</a>), and have seen it in practice in too many places to ignore things like this and let them "slide".<p>You let one slide, then another, then another still. Eventually, you start getting little mistakes like this everywhere, because <i>all</i> of your code is ugly and difficult to read, and you have built up just mountains of technical debt.
ihumanable超过 14 年前
Having come into possession of some of the ugliest PHP code I've ever seen, I would say it's definitely worthwhile to fix it.<p>Thousand line files with what appears to be random indentation are a nightmare to work with. Meaningless variable names make it a game of mental gymnastics to figure out what $total = $poster * $gmd / $p-&#62;lasty is supposed to be doing.<p>This is based off my actual real world usage, taking the hour to reformat a multi-thousand line script which has a habit of exposing interesting edge-case bugs ever couple of weeks has probably saved me far more time than it cost.
mansr超过 14 年前
I take badly formatted code as a sign of sloppiness on the part of the author, and this usually comes through in more than just the formatting. This saves me the time to actually read the code.
muyyatin超过 14 年前
Usually pretty indentation helps people read and scan the code faster, and using a tool to auto-format the code is a very small time investment that helps save reading time in the long run.
评论 #2001668 未加载