- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
I assume that the CS grad has nothing indicating programming experience. (This is questionable given co-op programs. Or, it could mean that he could not even get a co-op job.)
The EE grad looks promising because of the experience, but he may only have worked on small one-man projects. This might not be enough. I would grill him gently to establish his limits. If he answered sensibly, he would get serious consideration.
Sincerely,
Gene Wirchenko
Admin
APL has no operator precedence and is evaluated right-to-left.
Sincerely,
Gene Wirchenko
Admin
How does that relate to what I posted and you quoted?
Sincerely,
Richard Nixon
Admin
For those organisations, the degree trumps everything and the ability to code is secondary. So, while probably all people here agree
that the ability to code is the most important quality of a candidate, no one should expect that every employer thinks the same way.
Admin
WTF? It's a rule that that AND is evaluated before OR. Always has been.
Admin
But I never said that all employers have that line of thought, did I? I was stating my personal opinion. Why post your statement as if you're refuting something I said?
Sincerely,
Richard Nixon
Admin
Actually, there is no precedence--a statement that combines AND and OR without using parentheses is considered ambiguous and should be better defined. That's why different languages can use different interpretations. If your logic is ambiguous, that's not your biggest problem....
Admin
On an almost similar topic, I just had to share this little beauty I found in a trigger.
SELECT Count(*)
FROM inserted
WHERE NOT (Not [column] Is Null)
What kind of warped mind writes shit like that?
Admin
For C-like languages, including PHP, AND evaluates before OR.
http://www.php.net/manual/en/language.operators.php#language.operators.precedence
Admin
In math there is precedence. Boolean algebra is a system where the numbers are {0,1}, and it is defined that 1 + 1 = 1. Therefore and AND is a multiplication expression and OR is an addition expression, NOT is usually indicated by a tick after the symbo1, similar to an exponent. So, unless parenthesis modify the precedence explicitly, NOT is evaluated first, then AND, then OR.
Most, but not all, common programming language implement these same precedence rules. However, it is NEVER a WTF to explicitly indicate evaluation order with parenthesis even if it is redundant.
Admin
Fine, prepend a "assuming 0 = false" to my post.
Admin
I guess that's why I have a math degree. In basic logic, it's ambiguous unless you use parentheses--I checked my textbooks. In Boolean algebra, there are operator precedence rules. And your quick definition of Boolean algebra is severely lacking.
I always clarify code logic with parentheses. It's just good style.
Admin
You misspelled "avaiableCredit".
Admin
No, that's your hypothesis. I'm very sorry but ever since religious ignoramuses started to run around shouting "Evolution is only a theory!", I regard the misuse of this word as a serious offense.
Admin
Off topic, but I agree.
If “intelligent design” is accepted into biology, then we should just begin applying its logic to everything. Any math that is more complicated than simple addition, subtraction, multiplication and division should be declared false because “it’s too complex to be true”. Same goes for physics, engineering and every other discipline. Heck, I’ve even rejected the idea that light waves can be scanned to create electrical impulses, which are turned into radio waves, transmitted across long distances and then demodulated to produce a picture. I now believe that little people live inside my TV set.
Admin
What is the physical punishment that you dole out for violations? Karate chop to the melon? Groin kick? Please, enthrall me with tales of your might. Also, do you have any type of superhero costume that you wear? Because if not, I'd be willing to shell out some money to get you one - custom, of course.
Sincerely,
Richard Nixon
Admin
<FONT face="Courier New" size=2>pay-per-view homonculi have the worst jobs.</FONT>
Admin
Fascinating - there doesn't even seem to be a name for this flaw in your logic. It's certainly an instance of failing to take the probability of a prerequisite into account, but it's not the prosecutor's fallacy. Maybe we should just christen it the CS degree fallacy?
Seriously, given that much less than 50% of the population has a CS degree, 50% of all good programmers having a CS degree sounds like a damn good ratio to me.
Admin
The selectivity typically matters more than the clock cycles for the individual check. If overrides are rare, the selectivity of $hasOverride is very low. The selectivity of the and-expression should typically be much higher.
Admin
Why don't you get a life and/or a penis enlargement and leave me alone? If you ever posted to Usenet, you won't have any troubles finding someone who can help you with that. (At least with the latter option, the first seems hopeless.)
Admin
The dude has a degree - assuming he took even one programming class, mathematics class, or philosophy class, he has no excuse.
Even my very first projects (wherein I demonstrate the fact that I've learnt about lists but not dictionaries) indicate that I know how to use Boolean logic, and I have no degree, never finished high school.
Admin
I'll just clarify that I'm quite jealous that people with degrees and no skill can get programming jobs whereas I, having some modicum of skill (and certainly more than this fella), cannot get a programming job, on account of no degree...
Admin
Ah, but is your method portable to systems with core memory? I didn't think so!
Admin
"You should have used tabs instead of spaces."
Admin
I thought it was "salted-hash, vulnerable to dictionary attack, shadow password file".
Admin
It's implicit.
Admin
Perhaps that's part of the joke? Slashdot moderators are notorious for being dim-witted.
Admin
#2 can't be it, after all, without locking that would make no difference.
Admin
I think
2 = false
ß = true
= AND
% = OR
Admin
You can't say, because 'and' and 'or' operations are completely complementary. In other words f(a,b) = !f(!a,!b) where f() implements 'and', 'or'.
This might catch a programmer off guard, simply because he may never have had reason to think about it. Anyone who has designed discrete logic circuits, however, knows this pretty intimately.
Admin
There are two possible solutions, but your answer is not a correct one. To get a correct answer, eighter replace FALSE and TRUE, or replace AND and OR.
Admin
Naah. I bet the "programmer" (use the term loosely) WAS a CS major. Probably studied Computer Architecture....
Why would he insert redundant operations? To increase the IPC number of executed (Instructions per cycle)... (Better utilization of processor's functional units)
One misbelief is that programs with high IPC are necessarily better than those with low IPC....
Admin
Hear here!
I see lots worse than this - at least it works. And, given that it's PHP, who cares about 1-2 clock cycles to set the redundant assignment?
This does not qualify as WTF code, just immature.
Admin
I gotta disagree with you on this one. The code, as written, is much more readable and self-documenting then a single line, complex boolean algebra statement. The Phrase: if ($ticketAmount < 1000) $canProcess = true;
Tells you something about the business meaning of ticketAmount being less then 1000.
The Phrase: if (ticketAmount < 10000 && $avaiableCredit >= $ticketAmount || $hasOvverride) Is much too terse and difficult to read at a glance.