Comment On Deterministic Programming

There is a lot of uncertainty in the life of every developer. How will this section of code interact with that section? What if the network goes down? What if a gamma ray flips that bit? What's mom making for dinner? Does radon have a smell? [expand full text]
« PrevPage 1 | Page 2Next »

Re: Deterministic Programming

2007-05-01 09:05 • by nickhead (unregistered)
wow

Re: Deterministic Programming

2007-05-01 09:06 • by Phreakbert (unregistered)

if (postIndex == 0)
{
System.out.println("Frist psot!");
}
else
{
System.out.println("Frist psot!");
}

Re: Deterministic Programming

2007-05-01 09:10 • by lazybutregistereduser (unregistered)
blame the submitter, not the poorly-designed viewer you chose to use. WTF?

Re: Deterministic Programming

2007-05-01 09:10 • by Welbog
134375 in reply to 134373
That was pretty good. Too bad you weren't first, though.

Re: Deterministic Programming

2007-05-01 09:11 • by vt_mruhlin
What does the + @ do in JavaScript? Robust parameters or something?

Re: Deterministic Programming

2007-05-01 09:24 • by bonzombiekitty
sheeesh. not only is the first one an "are you sure", it's a completely useless if statement. I can understand making a seperate function for it because it's clearer, and takes less typeing if you need to call it multiple times, but why bother with an if statement in the first place if you are going to return the table if it's null or not. Just do a

return document.getElementById('" + gridPanelTable.ClientID + @"')

Re: Deterministic Programming

2007-05-01 09:42 • by Publius (unregistered)
The last example is foolish. It looks the programmer was just trying to remind themselves to add code to these sections later. How is that bad?

Re: Deterministic Programming

2007-05-01 09:44 • by I4,5 (unregistered)
file_exists() will be cached, so even if you deleted the file in middle of the check, it won't check it's real file existance...

Re: Deterministic Programming

2007-05-01 09:48 • by snoofle (unregistered)
134384 in reply to 134373
No no no! You're all missing the point. This is part of a threaded system, and the multiple checks take long enough that the requested resource exists by the second time around!
</sarcasm>

Re: Deterministic Programming

2007-05-01 09:51 • by ewww (unregistered)
And why does it bother you if we submit something with the same title as a previous article?

Re: Deterministic Programming

2007-05-01 10:06 • by Vischar
134386 in reply to 134385
ewww:
And why does it bother you if we submit something with the same title as a previous article?


Who cares? Maybe just do what he asks to increase your chances of getting your submission read... or don't and get your submission overlooked.

*shrug*

Re: Deterministic Programming

2007-05-01 10:13 • by mrprogguy
There has to be a problem in the transcription of the JavaScript, because what I'm seeing should always return null (given a rational analysis of the argument to the getElementById call).

The problem is that

document.getElementById('" + gridPanelTable.ClientID + @"')


queries for an element called

" + gridPanelTable.ClientID + @"

and I refuse to believe that someplace in the HTML you'd find

<table id='" + gridPanelTable.ClientID + @"' class="gridTable">


Could it be that the transcription is missing some quotes? Or should that be

document.getElementById(gridPanelTable.ClientID + "@")
?

Re: Deterministic Programming

2007-05-01 10:13 • by madjo
134388 in reply to 134386
Vischar:
ewww:
And why does it bother you if we submit something with the same title as a previous article?


Who cares? Maybe just do what he asks to increase your chances of getting your submission read... or don't and get your submission overlooked.

*shrug*
So for one to submit a new entry that person is supposed to know the title of every story on this site?
I'm all for less work for the editors, but don't expect the impossible!

Re: Deterministic Programming

2007-05-01 10:17 • by David Oster (unregistered)
In the cute prose header for this article, the author refers to "pi-calculus". Surely, this is the wrong greek letter, and he meant "lambda-calculus".

Re: Deterministic Programming

2007-05-01 10:23 • by [twisti] (unregistered)
134391 in reply to 134389
With quality CodeSOTDs like "OMG LOLZ LOOK HE WROTE THE IF WRONG ROFFLZ!" I can certainly see why he would skip submissions based on their title.

Re: Deterministic Programming

2007-05-01 10:23 • by headshit (unregistered)
This isn't a What The Fuck.
A What The Fuck, is some dumbass claiming that "doubleyou-tee-eff" was offensive to his senile grandma, and that "Worse Than Failure" makes a lick of fucking sense.

Re: Deterministic Programming

2007-05-01 10:24 • by Vischar
134393 in reply to 134388
madjo:
Vischar:
ewww:
And why does it bother you if we submit something with the same title as a previous article?


Who cares? Maybe just do what he asks to increase your chances of getting your submission read... or don't and get your submission overlooked.

*shrug*
So for one to submit a new entry that person is supposed to know the title of every story on this site?
I'm all for less work for the editors, but don't expect the impossible!


I doubt he would mention it if it was a problem that was happening every now and then coincidentally.

Coming up with a name for your submission that hasn't been used in a previous article (even if you didn't have a list of previous articles) would be a horrible plot for Mission Impossible 4... Tom Cruise is probably crazy enough to take it tho...

Re: Deterministic Programming

2007-05-01 10:24 • by bobday
I think the first sample is actually a C# string in an ASP.NET page with the initial @" missing.

Re: Deterministic Programming

2007-05-01 10:27 • by CapitalT
134396 in reply to 134389
David Oster:
In the cute prose header for this article, the author refers to "pi-calculus". Surely, this is the wrong greek letter, and he meant "lambda-calculus".


Say what?

Don't talk out of your ass please.
(the comments page is worthless)

Re: Deterministic Programming

2007-05-01 10:27 • by Derrick Pallas
134397 in reply to 134385
ewww:
And why does it bother you if we submit something with the same title as a previous article?


Because I've got it cached as being done already.

Re: Deterministic Programming

2007-05-01 10:32 • by Derrick Pallas
134399 in reply to 134391
[twisti]:
With quality CodeSOTDs like "OMG LOLZ LOOK HE WROTE THE IF WRONG ROFFLZ!" I can certainly see why he would skip submissions based on their title.


Tomorrow, we're going to get a dozen emails with titles like "Deterministic Programming" and "Deterministic Programming Too!" where the submission is essentially one of the code snippets in today's article. There is a 50/50 that some of the text will be a paraphrase of something I've already written. The worse my prose is, the higher the chances.

Re: Deterministic Programming

2007-05-01 10:32 • by headshit (unregistered)
134400 in reply to 134397
Derrick Pallas:
ewww:
And why does it bother you if we submit something with the same title as a previous article?


Because I've got it cached as being done already.


Well gee, numbnuts -- seems there's a What The Fuck in your logic. How the shit is someone supposed to know if a title's been taken? Do a search every goddamned time?

Re: Deterministic Programming

2007-05-01 10:42 • by Misha (unregistered)
134402 in reply to 134400
Hmm, the URL of this article is http://worsethanfailure.com/Articles/Deterministic-Programming.aspx

So if (speaking purely hypothetically) I wanted to submit one titled "headshit is a brainless prat", perhaps I could type http://worsethanfailure.com/Articles/Headshit-Is-A-Brainless-Prat.aspx into my address bar?

Wow, that must have taken me almost 20 seconds. I better go have a lie down.

Re: Deterministic Programming

2007-05-01 10:48 • by Vischar
134403 in reply to 134402
Misha:
Hmm, the URL of this article is http://worsethanfailure.com/Articles/Deterministic-Programming.aspx

So if (speaking purely hypothetically) I wanted to submit one titled "headshit is a brainless prat", perhaps I could type http://worsethanfailure.com/Articles/Headshit-Is-A-Brainless-Prat.aspx into my address bar?

Wow, that must have taken me almost 20 seconds. I better go have a lie down.


Bravo!

Wow, 20 seconds... headshit types slow...

Re: Deterministic Programming

2007-05-01 10:49 • by headshit (unregistered)
134404 in reply to 134402
Misha:
Hmm, the URL of this article is http://worsethanfailure.com/Articles/Deterministic-Programming.aspx

So if (speaking purely hypothetically) I wanted to submit one titled "headshit is a brainless prat", perhaps I could type http://worsethanfailure.com/Articles/Headshit-Is-A-Brainless-Prat.aspx into my address bar?

Wow, that must have taken me almost 20 seconds. I better go have a lie down.


huh? It took you almost 20 seconds to do something that has nothing to do with my point? score!

Re: Deterministic Programming

2007-05-01 10:53 • by Vischar
134405 in reply to 134404
headshit:
Misha:
Hmm, the URL of this article is http://worsethanfailure.com/Articles/Deterministic-Programming.aspx

So if (speaking purely hypothetically) I wanted to submit one titled "headshit is a brainless prat", perhaps I could type http://worsethanfailure.com/Articles/Headshit-Is-A-Brainless-Prat.aspx into my address bar?

Wow, that must have taken me almost 20 seconds. I better go have a lie down.


huh? It took you almost 20 seconds to do something that has nothing to do with my point? score!


You had a point?!

*Irish Accent* Brilliant!

Re: Deterministic Programming

2007-05-01 11:17 • by iToad (unregistered)
The third example is a new way to write provably correct software. No code, no bugs.

Re: Deterministic Programming

2007-05-01 11:18 • by Ibn al-Hazardous (unregistered)
134413 in reply to 134381
Publius:

The last example is foolish. It looks the programmer was just trying to remind themselves to add code to these sections later. How is that bad?


Well, did the programmer remember to add code to these sections?

I find that putting

// TODO: If you find this comment in live code - I'll by you a beer
// ibn@whatever.com

is a lot more effective.

You'll be surprised to discover how many people grep your code for the keyword "beer"...

Re: Deterministic Programming

2007-05-01 11:38 • by LintMan (unregistered)
I'd bet in all of these cases that originally the code had a different conditional for one of the cases (and code in the braces in the third). Then things got munged (or removed) during the debug process and never cleaned up.

That's really lousy programming, but not really WTF-class, IMHO. I doubt the original coder was trying for the "are you sure?" effect or the "condition branches that have no effect" effect, which is what the into implies.

Re: Deterministic Programming

2007-05-01 12:15 • by anonymous (unregistered)
134445 in reply to 134423
LintMan:
I'd bet in all of these cases that originally the code had a different conditional for one of the cases (and code in the braces in the third). Then things got munged (or removed) during the debug process and never cleaned up.


Especially in the BatchProcessor.ProcessBatch() case, this might be an attempt to avoid changing lines (and thus being the one people go to when that code has problems). In fact, if you do an annotate of only the latest version, whoever took code out of those branches doesn't show up at all. Brillant!

Re: Deterministic Programming

2007-05-01 13:44 • by BAReFOOt (unregistered)
WTF has Firfox to do with you Mail allachments? DO you know the difference between a mail client and a browser?
(Don't tell me about wembailers. Imagining Alex being such a noob that he uses webmailers for his submissions either lets eider me burst out in tears or my head explode to paint the walls. ;)

Re: Deterministic Programming

2007-05-01 13:48 • by mattnaik (unregistered)
134469 in reply to 134392
headshit:
This isn't a What The Fuck.
A What The Fuck, is some dumbass claiming that "doubleyou-tee-eff" was offensive to his senile grandma, and that "Worse Than Failure" makes a lick of fucking sense.


seriously, get over it already.

Re: Deterministic Programming

2007-05-01 14:06 • by Malfist (unregistered)
134475 in reply to 134469
mattnaik:
headshit:
This isn't a What The Fuck.
A What The Fuck, is some dumbass claiming that "doubleyou-tee-eff" was offensive to his senile grandma, and that "Worse Than Failure" makes a lick of fucking sense.


seriously, get over it already.


Really, moron.

Re: Deterministic Programming

2007-05-01 14:29 • by Derrick Pallas
134484 in reply to 134466
BAReFOOt:
WTF has Firfox to do with you Mail allachments? DO you know the difference between a mail client and a browser?


I don't know what an allachment is but maybe you've heard of Gmail.

Re: Deterministic Programming

2007-05-01 15:20 • by BradleyS
134491 in reply to 134392
headshit:
This isn't a What The Fuck.
A What The Fuck, is some dumbass claiming that "doubleyou-tee-eff" was offensive to his senile grandma, and that "Worse Than Failure" makes a lick of fucking sense.


Hmm...red title bar, by Derrick Pallas...you know, I do believe you're right. It's NOT a WTF. It's a CSOD, which you'd realize if you were here for any reason other than to complain about a minor name change to the site.

Re: Deterministic Programming

2007-05-01 15:38 • by bah (unregistered)
Typically you see code like this mostly because of bad integrations using source control. The auto-merge function isn't all that smart and bad checkin policy could cause things like this to be missed

Re: Deterministic Programming

2007-05-01 16:07 • by Eric (unregistered)
These likely aren't WTFs but are just the result of someone doing a copy paste and forgetting to change what he pasted. I 've done this many times, but I usually find it before checking the code in.

Re: Deterministic Programming

2007-05-01 17:41 • by psiphiorg
134507 in reply to 134491
BradleyS:
Hmm...red title bar [...] It's a CSOD
What red title bar? The titles on:
http://worsethanfailure.com/Articles/Deterministic-Programming.aspx
and:
http://worsethanfailure.com/Comments/Deterministic-Programming.aspx
are both grey on white, just like any other page. Not a drop of red to be seen, other than in the site logo, which appears to always be red.

The moral of the story is either (a) Don't assume people read these from the front page, or (b) Maybe the article page titles should be displayed in the same color as they appear on the front page, depending on whether you're a reader or a site admin.

davidh

Re: Deterministic Programming

2007-05-01 17:51 • by FredSaw
Here's how that javascript really went down.

System.Text.StringBuilder sb = new System.Text.StringBuilder(5000);
sb.Append(@"function GetGridTable()");
sb.Append(@"{");
sb.Append(@" if (document.getElementById('" + gridPanelTable.ClientID + @"') != null)");
sb.Append(@" {");
sb.Append(@" return document.getElementById('" + gridPanelTable.ClientID + @"');");
// ...etc.
sb.Append(@"}");
Page.RegisterClientScriptBlock(sb.ToString());

Re: Deterministic Programming

2007-05-01 17:57 • by Joseph Newton (unregistered)
134510 in reply to 134387
mrprogguy:
There has to be a problem in the transcription of the JavaScript, because what I'm seeing should always return null (given a rational analysis of the argument to the getElementById call).

The problem is that

document.getElementById('" + gridPanelTable.ClientID + @"')


queries for an element called

" + gridPanelTable.ClientID + @"

and I refuse to believe that someplace in the HTML you'd find

<table id='" + gridPanelTable.ClientID + @"' class="gridTable">


Could it be that the transcription is missing some quotes? Or should that be

document.getElementById(gridPanelTable.ClientID + "@")
?



Thanks. I was beginning to worry that there was some major gap in my awareness of syntax. If so, at least I'm in sane company.

Re: Deterministic Programming

2007-05-01 18:12 • by Faxmachinen
134512 in reply to 134484
Derrick Pallas:
I don't know what an allachment is but maybe you've heard of Gmail.

How charming. Say, you haven't considered getting a real email account?

Re: Deterministic Programming

2007-05-01 18:15 • by Joseph Newton (unregistered)
134513 in reply to 134466
BAReFOOt:
WTF has Firfox to do with you Mail allachments? DO you know the difference between a mail client and a browser?
(Don't tell me about wembailers. Imagining Alex being such a noob that he uses webmailers for his submissions either lets eider me burst out in tears or my head explode to paint the walls. ;)


Perhaps Alex values his operating system and mail archive. Webmail is actually a very effective means of pre-filtering mail before it enters your local machine. Given that AV software is wont to do brilliant favors for the user, such as quarantining an entire mail file because one message happens to have a virus attachment, this can save a lot of time and trouble.

I've been doing this for about 18 months now, and I just wish I had started years earlier.

Re: Deterministic Programming

2007-05-01 18:46 • by Jon (unregistered)
134517 in reply to 134374
lazybutregistereduser:
blame the submitter, not the poorly-designed viewer you chose to use. WTF?
Sending it as an attachment introduces an extra step before Derrick can view the submission and has no advantages. A little common sense goes a long way.

Re: Deterministic Programming

2007-05-01 19:00 • by Anonymous (unregistered)
134519 in reply to 134386
Vischar:
Who cares? Maybe just do what he asks to increase your chances of getting your submission read... or don't and get your submission overlooked. *shrug*


People aren't going to jump through hoops and adhere to multiple arbitrary criteria in a fairly small, informal community. If Alex starts discarding stuff, that's his prerogative, but don't expect people to care.

Re: Deterministic Programming

2007-05-01 20:06 • by Vischar
134525 in reply to 134519
Anonymous:
Vischar:
Who cares? Maybe just do what he asks to increase your chances of getting your submission read... or don't and get your submission overlooked. *shrug*


People aren't going to jump through hoops and adhere to multiple arbitrary criteria in a fairly small, informal community. If Alex starts discarding stuff, that's his prerogative, but don't expect people to care.


Thanks... that's exactly why my post started with "Who cares?"

Re: Deterministic Programming

2007-05-02 06:39 • by Anonymous (unregistered)
>... is a good way to convince me to not look at the submission...

The WTF is that, on the submission page, it's written "I do, however, read every message."

Re: Deterministic Programming

2007-05-02 07:31 • by Rank Amateur
Code like this could be simplified with a properly designed language. I've long argued for a Really Equivalent operator. I suggest ===. That of course also allows for the !== operator, which means "equivalent but not really equivalent," not to be confused with !!=, which means "really definitely not equivalent."
--Rank

Re: Deterministic Programming

2007-05-02 09:01 • by KenW
134561 in reply to 134385
ewww:
And why does it bother you if we submit something with the same title as a previous article?


I don't know... Why does it bother me when people ask stupid questions?

Re: Deterministic Programming

2007-05-02 09:12 • by TheJasper
134562 in reply to 134554
Anonymous:
>... is a good way to convince me to not look at the submission...

The WTF is that, on the submission page, it's written "I do, however, read every message."


Yes, but for the one's with title's he's seen before he prints the out in braille and then reads with his hands. He still doesn't look at it though. ;}

I would like to say that the somewhat hostile tone and rude language that some people insist on using is really annoying. There is no need to be insulting, except sometimes as a joke. I wouldn't mind at all for such posts to be removed. It's not that I care about the language used but more the hostile intent.

Re: Deterministic Programming

2007-05-02 10:12 • by slapout (unregistered)
"Please stop doing that too."

Are you talking to submitters or Firefox?
« PrevPage 1 | Page 2Next »

Add Comment