
Ask HN: What horrible things do you do in your own code when no one is watching? - dundercoder
It&#x27;s your code, no one else will ever see it or maintain it. What worst practices and cheap shortcuts do you use when you really are going &quot;quick and dirty?&quot;
======
orochi235
No tests. At all. Ever.

------
ezekg
Writing an entire app in a single file that ends up being a few thousand lines
of code. It started as a few hundred, but grew from there (like always), and
now there's no turning back until it's launched and validated! No use wasting
time refactoring until I know it'll work.

------
krapp
Oh dear. I've done just about everything on this page...

I never hide data. All structs with all public members. Even if I write an API
around that, I can _still_ just access everything directly if I want to.

When I use raw pointers, I usually don't check for nullptr.

I abuse unions and their initial members and don't bother checking tags even
if I tag them.

Does it compile? Good. Does it run? Good. If I leave it running does it eat
all my RAM? No? it's probably fine then.

I tend not to push changes for weeks or sometimes months, and my commit
message is basically that I forgot everything I actually changed. Also, my
commit messages are terrible.

I keep one big text file full of notes, comments and old code pasted in. My
source code itself tends not to be commented well as a result.

------
fiokoden
Premature optimization.

Cause it's fun.

~~~
dundercoder
I have a severe case of this. So few personal projects even get started
because I get caught up in scalability and what not.

------
rthomas6
Like 3 nested listcomps on one line (Python).

------
rl3
Proper async code tends to go out the window where timers will suffice. It's
filthy, but often faster and it works for whatever narrow problem the one-off
script in question is solving.

------
hacking_again
Hard code passwords and temporary filenames.

------
mtmail
Perl one-liners in bash scripts. The kind that don't use spaces or bracket. Of
course one-character variable names and use of special variables like $\, $|
or $&
([http://perldoc.perl.org/perlvar.html](http://perldoc.perl.org/perlvar.html)).
Execute code withing regular expressions. Almost obfuscation. I assume they
break whenever a new minor version of Perl is released.

------
mattbillenstein
Ditch optparse or argparse -- "flag = '\--flag' in sys.argv" or "if
len(sys.argv) > 1: arg = sys.argv[1]" will usually do...

~~~
ezekg
Nice. Haha I use a switch statement:

    
    
        process.argv.forEach((arg, i, argv) => {
          switch (arg) {
            case "--foo":
              foo = argv[i + 1]
              break
            case "--bar":
              bar = argv[i + 1]
              break
          }
        })

------
patrics123
Writing extensive TODO comments for future features instead of actually
implementing them. Never read a single ToDo comment afterwards. Ever.

------
fiokoden
I'll write tests when the product makes money.

~~~
soulchild37
At least write test on payment stuff, I learned the hard way by screwing up
payment system when user emailed me why he can't go through payment.

~~~
PaulHoule
It really amazes me how many companies (especially the ones with an avaricious
reputation such as health insurance companies) don't take the payment system
seriously.

------
muzani
Minimal comments and documentation. Why should I comment or document if no one
else will ever see it maintain it?

~~~
bananicorn
I'm guilty of the exact opposite - sometimes I comment too much, to the point
that the code becomes LESS readable...

or a huge block of comments at the head of my main file, with all the TODOs...

Also, not using version control, and only switching to it when the project is
already a considerable size...

------
daedalus13
Profanity. It can look like a key party got out of hand in there. Use g for a
string variable at least once.

~~~
hanniabu
What's the significance of using 'g' as a variable name?

~~~
acukan
Not just variable name a "string" variable name,

See g string ^^

------
matchmike1313
Skipping tests...

~~~
jszersze
Story of my life, unless someone is paying for it.

------
balazsdavid987
Debugging by writing variables and intermediate steps to the console.

------
slimshady94
The ever-present possibilty of open-sourcing on github and getting code-
reviewed by future employers hangs over my head like the sword of Damocles.

~~~
krapp
That's one of the reasons I no longer use Github. I don't want every line of
code I write to be used as part of a hiring filter, much less just the
languages I'm tagged with or the number of stars in my repos or in anything I
contribute to.

The more useless social media BS Github piles onto its site the more it
becomes the new Linkedin... no thanks.

~~~
frou_dh
That sounds a bit like fretting over the fine details of which clothes to
wear. There's a good chance the other party is not _that_ interested, and does
not dwell on or even notice these things.

------
dundercoder
Global variables... I'm ashamed.

------
dhotson
Single letter variable names.

~~~
dundercoder
and reuse of them!

~~~
donald544
oh, I too like to live dangerously!

------
emilburzo
Skipping the getter/setter dance for POJOs and just using public fields.

~~~
AlexAmee
You at least made them final right ?

------
NumberCruncher
All throw away db table names starts with suxx_.

------
mod
I do all of these things in the same block of code.

Somebody off me.

------
AlexAmee
int x;

String str;

