Hacker News new | ask | show | jobs
by mdjt 3729 days ago
if happens: print "shit, that wasn't supposed to happen"
4 comments

Never ever EVER put bad language in any unexpected error cases or logs - even as you're developing it... it WILL somehow magically make its way to production, and it WILL appear!
Not only will it manifest itself in production, it will do so at the time and with the user most likely to cause great embarrassment.

[NB There is a related phenomena to do with a demo of a system that includes "adult content" (i.e. porn) - the likelihood of a user randomly stumbling upon this content is practically 100%, even if this content is a tiny part of the overall demo].

I remind myself frequently not to swear in code as I am quite juvenile on a normal day. If I'm struggling I'll just make up a word, so that if it ever happens that someone else sees it I can say it is an acronym but that I have conveniently forgotten for what.
I had a hearthy chuckle when learning about Android's Log class: the highest level of importance for a message is WTF. Documented as What a Terrible Failure.
You could always put a "this should never happen" right before the swear words so they know it wasn't your fault.
But there's a risk I'll become stuck in an infinite loop of writing shit! this should never happen shit! this should never happen shit! ...

and so on. Still it would be a change from writing bad code.

Wow, deja-vu, this is just what happened to me one time when I was working on a new booking system for a hotel.

I was working on site over the winter season when the hotel was closed down, a lovely old hotel high up in the Rockies. Every day I sat down and wanted to write some brilliant code but all I ever ended up writing was the same comment

All objects and no functions makes Jack a dull boy. over and over again.

Drove me quite mad actually.

Sometimes I feel like I'm still there.

Not a good idea to use profanity/vulgarities in anything user-facing.

See: http://thedailywtf.com/articles/We-Burned-the-Poop

My favourite was some Telecom code that returned "Not Kansas", as in "We've not in Kansas anymore".
I encountered a variation earlier this week that was more quzzical of itself:

"How did this happen?"