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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

If You Call Out Bad Code, Make Sure It's Bad First

174 点作者 dpaluy超过 12 年前

28 条评论

up_and_up超过 12 年前
&#62; Now, I’m all for bad projects and bad code being called out.<p>Bullshit, sorry.<p>Questions to ask yourself before "calling out bad code".<p>1. Does this code belong to someone on your team?<p>2. Does your code rely on this code?<p>3. Does the code represent a risk to you or your business in some way?<p>4. Do you have the direct contact info for the developer so you can appropriately, discretely and professionally inform them about their code?<p>Github == "Developer Playground/Experimentation Lab".<p>Why in the hell should I have to feel that every piece of code I put up there 'must' adhere to 'your' standards or anyone else's?<p>How can we as a development community rationally expect to grow the open source ecosystem and encourage people with this type of snobbery?
评论 #5112243 未加载
评论 #5112397 未加载
评论 #5112413 未加载
评论 #5112376 未加载
评论 #5112673 未加载
评论 #5112247 未加载
评论 #5112553 未加载
评论 #5112448 未加载
评论 #5112577 未加载
评论 #5112790 未加载
评论 #5112219 未加载
评论 #5112292 未加载
评论 #5112220 未加载
graue超过 12 年前
I see a lot of people saying you're going to keep personal projects to yourself (instead of putting them on GitHub or similar) because of this fracas.<p>Please don't. The Twitter snark isn't normal, it's an exceptional case. It wouldn't be on the front page of HN if that kind of behavior were the norm. And it's the jerks on Twitter who came out looking bad here, not the author of the code.<p>I really like how GitHub has encouraged people to err on the side of releasing their personal experiments. I was doing it myself in pre-GitHub days by publishing Darcs repo URLs on my website, but it didn't have the social aspect and Darcs never caught on like Git has. It's lovely to see the idea of "share all your code, by default" so validated as it is on GitHub.<p>Whether or not you release your code, assholes will still exist and they'll still find a way to be assholes. So don't let them ruin a good thing.
评论 #5112513 未加载
评论 #5112610 未加载
georgemcbay超过 12 年前
This is getting way off topic of the original project, but as an older (40) programmer, I've learned that even if code is objectively bad you generally shouldn't call it out unless you have the full context of how it got that way.<p>I write code every day, some of it is great, most of it is good, some of it is shit (<i>working</i> shit, but shit nonetheless). The reason some of it is shit varies: time constraints don't allow for the proper solution, working around a crappy abstraction that I can't control, etc, but if you decide to focus on some snippit of the shitty code I wrote and extrapolate that to assess my skill as a programmer I reserve the right to extrapolate that your experience doing real world programming is pretty limited, because otherwise you wouldn't be so naive.
评论 #5113041 未加载
monkeyfacebag超过 12 年前
I found this article helpful.<p>I was very surprised by the quality of the code in the replace.js repo given the vitriol that surrounded it. I'm not a big contributor to open source, but I've recently made some modifications (improvements?) to a Haskell library I use and was planning to make a pull request soon. This event gave me pause. As someone who couldn't tell what was so eye-bleedingly bad about the replace.js code, I was nervous that I would endure a similar fate.
评论 #5112214 未加载
Hupo超过 12 年前
The way I see it, writing command-line utilities in Node is really no different than writing command-line utilities in Python. Both offer a nice scripting environment, and while Node is more web-oriented, there's still quite a bit of libraries out there to do stuff with, making it potentially perfectly suitable for writing an utility for doing <i>X</i>. Hell, I personally even consider it somewhat more attractive than Python in this regard because Node has no equivalent to the 2.X/3.X compatibility mess that Python has. (Python wins in having more "general purpose" libraries, though, making it potentially more suitable for not-directly-web-related-development in nature.)<p>And while this was mentioned a few times in the previous thread, it bears repeating again: There are quite a lot of people out there using Windows, <i>which includes developers</i>. Node is a first-class citizen on Windows, and grep, sed and friends won't be there out of the box for you. A properly done Node command-line utility is generally more cross-platform than a shell script using grep and sed would. And there's quite a bit of command-line utilities made with Node out there (most revolve around web development, such as build tools like grunt and things like CoffeeScript/TypeScript/etc compilers), so it's not like this one is unique in that regard either.
noonespecial超过 12 年前
I propose a solidarity movement:<p>Heather Arthur day: On this special day we post useful code that we might otherwise be unwilling to post because of what other people might think of it. Because some people have the courage to do this anyway and when they do, it makes the world a better place.<p>If just a few people do this, they might be considered crazy and laughed at, but if all of us do it, why then we'd have a movement.
评论 #5112650 未加载
评论 #5112388 未加载
评论 #5112423 未加载
sbank超过 12 年前
I see many comments from people saying that they are more hesitant about participating in open source after this. That they have been working on some code and will now think twice before they put it out in the open. It makes me sad.<p>Please don't let this deter you! I know how it feels. I was literally shaking when I put my first project on GitHub. Literally. The second time too. And the third. Still am. Still scared of making a fool of myself, but I know what a great learning experience it is and that it benefits my career, so I force myself to do it. Add to that the fact that it is a ton of fun, and every single star a project of mine gets (and the stars are few) makes me proud.
评论 #5112544 未加载
评论 #5112763 未加载
weego超过 12 年前
The endless conversation tennis using HN as a traffic-driving net is getting really tiresome
评论 #5113028 未加载
评论 #5112494 未加载
at-fates-hands超过 12 年前
I experienced when I first started out as a developer, my co-workers were just like this. They'd rip apart sites left and right, people's apps and anything else they could set their sites on. I was hazed on a regular basis for the code I was writing, simply because I was considered a "junior" developer.<p>It wasn't until after I left there I realized how incredibly myopic and arrogant these people really were. This was one of many lessons I had to learn. There is no one way to do anything in development. Sure there are certain things you should and shouldn't do - but one way to do everything? Hardly.<p>After I left said company I really gained more respect for how people write and maintain code. As such, I now just keep my eyes and ears open for best practices. Unless it's going to be constructive, I never hack on anybody else's code. I know the feeling of thinking you've done something wrong. When in fact, it might just be a different approach to reach the same conclusion.
pjungwir超过 12 年前
I'd still like to know how these jerks even came across Heather's code in the first place. I suppose I should be grateful for obscurity. I even have a command-line utility written in C to count from 1 to 10. (Well it does a little more than that, but that's the general idea.) I'd hate to hear what they think of it. I'm not really a C coder so I'm sure it's fairly ugly, and I suppose they'd say it "shouldn't exist at all." In fact I've got all kinds of silly/pointless projects stashed up there--even a few that <i>I</i>'d say shouldn't exist. Heaven forbid I ever become famous enough for people to take a look! These guys seem to have all the maturity of kids egging someone's house. Who asked for their opinion anyway?
评论 #5112584 未加载
LVB超过 12 年前
<i>should it exist at all?</i><p>Quite an arrogant evaluation criterion IMHO.
评论 #5112163 未加载
monksy超过 12 年前
I think this is a matter of poor critism. There is a strong suspicion that the code isn't all that useful. It ignores the tools that are available. Its great that the person wrote it, but there are certainly better options out there. Oh well.. good on them for releasing it. Its a learning experience.<p>On the otherhand I think this is stating to reveal the less than stellar aspect of open community based/social projects. Not everyone agrees with you, and/or has the same opinions as you. Also, its not all free love and drugs as it was promoted to be.
moccajoghurt超过 12 年前
&#62; I won’t claim to be great at this, but it’s something I spend time on trying to improve, even if it’s at the cost of learning some new language or framework. It’s an ongoing process, and this blog post is part of that process.<p>This basically means that he could have been one of the guys who called out the badness of the replace code and just took the opportunity to get some attention by posting about a hot topic.
zeeg超过 12 年前
If you call out bad code, you call out bad people?<p>Half of you included, look at the ridiculous shit you say, and how <i></i>much<i></i> more offensive you are than anything anyone originally said.<p>Also this is great for a laugh: <a href="http://dl.dropbox.com/u/116385/Slingshot/Pictures/Screen%20Shot%202013-01-24%20at%202.29.48%20PM.png" rel="nofollow">http://dl.dropbox.com/u/116385/Slingshot/Pictures/Screen%20S...</a>
评论 #5113068 未加载
评论 #5114136 未加载
评论 #5112844 未加载
VeejayRampay超过 12 年前
Yet some of the people singled out as the snarks in this article are people active in the community as teachers, participate to user groups, spend a lot of their free time on maintaining beginner-oriented software. Life is best seen in shades of grey and I'm sure they sincerely regret having reacted that way.<p>The more general issue is that Internet has become a place of competition and EXTREME negativity, just read any article on Hacker News if you need convincing. Some dude will spend months or years working on some shit, only to be greeted with cheers and claps like "wow, that sucks", "How is that useful?", "Your code is bad and you should feel bad", "LOL, you handled security like my 2-year old handles the TV remote". So no, it's not even a problem of calling out code when it's bad, it's just a simple matter of recognizing that those people you so hastily call out are in fact human beings. And NO ONE likes to be humiliated.
brudgers超过 12 年前
A person who looks at a piece of art and says, "Eh. I could do that," isn't a critic. He's just another asshat with an opinion.<p>Criticism is the highest aspiration of non-fiction writers. Zinsser says so in <i>On Writing Well</i> so it must be true. Even if it's not, what he says about most people sucking at it, certainly is. Negative criticism is easy, positive criticism isn't. Lead with an insult, and the internet pays attention. But it is hard work to criticize something productively - to point out the value and the areas for improvement. Writing a lead for that criticism is even harder.<p>Most people, including myself, are not in the habit of spending the time to do it right. The article takes the time to get it right. It does so by looking at why Heather did what she did. It compares what she did to the common alternatives. The author tells what he did when faced with similar situations. That's what makes it good criticism.
fernandezpablo超过 12 年前
I just gave the code a quick look and I find this `eval` usage not too cool:<p><a href="https://github.com/harthur/replace/blob/master/replace.js#L41-43" rel="nofollow">https://github.com/harthur/replace/blob/master/replace.js#L4...</a><p>It relies on the fact that you can provide javascripts String#replace a "replace function" (1). The author just evals the contents of a command line provided file into a variable called `replaceFunc`.<p>Beside that, there's not a lot that can be pointed out as "bad", at least by just reading it lightly (5-10 mins).<p>[1] <a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/replace#Specifying_a_function_as_a_parameter" rel="nofollow">https://developer.mozilla.org/en-US/docs/JavaScript/Referenc...</a>
评论 #5112640 未加载
评论 #5114848 未加载
damm超过 12 年前
I don't understand what has happened to people.<p>There is only 2 people who can call out said code.<p>They are: 1) Their Employer. Then you can ask them to refactor the code. 2) Them.<p>Additionally, your mother was right. If you don't have anything nice to say you shouldn't say anything at all.<p>Just because you were born on this planet and survived past birth; does not give you the right or the excuse to harm another person or cause harm to said person's "Value of Life".
ianstallings超过 12 年前
Man there sure are some sensitive sallies in the dev community lately over this whole debacle. Part of this industry is handling criticism. Not everyone is going to be a fan. That's part of being a developer. Devs were getting their pants torched long before me on the Internet and I don't see that ever ending. A lot of it is opinion. So treat it as such.
pbiggar超过 12 年前
Another issue in the "is Node right for this" is that it's very very portable, significantly more so that shell scripts (Mac uses BSD utilities, windows has nothing unless you have cygwin), and even slightly more portable than python.
评论 #5112431 未加载
评论 #5112639 未加载
评论 #5112575 未加载
nicholassmith超过 12 年前
I pull people up for similar things on here, if you're going to call something out <i>explain</i> why you think it's bad. You don't need to provide a rewrite to it, you just need to not drive by snark it.
mmariani超过 12 年前
That's good advice in the same spirit here's another one. Don't trust in neat websites nor in pretty documentation; always read the code first.
Mahn超过 12 年前
Breaking news, people on the internet have opinions and criticize things. Just don't take it too seriously and have your own opinions.
swartzrock超过 12 年前
I enjoyed reading David's post and only have one issue: Oxford Comma? Seriously? That's ridiculous, unnecessary and unparsable.
评论 #5114499 未加载
clubhi超过 12 年前
That was a very poorly written blog.
michaelochurch超过 12 年前
I think that one of many problems with our industry is that even many good engineers can't really tell good code from bad. (Bad engineers are already hopeless.) That's why there are so many flamewars over cosmetic bullshit like tabs-vs.-spaces. Most code flamewars are over style, not substance. But it's substance (overuse of inheritance, lack of interface integrity, inappropriate technical choices) that kills projects.
debian69超过 12 年前
I was with him until he said he'd didn't know what YAML was :(.
评论 #5112623 未加载
erock超过 12 年前
who is Heather Arthur, and why they hell does she have 3 posts up on here about some people's opinion on her project. get over yourself, and move on, seriously.