The Register® — Biting the hand that feeds IT

Comments on: Safari practices self-love, claims code monkey

Better Code 

Posted Monday 2nd June 2008 13:30 GMT

Coat

"if (!event)" or "if (event === null)" are better alternatives.

Not new... 

Posted Monday 2nd June 2008 13:43 GMT

Bit of Googling reveals this was noticed a long time ago...

http://mrspeaker.webeisteddfod.com/2007/02/

Funny nonetheless.

really? 

Posted Monday 2nd June 2008 13:55 GMT

Happy

do people really get upset about "vulgar" code comments?

i find expressing my frustrations keeps me from wanting to act on them.

i'd rather some coder gets it out in code, rather than take it to his supervisor or family...

Got to be done 

Posted Monday 2nd June 2008 14:14 GMT

Happy

Love it. I often embed stuff in my comments which goes unnoticed even though the code is supposed to be reviewed. A former team leader of mine was surprised to find a quite long diatribe in some comments I made about a dodgy hack implemented because I was about to go on three weeks holiday and couldn't be arsed to do it properly (legacy app, being phased out - you know the score). Luckily, he's a mate and foubnd it rather amusing especially as he found it in a section he allegedly reviewed, 3 years after the event.

searching for code expletives and firefox 

Posted Monday 2nd June 2008 14:34 GMT

Linux

Curious, I did a search for file:\.js$ f[cu]{2}k firefox on google code search, the result was mainly people complaining about IE, though this searches open source apps and so there would be a tendency to blame the evil Redmondites for everything, quite right too.

Penguin, because I blame the evil Redmondites for most of my daily hassles too.

@first post 

Posted Monday 2nd June 2008 14:35 GMT

Boffin

well perhaps in some situations

but null and 0 are not always the same thing

Fucking IE 

Posted Monday 2nd June 2008 14:55 GMT

Gates Horns

...is probably my most often-used comment.

bored 

Posted Monday 2nd June 2008 15:23 GMT

Paris Hilton

How bored to you have to be before you start trawling the source of web sites for smutty comments?! I mean... come on. Surely you're not run out of porn.

Paris, just because.

Er… 

Posted Monday 2nd June 2008 15:32 GMT

Coat

… exactly how did Safari claim the code monkey in question?

Is it just me? 

Posted Monday 2nd June 2008 16:29 GMT

or is the (relatively non-existent)commenting of that whole piece of code a complete f*cking disgrace.

http://www.koders.com/javascript/fid82A0EBCC891CA06722493DA646BB09267D3E420D.aspx?s=fucking#L177

If i was reviewing that i would have taken one quick glance and sent it back without even checking further. I wouldn't care if it worked or not, it's a maintenance nightmare.

@bored 

Posted Monday 2nd June 2008 17:49 GMT

Paris Hilton

...one generally can't surf porn at work.

Ah, like the good old days ... 

Posted Monday 2nd June 2008 19:00 GMT

IT Angle

when compilers actually left comments embedded in the executable files!

Now, that was an eye-opener on the mindset of the programmers.

@ David Buckley 

Posted Monday 2nd June 2008 19:27 GMT

Alert

"but null and 0 are not always the same thing"

They are NEVER the same thing and should never be treated as such.

Chhhhrrrriiiii ....

I'm sorry ... 

Posted Monday 2nd June 2008 21:19 GMT

IT Angle

But if you dare to refer to yourself as a “programmer” and don't realise the difference between NULL and 0 you are officially sacked. Anywhere. In any language or in any discipline.

The difference is often a fine one but it is very important.

Please God: tell me I'm wrong.

How sad is it... 

Posted Monday 2nd June 2008 22:54 GMT

...that someone actually read the code deeply enough to find that comment?

Nerds!

Re: How sad is it… 

Posted Tuesday 3rd June 2008 00:12 GMT

Happy

Ah, but would he? grep and Google are the tools of choice for that kind of thing.

work? 

Posted Tuesday 3rd June 2008 00:38 GMT

Thumb Up

At El Reg, you can surf porn at work. See article where your dear reporter surfed porn with a city councilman. For ... research.

The correct answer... 

Posted Tuesday 3rd June 2008 01:52 GMT

Boffin

for the event test is actually NONE OF THESE:

if (!event)

if (event == null)

if (event === null)

I'll leave it to you to figure out why, and how to test properly. Remember to show your work.

The correct answer... 

Posted Tuesday 3rd June 2008 01:59 GMT

Boffin

Okay, here's a hint: for starters, you have to know the difference between 0 and null AND false AND undefined.

Code comments 

Posted Tuesday 3rd June 2008 05:03 GMT

Ahh, I remember the fun times at my old job. I pretty much documented all the bullshit that was going on that particular day - my boss's paycheque bouncing, and him then calling the beancounters and senior management"a bunch of useless tossers" was a frequent occurance.

I used to have conversations with our other devs in comment form. Most of them revolved around which torrents we should choke off the net connection with on that particular day, or which manager/beancounter was giving us the shits.

It was a very hostile workplace - devs + engineers vs senior managers + beancounters - which resulted in all the devs resigning on the same day, racking up a ginormous tab at the pub senior management favourited and leaving them to pay the bill.

Ahh...

I rember 

Posted Tuesday 3rd June 2008 08:23 GMT

showing somone how

null=null =false

@ Shell 

Posted Tuesday 3rd June 2008 09:41 GMT

Linux

Good call lol...

@J-Wick 

Posted Tuesday 3rd June 2008 11:20 GMT

I could.

All you need is a desk with your back to a corner where no-one is able to see your screen coupled with administrative control over the infrastructure (proxy server? I bypass your steeeeeenking poxy server).

Don't see the appeal in just *looking* at porn though. It would just eat into valuable commenting on El Reg stories time.

null 

Posted Tuesday 3rd June 2008 19:06 GMT

In C, null = 0 only if you're talking about a pointer. But don't EVER go on that assumption!!! Please!!!

Reminds me of that BOOL someone posted in the Daily WTF:

enum BOOL {

TRUE,

FALSE,

NOT_TRUE_OR_FALSE };

Extra points for those who notice how bad that is...

@ Daniel 

Posted Tuesday 3rd June 2008 21:08 GMT

Alert

You eloquently make my point.

This is seriously the type of shit I stumble over almost every week. Where do they GET these people and why do these people ever imagine a career in writing software for a living is their niche?

Ooo, C++ questions! 

Posted Tuesday 3rd June 2008 21:15 GMT

@Stephen Knox: "Okay, here's a hint: for starters, you have to know the difference between 0 and null AND false AND undefined."

Hrmmm... I'm rusty at this, but if I recall correctly--you're reffering to how the value is determined in terms of size and bit order (with the exception of NULL.) 0 is an actual integer, FALSE is a one-bit value, and UNDEFINED could pratically be *any* value/size (which is why you don't find this statement in good code, unless some numpty made it a global constant.)

Only NULL doesn't encapsulate any value/size, as it simply states "there is no defined value assigned to this variable." You can have some pointer remember some random address in memory and it'll return some gibberish based on the size of the variable it's using--it'll never return NULL because there's *always* something there.

@Daniel B.: "Reminds me of that BOOL someone posted in the Daily WTF"

Shouldn't it be "enum BOOL {FALSE, TRUE, NOT_TRUE_OR_FALSE }; based on bit order?

But, then again, this is a moot point; it's basically adding an actual '2' to raw binary '01' code. (Enums also don't take constants very well, as it's bad coding pratice to do so.)

Code Abuse 

Posted Thursday 5th June 2008 05:34 GMT

Thumb Up

I used to love adding comments to HTML that would potentially be 'seen' by everyone. I used to tell all sorts of people off, plus add witty quotes and jokes. No one ever found any of it. Oh, well, who said the life of a nerd was all excitement and danger?

@really? 

Posted Sunday 8th June 2008 05:31 GMT

Have we honestly arrived at the point where if aren't swearing in our code that the supervisor's family may have cause for concern? Because if that's the case it might be time for a long vacation :)

Null = 0 

Posted Monday 9th June 2008 14:31 GMT

Coat

when you refer to the contents of my wallet.

Oi, some bugger is going through my jacket to get my empty wallet

Don’t Miss