|
CocusArg wrote: 'in theory, it should never came here
I've learned that placing such a comment will make your code go to any lengths (apparently even changing variable values out-of-the-blue) to take that path...
Also, speaking of funny comments, my colleague found this little gem in a PHP script:
$i = $i + 1;
Full-fledged Java/.NET lover, full-fledged PHP hater.
Full-fledged Google/Microsoft lover, full-fledged Apple hater.
Full-fledged Skype lover, full-fledged YM hater.
|
|
|
|
|
What do you have against PHP? It's soooo easy to learn and it has been used for soooo many big projects.
At least artificial intelligence already is superior to natural stupidity
|
|
|
|
|
Yes, and at the same time, it makes it awwwwwwfully easy to code badly.
You can code badly in absolutely any language, but bad code written in PHP just.has.that.special.flavor.
[rant start]
Now, assume we have some code (PHP) along the lines of:
$invoice_no = 1;
$invoice_no = $invoice_no . 'INV_123#';
return $invoice_no;
Now, try to do this in Java for instance:
int invoice_no = 1;
invoice_no = invoice_no + "INV_123#";
return invoice_no;
The compiler would be all over the place, screaming like a newborn baby. And that's just off the top of my head.
And speaking of compiler and autocomplete, how about contructs like:
$invoice_no = 'Whatever';
return $invoiceno;
Or that you can't really enforce a type parameter on a method (of course, there's get_class, but you'll only know about it at runtime).
Or autocomplete. I'a big fan of autocomplete. Now, I've done PHP with both Eclipse and Netbeans. Try to get autocomplete for something like:
$db = DatabaseService::getInstance();
$line = $db->getPoLineById($line_id);
$product = $db->searchProduct('id', $line->getProductId());
Or debugging. var_dump, really? Now, I know there's XDebug, but try using that in a 4GB PHP project (I'm talking about a Magento website). Good luck with that.
[rant end]
Now, I do believe your remark was sarcastic. For being sarcastically funny, have a 5!
Full-fledged Java/.NET lover, full-fledged PHP hater.
Full-fledged Google/Microsoft lover, full-fledged Apple hater.
Full-fledged Skype lover, full-fledged YM hater.
|
|
|
|
|
Andrei Straut wrote: Now, I do believe your remark was sarcastic
Thanks. Indeed I don't jump off bridges just because it's especially easy on this particular bridge or many people have done so before. Not even the lemmings really do that.
I have started to ignore languages which are interpreted or are advertised as being especially noob-friendly on 8 bit machines. Especially the 'noob-unfriendly' things (like type safety) usually are supposed to help you and I have no interest in learning how to bypass them or constantly discussing why it's a bad idea to bypass them.
At least artificial intelligence already is superior to natural stupidity
|
|
|
|
|
CDP1802 wrote: Especially the 'noob-unfriendly' things (like type safety) usually are supposed to help you and I have no interest in learning how to bypass them
So true. Now, please do go and convince everyone of this.
Full-fledged Java/.NET lover, full-fledged PHP hater.
Full-fledged Google/Microsoft lover, full-fledged Apple hater.
Full-fledged Skype lover, full-fledged YM hater.
|
|
|
|
|
Hopeless. Those who go for 'easy' usually don't see the need for any pesky constraints and want to keep on going without them.
At least artificial intelligence already is superior to natural stupidity
|
|
|
|
|
Just unearthed the following gem to display a progress bar:
switch(uiBattBarPosition)
{
case(0):
DisplayMessage(MAC_MSG_PTR(SS_BATTERY_CHARGE),s,"");
break;
case(1):
DisplayMessage(MAC_MSG_PTR(SS_BATTERY_CHARGE),s,"\xff");
break;
case(2):
DisplayMessage(MAC_MSG_PTR(SS_BATTERY_CHARGE),s,"\xff\xff");
break;
case(3):
DisplayMessage(MAC_MSG_PTR(SS_BATTERY_CHARGE),s,"\xff\xff\xff");
break;
case(4):
DisplayMessage(MAC_MSG_PTR(SS_BATTERY_CHARGE),s,"\xff\xff\xff\xff");
break;
case(5):
DisplayMessage(MAC_MSG_PTR(SS_BATTERY_CHARGE),s,"\xff\xff\xff\xff\xff");
break;
case(6):
DisplayMessage(MAC_MSG_PTR(SS_BATTERY_CHARGE),s,"\xff\xff\xff\xff\xff\xff");
break;
case(7):
DisplayMessage(MAC_MSG_PTR(SS_BATTERY_CHARGE),s,"\xff\xff\xff\xff\xff\xff\xff");
break;
case(8):
DisplayMessage(MAC_MSG_PTR(SS_BATTERY_CHARGE),s,"\xff\xff\xff\xff\xff\xff\xff\xff");
break;
case(9):
DisplayMessage(MAC_MSG_PTR(SS_BATTERY_CHARGE),s,"\xff\xff\xff\xff\xff\xff\xff\xff\xff");
break;
case(10):
DisplayMessage(MAC_MSG_PTR(SS_BATTERY_CHARGE),s,"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff");
break;
case(11):
DisplayMessage(MAC_MSG_PTR(SS_BATTERY_CHARGE),s,"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff");
break;
case(12):
DisplayMessage(MAC_MSG_PTR(SS_BATTERY_CHARGE),s,"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff");
break;
case(13):
DisplayMessage(MAC_MSG_PTR(SS_BATTERY_CHARGE),s,"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff");
break;
case(14):
DisplayMessage(MAC_MSG_PTR(SS_BATTERY_CHARGE),s,"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff");
break;
case(15):
DisplayMessage(MAC_MSG_PTR(SS_BATTERY_CHARGE),s,"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff");
break;
case(16):
DisplayMessage(MAC_MSG_PTR(SS_BATTERY_CHARGE),s,"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff");
break;
case(17):
DisplayMessage(MAC_MSG_PTR(SS_BATTERY_CHARGE),s,"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff");
break;
case(18):
DisplayMessage(MAC_MSG_PTR(SS_BATTERY_CHARGE),s,"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff");
break;
case(19):
DisplayMessage(MAC_MSG_PTR(SS_BATTERY_CHARGE),s,"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff");
break;
case(20):
DisplayMessage(MAC_MSG_PTR(SS_BATTERY_CHARGE),s,"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff");
break;
}
Makes you wonder if these people were getting paid by the line.
|
|
|
|
|
Is 20 cases optimum for this approach or he was wrong there as well?
"The worst code you'll come across is code you wrote last year.", wizardzz[ ^]
|
|
|
|
|
We were using a 2x20 character display, so the "gas gauge" went from 0 to 20 bars.
|
|
|
|
|
Lucky you! If that gauge went to insanely high values, your eyes must have been bleeding by now.
"The worst code you'll come across is code you wrote last year.", wizardzz[ ^]
|
|
|
|
|
Yeah, if a boss measures programmer’s value by the number of lines they produce then they will get a lot of verbose code. OTOH, I think this guy just didn’t know how to do the task efficiently.
Just because the code works, it doesn't mean that it is good code.
|
|
|
|
|
CIDev wrote: Yeah, if a boss measures programmer’s value by the number of lines they produce then they will get a lot of verbose code
Oh, you mean, elegant, concise code, along the lines of (Java code):
breadcrumbs.setText((breadcrumbs.getText().equals("")) ? pressedItem : breadcrumbs.getText() + " -> " + pressedItem);
will actually get me less money?
Screw that, i'll just go with
StringBuilder builder = new StringBuilder();
if(breadcrumbs.getText().equals("")) {
builder.append(pressedItem);
} else {
builder.append(breadcrumbs.getText());
builder.append("->");
builder.append(pressedItem);
}
breadcrumbs.setText(builder.toString());
Screw simplicity, that should get me 9 times more money
And yes, I'm a fan of ternaries
And now, seriously, we should come up with a measurement tool for efficiency / readability, and not lines of code.
Full-fledged Java/.NET lover, full-fledged PHP hater.
Full-fledged Google/Microsoft lover, full-fledged Apple hater.
Full-fledged Skype lover, full-fledged YM hater.
|
|
|
|
|
Andrei Straut wrote: And yes, I'm a fan of ternaries
Brother!
|
|
|
|
|
Hey, bros, I like ternaries too.
Just because the code works, it doesn't mean that it is good code.
|
|
|
|
|
CIDev wrote: Hey, bros, I like ternaries too.
We should make a club. "The Ternary Project" sounds just about right
Full-fledged Java/.NET lover, full-fledged PHP hater.
Full-fledged Google/Microsoft lover, full-fledged Apple hater.
Full-fledged Skype lover, full-fledged YM hater.
|
|
|
|
|
Andrei Straut wrote: We should make a club. "The Ternary Project" sounds just about right
Sounds good, especially since there are 3 of us.
Just because the code works, it doesn't mean that it is good code.
|
|
|
|
|
CIDev wrote: Sounds good, especially since there are 3 of us.
Look, we even have a website now. It's just perfect!
Full-fledged Java/.NET lover, full-fledged PHP hater.
Full-fledged Google/Microsoft lover, full-fledged Apple hater.
Full-fledged Skype lover, full-fledged YM hater.
|
|
|
|
|
|
What do you mean? It's working just as it should!
Full-fledged Java/.NET lover, full-fledged PHP hater.
Full-fledged Google/Microsoft lover, full-fledged Apple hater.
Full-fledged Skype lover, full-fledged YM hater.
|
|
|
|
|
Just because the code works, it doesn't mean that it is good code.
|
|
|
|
|
|
Measuring "productivity" by lines of code written per unit time is bad, but I know of a case that's worse: measuring it by the number of faults found and fixed per unit time.
I was assigned to a project about twenty years ago that actually used such a metric. The top guy thought it was a clever twist on SLOC metrics. He reasoned that what really matters is whether the program meets its specification and is working properly -- so far, so good -- so lines-of-code-written is an irrelevant metric. But bug fixing, which is, after all, the process by which a faulty program approaches acceptability, struck him as just right!
I'd never before seen software engineers deliberately write huge numbers of bugs into their code. Pray God, I never see it again.
(This message is programming you in ways you cannot detect. Be afraid.)
|
|
|
|
|
Yeah, you get what you reward for, but rewarding for bug fixes is really bad.
Just because the code works, it doesn't mean that it is good code.
|
|
|
|
|
It would be okay if either the development was done in the past (so not influenced by the reward), or you only got a reward if the bug you fixed wasn't introduced by your team. But yeah otherwise that is a really stupid thing to measure.
I know it's really vague but basing rewards on customer satisfaction is really the way to go. Basing it on any particular code-related metric will just result in developers working to that metric and ignoring the actual end product.
|
|
|
|
|
A friend of mine used to work at a place that had a similar situation. The powers that be had decided to tie the group's bonus structure to the number of cases/bugs that were closed. So what did that encourage? Of course, all the project managers were closing bugs left, right, and center (fixed or not), and QA would just open a brand new one ... pretty much a copy/paste of the old.
It was a great team building exercise that everybody could get excited about.
|
|
|
|
|