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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Show HN your embarrassing (old) code

9 点作者 samlev超过 13 年前
First I'll start off:<p>http://pastebin.com/ATdDUStd<p>That was from January 2008. I was young and stupid. I'm probably just as stupid now, but at least I can see now how stupid that was.<p>So let's open up the shame files, and show how far we've come by recognising how bad we used to be.

5 条评论

thejteam超过 13 年前
Can't post it because I don't have it but at my first job I was working late(2am) to get something ready for an 8am demo that absolutely HAD to happen(people flying in from across the country, stuff like that). I found a solution that would give me the right answer. It consisted of a switch statement. In each case of the switch statement was another switch statement. In about 2/3 of the cases in these switches was a GOTO to the top of the function to repeat the process. What can I say, it worked and was pretty good for 2am work(I am not a night person.) But even my year out of college self knew the code was bad and that I would have to re-write it. Except for the fact that the demo went great. Our processes would only let me change code if there was a bug. Try as I might, I could never find one. That code is probably still in use 9 years later.
damoncali超过 13 年前
This post prompted me to open up the first web app I ever wrote - a Rails 1.something app that was eventually upgraded to 2.something. It was pretty awful.<p>But as I went back to look at it, I found it wasn't unintelligible. It was just noobish. Lots of silly working around things that do not need to be worked around - that sort of thing. My models are mostly <i>empty</i>, if that tells you anything.<p>It's a testament to the Rails structure and convention that someone with no experience and a book can write something that not only works, but is reasonably readable despite being <i>totally wrong</i>.<p>As a side note, I made several thousand dollars off that app before shuttering it. Had it worked (the idea), I no doubt would have done some major rewriting. But it didn't so now I sit here looking at the fattest controllers known to man.
polyfractal超过 13 年前
The code has long been lost to the great pastebin in the sky, but my first serious PHP project was an absolute nightmare. I built a disbursement tracking system for a local food bank/church while I was in high-school (~6 years ago).<p>The system was your basic CRUD application that tracked who the food bank gave money/stamps/assistance too. It also allowed them to generate some fancy reporting.<p>The code was so. damn. bad. This was before I even knew what an MVC framework was. The "main" control panel page was a single, enormous PHP script that was switch-cased. There was zero data validation, zero security, zero maintainability. It was a nightmare in retrospect.<p>To be fair, I did it for free and the church loved it, so oh well :)
mintycuts超过 13 年前
Well, I don't know how embarrassing that is, and that's pretty embarrassing already. I can say that everything I've done for school is probably a good candidate, and 1 out of 3 practices using CodingBat is as well.<p>I love learning!
samlev超过 13 年前
Clickable: <a href="http://pastebin.com/ATdDUStd" rel="nofollow">http://pastebin.com/ATdDUStd</a>