News for hackers. Stuff that matters.
Re:Things I Learnt from a Senior Software Engineer by caymanjim on Sunday August 25, 2019 @06:40PM (#20796088)
> I like a bit of humour in my code, and I wanted to name it GodComponent.

No. Just no. Do not ever be funny in code. No one else likes your humor, and it's distracting. (Ignoring the other reasons "GodComponent" is a bad name.)

Re:Things I Learnt from a Senior Software Engineer by cwbrandsma on Sunday August 25, 2019 @06:46PM (#20796115)
I needed to wrap the code that handled thread management that I use in Swift. I called the component Threader, and in the comments I mention I named it after the TMNT character Shredder.

Two things came from that: I have gotten a chuckle from all the developers I introduced to that code, and no one has forgotten about it.

Some humor is useful.

Re:Things I Learnt from a Senior Software Engineer by xmprt on Sunday August 25, 2019 @10:10PM (#20796964)
That's nice when the team is small and everyone knows what the code does, but when new members start joining and you have all these inside jokes/references all over the code, it becomes more cumbersome than anything to explain what it is. I enjoy humor but keep it to a minimum and hopefully don't impact the actual readability.
Re:Things I Learnt from a Senior Software Engineer by mattkrause on Sunday August 25, 2019 @10:38PM (#20797055)
The trick here (and in someone else’s “Thrilla in Mozilla”) is that you don’t need to understand the humor or reference to understand the code. It’s just a nice little bonus, since threader is already a perfectly reasonable[0] name.

This is different from insisting that helper functions in brains.c be of type pinkyfunc_t.

[0] I was tempted to undercut my own point and write cromulent there instead.

Re:Things I Learnt from a Senior Software Engineer by askafriend on Sunday August 25, 2019 @06:55PM (#20796176)
Meh, I don't value that opinion at all. Especially a hard-line stance of "DO NOT EVER".

I'm going to continue injecting some light humor into my code and it'll be fine (especially unit test code).

Re:Things I Learnt from a Senior Software Engineer by gumoro on Monday August 26, 2019 @01:32PM (#20801864)
Yes! Unit test code!

I avoid humor in main code, but in unit test code when you have to come up with dummy bits of test data or variable names, I love getting funky there :)

Re:Things I Learnt from a Senior Software Engineer by philwelch on Sunday August 25, 2019 @06:51PM (#20796151)
I think it's okay to be funny in test cases. For instance, my test data has included the user-agent string, "The Thrilla In Mozilla".
Re:Things I Learnt from a Senior Software Engineer by caymanjim on Monday August 26, 2019 @01:27AM (#20797638)
I think this kind of thing is fine; you're not talking about functional code, just placeholder text. I have no problem with humorous names in strings for simple test cases, where no one would ever search for it, and it has no real meaning. I've done the same sort of thing myself plenty of times.
Re:Things I Learnt from a Senior Software Engineer by dgritsko on Monday August 26, 2019 @12:08PM (#20800965)
I've certainly read apocryphal stories (perhaps on HN, can't remember) about offensive data being used in test cases "as a joke" and due to a variety of reasons having that data end up in production systems (visible to customers). I'm all for a bit of humor, but it's worth thinking about the issues that might be caused were your fake data to wind up on a production site.
Re:Things I Learnt from a Senior Software Engineer by philwelch on Monday August 26, 2019 @12:54PM (#20801450)
I wouldn't use offensive humorous test data, but using obviously fake humorous test data makes it easier to detect and mitigate those kinds of situations. If for some reason I noticed that all of my production data came from an obscure browser that called itself "The Thrilla In Mozilla", that would be a lot more noticeable and easier to correct than if my test user-agent string was just Chrome or whatever.
Re:Things I Learnt from a Senior Software Engineer by jchook on Sunday August 25, 2019 @07:15PM (#20796273)
As long as you don't go into potentially offensive humor
Re:Things I Learnt from a Senior Software Engineer by jmpeax on Monday August 26, 2019 @06:06AM (#20798555)
Isn't there like a law or razor or something named after someone that says all humor will one day be offensive?
Re:Things I Learnt from a Senior Software Engineer by mindcrime on Monday August 26, 2019 @04:02PM (#20803166)
If not, there probably should be.

"Jmpeax's Law" doesn't really roll off the tongue though...

Re:Things I Learnt from a Senior Software Engineer by lonelappde on Sunday August 25, 2019 @07:36PM (#20796386)
Upthread we have someone boasting about naming their business machines after porn stars.
Re:Things I Learnt from a Senior Software Engineer by lacampbell on Sunday August 25, 2019 @10:36PM (#20797049)
Why does that bother you so much?
Re:Things I Learnt from a Senior Software Engineer by jchook on Sunday August 25, 2019 @09:28PM (#20796844)
I had to learn the hard way
Re:Things I Learnt from a Senior Software Engineer by Moru on Monday August 26, 2019 @05:53AM (#20798505)
I worked with home support for an ISP. A few times I was at a customer helping with a router and the mother call her son to get the password for the router. Not always a nice password...
Re:Things I Learnt from a Senior Software Engineer by philwelch on Monday August 26, 2019 @01:02PM (#20801538)
I very much believe in offensive passwords/passphrases (maybe not for wireless routers) specifically because:

(a) You're not supposed to tell anybody what they are.

(b) Offensive passphrases are easier to remember.

Re:Things I Learnt from a Senior Software Engineer by ses1984 on Monday August 26, 2019 @05:04PM (#20803762)
Also easier to crack if an attacker knows that detail.
Re:Things I Learnt from a Senior Software Engineer by philwelch on Tuesday August 27, 2019 @01:08AM (#20806497)
Not that it narrows it down that much.
Re:Things I Learnt from a Senior Software Engineer by ses1984 on Tuesday August 27, 2019 @09:20AM (#20809255)
You could probably throw out 90% or more of dictionary words for your permutations, I'd say that is significant enough to paint a target on your back.
Re:Things I Learnt from a Senior Software Engineer by philwelch on Tuesday August 27, 2019 @08:46PM (#20815859)
If your password is derived from a four word phrase (per the XKCD formula, which isn’t the only one), potentially all of the individual words could be inoffensive in isolation. There’s no obvious way to operationalize the human intuition of offense in a way that restricts the search space if you’re smart about it.
Re:Things I Learnt from a Senior Software Engineer by ses1984 on Tuesday August 27, 2019 @09:31PM (#20816098)
It all depends on if you have anything worth cracking. Sure, if your average hn reader encrypts a password db with a dirty four word phrase, that reader will be fine because no one is willing to rub two pennies together to crack that.

On the other hand if you're protecting secrets actually worth something...

Re:Things I Learnt from a Senior Software Engineer by philwelch on Wednesday August 28, 2019 @06:57PM (#20824926)
Hey, for all you know I might find certain seemingly random 128-character alphanumeric strings very offensive ;)
Re:Things I Learnt from a Senior Software Engineer by ses1984 on Wednesday August 28, 2019 @07:49PM (#20825285)
Seemingly random isn't random.
Re:Things I Learnt from a Senior Software Engineer by GrayTextIsTruth on Sunday August 25, 2019 @09:43PM (#20796881)
why not? best kind of humor
Re:Things I Learnt from a Senior Software Engineer by mikekchar on Sunday August 25, 2019 @11:00PM (#20797142)
I do work for a golf travel company. In my test code I have the fictional golf resort, "Fine UK Up-scale Resort", due to the way we sometimes abbreviate names. I was doing a presentation to management the other day, and which test data decided to pop up on my screen? I laughed, anyway... I don't think some other people were please ;-) Especially as a contractor, making sure management is pleased with you is normally job one...
Re:Things I Learnt from a Senior Software Engineer by newshorts on Sunday August 25, 2019 @11:46PM (#20797325)
I agree on the aspect of professionalism. I wouldn’t go so far as to say never. Maybe there is some situation out there where it’s appropriate and understandable. I’ve just never seen it ;)
Re:Things I Learnt from a Senior Software Engineer by WatchDog on Sunday August 25, 2019 @07:30PM (#20796344)
I for one appreciate good humour in a codebase.
Re:Things I Learnt from a Senior Software Engineer by lonelappde on Sunday August 25, 2019 @07:34PM (#20796376)
Ah, but do you appreciate bad humour?
Re:Things I Learnt from a Senior Software Engineer by WatchDog on Monday August 26, 2019 @05:29AM (#20798421)
No not really, but I also don't appreciate bad code, and I encounter a vast amount more bad code than I do bad humour in the course of my work.
Re:Things I Learnt from a Senior Software Engineer by nojvek on Monday August 26, 2019 @12:20AM (#20797442)
I mean you can be plenty funny. Just not in naming things. My elaborate rants as comments on some parts of system have a bit of humor or sarcasm in them. I guess it’s a team thing. Our codebase has been built over time and has a number of hilarious comments.
Re:Things I Learnt from a Senior Software Engineer by pradiptasarma on Monday August 26, 2019 @12:32AM (#20797479)
Exactly, the following is fine:

  try {
    ...
  } catch (Exception up) {
    ...
    throw up; //hehe
  }

The GodComponent as a name is not.
Re:Things I Learnt from a Senior Software Engineer by PopeDotNinja on Sunday August 25, 2019 @06:59PM (#20796202)
I enjoy seeing a bit like of humor in the code, especially silly-but-clear comments and names less important parts of code. For a one shot task, why name it ScheduledObjectStorageDownloader when you can name it AutoCloudStorageFileYoinker?!
Re:Things I Learnt from a Senior Software Engineer by OJFord on Sunday August 25, 2019 @07:44PM (#20796422)
Because someone might grep for 'schedule' or 'download' but, quite reasonably, not think of 'autocloud' or 'yoink'?
Re:Things I Learnt from a Senior Software Engineer by richardxia on Sunday August 25, 2019 @07:40PM (#20796401)
While I'm not 100% against humor in a codebase, ever since my company started hiring more engineers internationally, I've become more tuned in to whether a name that uses slang like "yoinker" will be understood by someone who doesn't know English as a first language.
Re:Things I Learnt from a Senior Software Engineer by sundvor on Monday August 26, 2019 @10:19AM (#20800046)
I've been using English as my first language for nearly 20 years and am unfamiliar with "yoinker".

Just googled it and, ... nah, I wouldn't approve that PR!

(Have never heard it used down here in Australia. We've got plenty of other sayings that are local to us though.)

Re:Things I Learnt from a Senior Software Engineer by PopeDotNinja on Monday August 26, 2019 @07:21PM (#20804708)
Hehe, I never googled yoinker until just now. I originally heard it on The Simpsons. Here's a SFW Simpsons supercut of "yoink":

https://youtu.be/CJh1hmmLLzw

I suspect there are a lot of words that used to be safe that are less so now :P

Re:Things I Learnt from a Senior Software Engineer by PopeDotNinja on Monday August 26, 2019 @01:40AM (#20797686)
That is a fair point.
Re:Things I Learnt from a Senior Software Engineer by jpz on Sunday August 25, 2019 @10:53PM (#20797114)
100% with you on this. I find the replies to your comment here remarkable.

Namings should be descriptive not idiosyncratic.

It might be just like the guy I spoke to last month that said he just makes everything public when writing Java. Some people can have opinions that differ from best practice, it doesn't justify them, however.

Express your personality when you speak to people face to face, tell a joke, make witty observations at lunch, or in a code review meeting, don't express your personality in manifest idiosyncracies in your comments and code.

Re:Things I Learnt from a Senior Software Engineer by mawburn on Tuesday August 27, 2019 @02:07PM (#20812697)
I used to name projects of funny names, but then I started realizing that I had no idea what other people's cute names were for their projects.

We have one in our company named right now named Harbinger, neat name... but wtf is it? Boring names are boring, but they tell other people, and future you, what they are or do.

Re:Things I Learnt from a Senior Software Engineer by paxys on Sunday August 25, 2019 @11:13PM (#20797183)
Yeah, seriously. People use the "it was just a joke" argument for so many stupid things. Realize that there are people here whose sense of humor is very different from yours and this inside joke is likely going to cause confusion or conflict.