Live data from Hacker News

Things I Learnt from a Senior Software Engineer

neilkakkar.com

251–260 of 301 posts

Re: Things I Learnt from a Senior Software Engineer

#251

Earlier quoted context omitted.

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

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.

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

#252

Earlier quoted context omitted.

But surely there's ways of doing that without making people lose their focus.

Actually, is there?

Yes, you pick the moment (much) better than wandering over to peek over their shoulder when 'something interesting is going on'. IMO that's exactly when you don't, ask them about it later.

To borrow from that cringeworthy scene in The Social Network: He's wired in!

Re: Things I Learnt from a Senior Software Engineer

#253

Earlier quoted context omitted.

Every time someone trots out that old analogy, I think of my uncle who has a small dairy farm in the U.S. midwest with over 50 head of cattle. He gave each one a name, and when one is sick, he cares for it until it is better if possible.

I know of a man with over 50 children. I'm friendly with his neighbour, who has almost 40. 50 is a number that a human can still care for and love each one individually. NB: Yes, I know that the Wikipedia list of "people with many children" makes 50 look like a record-breaking number. That list is Western-centric. Though 50 is a huge number of children even by Arab standards, it is not unheard of.

If you can have four wives, 50 children is only about 12/13 per wife, and 12/13 kids seems like a high-but-achievable number in our monogamous culture. So I find that very believable.

Re: Things I Learnt from a Senior Software Engineer

#254
post #198
post #106

Earlier quoted context omitted.

I had to learn the hard way

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

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

#255

Just to toss in my two cents about testing: Unit tests are for refactoring and declaring behaviour. Additionally, a lot of people have made the same observation: Code that is easy to unit test tends to be more modular and have better architecture. If you are struggling to test a function, think about how you can change your design to make testing easier. It will probably improve your code quality. Integration tests a…

I have heard this so many times: > Comments: I find comments, outside of docstrings, a smell. But is this really the case? I find comments like these invaluable: /* * Mark walreceiver as running in shared memory. * * Do this as early as possible, so that if we fail later on, we'll set * state to STOPPED. If we die before this, the startup process will keep * waiting for us to start up, until it times out. */ SpinLock…

An example straight from a new hire's code review a few weeks ago:

  // foo = 12345

  doThing1(12345, 5) // foo
  doThing2(12345, 8) // foo
Preferring self-descriptive code instead of comments helps stop them from doing things like this.

Re: Things I Learnt from a Senior Software Engineer

#256

Earlier quoted context omitted.

Error message phrasing should not be in code. It should be in localization files, even for the default language, and not require a developer to modify.

Depends on the requirements. I've had many internal-only applications only require one language: English. At that point you can hard code many things, which skips the loading other files, checking different languages, etc.

I'd still rather the exact wording isn't in code, personally:

    get_msg('fail_add_address')
vs.

    'I\'m sorry, we\'ve been unable to add the address %s at this time,' \
    ' please try again later.'
(... but that's an ideal I have without ever having worked with it, so what do I know, and ymmv, etc.)

Re: Things I Learnt from a Senior Software Engineer

#257
post #99
post #81

> in my team culture it’s not frowned upon to “snoop behind” people writing code. Whenever I sensed something interesting going on, I’d roll around and watch what was happening. Agh, I'd hate that. In fact if anything interesting had been going on on my screen it would immediately stop, no way I could work with someone watching. I struggle enough at desks with my back to a door or where people walk by, just can't sto…

I've read that in feng shui what you describe is called the "command position". I'm not able to work with my back to a crowd. That's a recipe for anxiety. I quit a company when they moved my desk so my back was to a hallway, and refused to compromise on this issue in any way.

> I've read that in feng shui what you describe is called the "command position".

Thanks - now you say it, I think I've heard that before. (Perhaps from my father, who I know 'suffers' from the same.)

And in fact, when working from home (nobody around so it's not about being in 'command' of others at all, as a quick search tells me it isn't in feng shui either) I often prefer to sit at a table where I can see down the corridor to the front door.

Or when it's hot, on the balcony (as I am now) sitting back from the table such that my back's to the corner and my peripheral vision covers both out over the balcony to outside, and through the windows into my flat.

...interesting. It's totally sub-conscious - I always know where I want to sit in a room, or at a table in a restaurant, etc. it doesn't require thought but it certainly isn't random. I don't think about it while sitting down, but I'm sure if you asked me afterwards why I was sitting there I could tell you.

Re: Things I Learnt from a Senior Software Engineer

#258
post #99
post #81

> in my team culture it’s not frowned upon to “snoop behind” people writing code. Whenever I sensed something interesting going on, I’d roll around and watch what was happening. Agh, I'd hate that. In fact if anything interesting had been going on on my screen it would immediately stop, no way I could work with someone watching. I struggle enough at desks with my back to a door or where people walk by, just can't sto…

I've read that in feng shui what you describe is called the "command position". I'm not able to work with my back to a crowd. That's a recipe for anxiety. I quit a company when they moved my desk so my back was to a hallway, and refused to compromise on this issue in any way.

I startle very easily, especially if I'm snuck up on from behind, so if anyone comes up behind me, I unintentionally scream loudly as soon as I notice them. I have found that this tends to discourage that sort of behavior.

Re: Things I Learnt from a Senior Software Engineer

#259

Earlier quoted context omitted.

Naming standards are the ultimate bikeshedding event. Everyone has an opinion and camps develop for various schemes. The last time this happened, I happened to be in a position of influence for the final decision for naming standards. We took an approach designed to piss off everyone... license plates. We used sequential numbers prepended by a pronounceable string, and random words, selected by a system, for internal…

I'm in Denmark, it has been my experience that the most common naming scheme (I would say omnipresent naming scheme almost) is to use the old Norse Pantheon for names.

In Colorado, USA, all 5 companies I've been inside conference rooms of use specific mountains (or ski towns) in the area. I've been in meetings in Longs Peak in 3 different companies.

Re: Things I Learnt from a Senior Software Engineer

#260
post #82

Earlier quoted context omitted.

What's wrong with the spelling? He's from the UK.

I don't know what GP has a problem with, but I don't think the author's British - 'internalize' in the opening paragraph.

Probably "learnt" vs "learned".
Post reply on HN