Efficiency redux
-
Just unearthed the following gem to display a progress bar:
// display the battery gauge and percentage
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_CH -
Just unearthed the following gem to display a progress bar:
// display the battery gauge and percentage
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_CH -
Just unearthed the following gem to display a progress bar:
// display the battery gauge and percentage
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_CHYeah, 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.
-
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 :thumbsup::thumbsup: 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.
-
We were using a 2x20 character display, so the "gas gauge" went from 0 to 20 bars.
-
We were using a 2x20 character display, so the "gas gauge" went from 0 to 20 bars.
-
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 :thumbsup::thumbsup: 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! :rose:
-
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.
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.)
-
Andrei Straut wrote:
And yes, I'm a fan of ternaries
Brother! :rose:
-
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.)
-
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.)
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.
-
Yeah, you get what you reward for, but rewarding for bug fixes is really bad. X|
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.
-
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.
-
Just unearthed the following gem to display a progress bar:
// display the battery gauge and percentage
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_CH -
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.
-
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.
-
That link doesn't work for me. But, there is a ternary project on SourceForge[^] :)
Just because the code works, it doesn't mean that it is good code.
What do you mean? It's working just as it should! :laugh:
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! :laugh:
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.
-
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.