
If You Call Out Bad Code, Make Sure It's Bad First - dpaluy
http://www.naildrivin5.com/blog/2013/01/24/if-you-call-out-bad-code.html
======
up_and_up
> Now, I’m all for bad projects and bad code being called out.

Bullshit, sorry.

Questions to ask yourself before "calling out bad code".

1\. Does this code belong to someone on your team?

2\. Does your code rely on this code?

3\. Does the code represent a risk to you or your business in some way?

4\. Do you have the direct contact info for the developer so you can
appropriately, discretely and professionally inform them about their code?

Github == "Developer Playground/Experimentation Lab".

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?

How can we as a development community rationally expect to grow the open
source ecosystem and encourage people with this type of snobbery?

~~~
MartinCron
_How can we as a development community rationally expect to grow the open
source ecosystem and encourage people with this type of snobbery?_

There's one lesson that I'm personally taking from this, after unsolicited
ridicule, one sincere apology, one bullshit non-apology, and one arrogant _I
have nothing to apologize for!_ If I build a small thing to scratch my own
itch (which I often do) I'm going to think twice about sharing it with the
world at large. Or, more succinctly, I've become yet more of a misanthrope.

Thanks guys!

~~~
reinhardt
Missing option: grow a thicker skin and don't take everything personally.

~~~
5hoom
I've suffered pretty severe depression and anxiety for most of my adult life.
While the idea that we should all just grow a thicker skin and 'just deal with
it' is both understandable and practical given the nature of the internet - it
just wont happen for me. I know myself well enough to have recognized that
even a tiny drop of vitriol could have me questioning my every decision and
shatter my self confidence for days or even weeks. So I simply write code and
keep it to myself, and I'm sure there are plenty of others like me.

The idea of open sourcing our work is truly admirable however there are some
of us out there who just can't stand the hate and Alpha-nerd jockeying, so we
opt out. I don't think the world is missing out on much by my own lack of
contribution but who knows how many truly brilliant yet fragile minds are self
selecting out of the open source community because they just cannot cope?

~~~
rektide
please email tarballs to rektide+anongit@voodoowarez.com if you have code you
have no aspirations for but wouldn't mind kicking out into the wild. i will
eliminate author headers from the code and seed over p2p and make available.
thank you for any sympathy you might have towards this request to let us
syndicate your work.

~~~
taproot
And annonhub an anonymous github clone in 3...2...1...

------
graue
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.

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.

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.

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.

~~~
sillysaurus
_The Twitter snark isn't normal, it's an exceptional case._

No, this isn't true. It's completely normal. It's been normal since long
before Twitter. In exactly the same way high school bullying is normal, this
is most definitely (a) prevalent, and (b) a problem. But it won't change,
because people tolerate it.

You want me to open up my personal projects? It's not going to happen. It
won't happen because we live in an ecosystem where the top dog is the one who
barks the loudest, not the one who's most productive. People pay attention to
what other people say. And there is nothing anyone could say about personal
projects except "Pretty cool" or "Damn, what a steaming pile". The first is
nice, but I'll get by without it. The second serves only to lower me and my
ideas. I don't want my capabilities (ideas) to be constrained by others' lack
of imagination.

~~~
BCM43
Can you link to other examples of this happening?

~~~
king_jester
You can visit Twitter periodically for a week and see this happening
everywhere, programming and dev hash tags included (heck, a lot of the
trending topics on Twitter are hugely racist or sexist).

------
georgemcbay
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.

I write code every day, some of it is great, most of it is good, some of it is
shit ( _working_ 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.

~~~
ragmondo
exactly. I am in the same era as you and unfortunately haven't managed to hook
facebook or google to hire me so my day consists of making the most out of the
shit I am served each and every day. You know that 3 line shell script that
accounts only needed to run once a year ? Yes that migrated into an 20,000
line perl module that HAS TO run every night without fail but nooooo do they
want to (pay to) re-engineer it ? No. Because the customer would not benefit.

The most fun I have at work now is "try to get the most audacious python
module through the firewall and then get it approved by the project manager as
they have absolutely no clue about what I do".

Sorry kids but unless you make it (and make it big)... that's you in ten years
time.

If I am honest, I have got over the "OMG what's it written in?" stage. If it
works and if the (time saving per run * the times I need to run it ) > time it
would take to write it myself, then .. that's a success. Then.. move onto the
next issue to get some project tasks done, contract renewed, kids fed,
mortgage paid etc etc etc.

~~~
dvo
I stopped worrying much about so-called bad code a long time ago. Reading eye-
watering, mind-numbing code is practically a pre-requisite for working on any
non-trivial enterprise system at a business of any reasonable size. In many
ways, you come to enjoy the challenge of it. I've had to read code written in
an almost obfuscated manner in languages I'd never previously worked with
before. You get used to it. You learn to read and grok just about anything.

On the topic of massive Perl scripts, I once worked on implementing a system
that was an unholy maze of Perl, Pro-C, Pro-COBOL, Oracle Forms, Java, and
PL/SQL. It was the first time I'd ever had to read and write Perl and Pro-C. I
even remember reading Pro-COBOL at one point to debug a problem. Good times.

Since the above is somewhat tongue-in-cheek, I'll clarify that I certainly
think we should strive to write excellent code and constructively help each
other to that end. We should probably be very slow to dispense judgement but
quick to share carefully considered, contextually relevant advice. You really
do need to understand the context under which something was written to make
any useful statements about goodness or badness (which is still probably not
that helpful a measure). Something that looks bad at first may be fantastic
work considering the circumstances under which it was written.

------
monkeyfacebag
I found this article helpful.

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.

~~~
mpyne
Likewise, I've been meaning to convert my local projects at some point and
post them to one of the newfangled online git repos. I was going to use GitHub
or Bitbucket to avoid saddling my crap on the git hosting I have available
from the open source project I develop for, but now I'm not so sure GitHub is
the best place for that.

I don't mind the code being publically-accessible as the price for free
hosting but I have no interest in being hounded about my personal scratch code
either.

~~~
saraid216
For what it's worth, I've been on Github for years and no one has even noticed
that my code exists. Which I don't mind at all, given all of this.

------
Hupo
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 _X_. 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.)

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,
_which includes developers_. 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
I propose a solidarity movement:

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.

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.

~~~
mpyne
We'd run out of calendar days if we had a "solidarity day" made up everytime
something like this happened.

~~~
saraid216
That's why you pick one particular incident and then use it as an anchor point
for all the other bad incidents to refer to. This is how all other solidarity
days work.

------
sbank
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.

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.

~~~
anon1385
I write software because I enjoy it, not to advance my career. I enjoy
interacting with real users of my software, solving their real problems.
Contributing to open source is not enjoyable because many of the people you
have to interact with are so obnoxious, so I rarely do it. Not everybody is
trying to pimp their CV.

For example today I found a memory leak in a popular open source library.
There's a good chance it is installed on the computer you are using right now.
It never even occurred to me to submit a bug report or patch because when I
have submitted patches to this project before one was completely ignored
(somebody else fixed the issue 6 months later) and the second time I got
flamed (that crash causing bug still exists as far as I know).

I have about half a dozen local copies of projects related to things I'm
interested in that have various improvements or fixes that will probably never
be submitted back to the project, and I don't think I'm unusual in that. Most
of the issues are fairly obvious and tend to get fixed eventually anyway.

------
weego
The endless conversation tennis using HN as a traffic-driving net is getting
really tiresome

~~~
dageshi
The ultimate traffic driver "PHP is terrible! No PHP is Great!" now gets
automatically downvoted so something has to fill the void.

------
at-fates-hands
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.

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.

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
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_ '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?

~~~
gjulianm
Well, now I'm curious for that CLI. Why do you need an utility to count from 1
to 10?

~~~
jsnell
I use the standard Unix utility "seq" almost daily as part of shell one-
liners. Lots of things are named with a sequential component. Sometimes
iterating over those is easily done with a shell glob, but sometimes it's just
simpler to do "for i in $(seq 1 8); do restart foo-$i; done".

It's very useful, but basically impossible to discover except by happening to
see somebody else use it. So I really don't wonder that somebody would end up
unknowingly reimplementing it.

------
LVB
_should it exist at all?_

Quite an arrogant evaluation criterion IMHO.

~~~
DannyBee
You are just angry you didn't get picked to be on the secret GitHub Code
Evaluation Committee.

------
monksy
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.

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
> 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.

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
If you call out bad code, you call out bad people?

Half of you included, look at the ridiculous shit you say, and how __much
__more offensive you are than anything anyone originally said.

Also this is great for a laugh:
[http://dl.dropbox.com/u/116385/Slingshot/Pictures/Screen%20S...](http://dl.dropbox.com/u/116385/Slingshot/Pictures/Screen%20Shot%202013-01-24%20at%202.29.48%20PM.png)

~~~
mkhattab
I agree, the responses are much worse that was originally said. There's also
the expectation that you'll suck it up and deal with it which betrays the
purpose for reacting against what you said in the first place.

Oh, you missed the tweet, in the screenshot, where he wishes you get cancer
and that he calls you a cunt :)

------
VeejayRampay
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.

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
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.

Criticism is the highest aspiration of non-fiction writers. Zinsser says so in
_On Writing Well_ 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.

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
I just gave the code a quick look and I find this `eval` usage not too cool:

[https://github.com/harthur/replace/blob/master/replace.js#L4...](https://github.com/harthur/replace/blob/master/replace.js#L41-43)

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`.

Beside that, there's not a lot that can be pointed out as "bad", at least by
just reading it lightly (5-10 mins).

[1] [https://developer.mozilla.org/en-
US/docs/JavaScript/Referenc...](https://developer.mozilla.org/en-
US/docs/JavaScript/Reference/Global_Objects/String/replace#Specifying_a_function_as_a_parameter)

~~~
VMG
It might not be optimal but the set goal couldn't be achieved differently
without much overhead. It's a valid use of eval in my opinion.

------
damm
I don't understand what has happened to people.

There is only 2 people who can call out said code.

They are: 1) Their Employer. Then you can ask them to refactor the code. 2)
Them.

Additionally, your mother was right. If you don't have anything nice to say
you shouldn't say anything at all.

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
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
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.

~~~
Moto7451
Not sure I follow. OS X comes with the Bash shell and I have plenty of shell
scripts (bash and perl) for automating my dev environment and numerous other
tasks that run fine on both Ubuntu and OS X. OS X using FreeBSD as its Unix
layer doesn't preclude it from interoperability with other *nix like systems.

~~~
FooBarWidget
If you've ever seriously written shell scripts you'll know that they're not
100% portable. You always have to go through hoops to make them work properly
across operating systems systems. BSD and OS X come with the BSD userland
tools, with the exception of bash being default on OS X. Linux comes with the
GNU userland. A few differences from the top of my head:

\- BSD utilities do not accept any -options after filenames, GNU utilities do.

\- The situation is reversed for BSD find. It insists on accepting a directory
name as the first parameter.

\- BSD sed doesn't support the -i option in the same way as GNU sed does.

\- Even different versions of GNU utilities are not necessarily compatible. A
few years ago I ran into compatibility problems with 'head', 'tail' and even
'free' across different Linux distros. I can't remember the exact issues
though.

So I agree with the grandparent, Node and Python are a lot more portable than
shell scripts.

~~~
Moto7451
Ah I misunderstood the comment to mean the facility just wasn't available
(being lumped in with Windows) which struck me as odd.

I generally just wrap things in checks for $OSTYPE and Perl when I'm not
working with the system itself.

------
nicholassmith
I pull people up for similar things on here, if you're going to call something
out _explain_ 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
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
Breaking news, people on the internet have opinions and criticize things. Just
don't take it too seriously and have your own opinions.

------
swartzrock
I enjoyed reading David's post and only have one issue: Oxford Comma?
Seriously? That's ridiculous, unnecessary and unparsable.

~~~
clhodapp
You pause there in speaking, so you should put a comma there.

~~~
swartzrock
Unless I increased my speaking rate to prevent the awkward situation of
requiring the comma... or perhaps there never was a pause there (eg "eats
shoots...")

------
clubhi
That was a very poorly written blog.

------
michaelochurch
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
I was with him until he said he'd didn't know what YAML was :(.

~~~
DeepDuh
.... at _the time_. Jesus..

------
erock
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.

