|
I worked with a chap that did a retro fit of function headers on files where they'd largely been left out. The functions themselves were meaningfully named and internally well commented. Unfortunately he decided that he didn't have time to write descriptive text for all of them, so just put TODO: Add function comment. This was a real pain, all of our TODO: Fix nasty bug and TODO: Finish writing this important piece of code before release got buried beneath approximately a thousand worthless TODOs.
|
|
|
|
|
I have seen code where the standard practice was to leave in the // TODO: Add constructor logic here that the compiler puts in automatically. The folk that did it never saw a problem with doing that because they didn't use the Task list. I found it to be a problem as soon as I put in a useful TODO and it was overwhelmed my hundreds of pointless TODOs.
Bill W
|
|
|
|
|
That's good.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
That sounds reasonable to me. I'm pleased to see that he thinks the contract is so important. Or is this some form of bizarre Arnold Schwarzenegger motivational speaking type of thing. Try saying it in an Austrian accent, and it really works.
|
|
|
|
|
Pete O'Hanlon wrote: Try saying it in an Austrian accent, and it really works
:josh:
My WPF Blog[ ^]
All of life is just a big rambling blog post.
|
|
|
|
|
You've got a point there. One can imagine Arnie busting out the one-liner "contract enforced" after dispatching some poor sap.
Steve
|
|
|
|
|
Stephen Hewitt wrote: One can imagine Arnie busting out the one-liner "contract enforced" after dispatching some poor sap.
That's how he runs California.
Faith is a fine invention
For gentlemen who see;
But microscopes are prudent
In an emergency!
-Emily Dickinson
|
|
|
|
|
Hi,
I once saw in a real piece of code the following fragment! Nice name, don't you think?
{
boolean e0x0301=false;
.
.
.
if (!e0x0301) { ... }
}
modified 7-Mar-17 16:39pm.
|
|
|
|
|
Bill, searching frenetically in the pile of paper on his desk while hitting F5.
Bill: "Oh god, I keep losing this post-it on which I note the address of the array cell that does not get filled properly"
James, sitting next to him, smiling :" Why don't you rename a variable after it ?..."
Bill:" Oh yes, good idea, I suppose I'll remove it later in the production code."
|
|
|
|
|
Nice
modified 7-Mar-17 16:38pm.
|
|
|
|
|
What's really scary is that I'm a 'Bill', well a William, and my old boss was a James.
The stupidity of the 'James' suggestion reminded me of him. (I must find out if he's sober yet; it has been seven years)
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Looks like an obfuscated class have been decompiled anyway...
|
|
|
|
|
haha that is great
the only place u should see hex numbers is Hardware.h imho
|
|
|
|
|
I will confess to having used hex-ish variable names in code for certain hardware ports which didn't have standardized names. I've also used hex-ish defined constants for colors which needed to be remappable to different hardware (an NTSC system used $1x for gold, $4x for red, $8x for blue, $Cx for green, and $Fx for green-yellow; PAL systems mapped the colors completely differently). Although there are defined names for colors, I find it much easier to know that $3x is an almost red orange than to remember whether "ORANGE" refers to $2x or $3x.
Those things having been said, the code here looks like it may have been obfuscated.
|
|
|
|
|
Ummm, no
I'm very fond of adding flag words to objects instead of doing something horrible like adding countless bool members. Usually they are an enumerated type and defining them in anything than hex is awkward. Like this:
[flags]
public enum D_SOMEFLAGS : ulong
{
NONE = 0x0000000000000000,
VALIDATED = 0x0000000000000001,
CHANGED = 0x0000000000000002,
}
But I agree that hex notation should only be used in variable names on rare occasions.
A while ago he asked me what he should have printed on my business cards. I said 'Wizard'.
I read books which nobody else understand. Then I do something which nobody understands. After that the computer does something which nobody understands. When asked, I say things about the results which nobody understand. But everybody expects miracles from me on a regular basis. Looks to me like the classical definition of a wizard.
|
|
|
|
|
well we arent really in disagrement because when using this you will never see the values set only the symbols which is fine, good practise for saving memory infact.
the conatations i was implying was that hex numbers should be out of the way.
|
|
|
|
|
Yikes. That looks like something to do on a project when one is about to leave a company [evil grin]...
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Looks like this variable determines whether an object has a particular set of flags. If there would be, let say, 10 flags, then a 'meaningful' name would have to be "IsFlag1AndFlag2AndFlag3And....AndFlag10AndNothingElse = false "
So, for the author of a flag's enumeration this is just a short form of the above.
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
A few posts above I also commented on flags.
[flags]
public enum D_SOMEFLAGS : ulong
{
NONE = 0x0000000000000000,
VALIDATED = 0x0000000000000001,
CHANGED = 0x0000000000000002,
}
would it not be better (using my example there) to add something like
...
CHANGED_AND_VALIDATED = 0x0000000000000003;
...
to the enumeration?
A while ago he asked me what he should have printed on my business cards. I said 'Wizard'.
I read books which nobody else understand. Then I do something which nobody understands. After that the computer does something which nobody understands. When asked, I say things about the results which nobody understand. But everybody expects miracles from me on a regular basis. Looks to me like the classical definition of a wizard.
|
|
|
|
|
Yes and I add such extra pieces to enumerations too. However, in the situation I mentioned there are a lot of various flags and the additional enum member would look sth like
CHANGED_AND_VALIDATED_AND_FLAG3_AND_FLAG5_AND_FLAG11_AND_FLAG12_AND_.... = some code
I have nothing against long names in programming but if a name of one of constants starts taking more than 10% of a whole method content then something is going wrong I think.
Although 0x0301 contains just three flags, it's very simple to determine which flags are used (x0100 , x0200 and x0001 ), therefore there is nothing bad in ecode boolean names.
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
True, but in that case usually some kind of operation is associated with a particular combination of flags. You might use the name of this operation instead of naming all Flags involved. You can still elaborate in the comments. Something like this:
...
MODIFIED_BY_USER = 0x90aebeee7a3f017b,
...
A while ago he asked me what he should have printed on my business cards. I said 'Wizard'.
I read books which nobody else understand. Then I do something which nobody understands. After that the computer does something which nobody understands. When asked, I say things about the results which nobody understand. But everybody expects miracles from me on a regular basis. Looks to me like the classical definition of a wizard.
|
|
|
|
|
Dammmit we still agree. I was thinking of it when I was posting my message and wondering if you express that. Hmm I think we have a dead end in this discussion. Cool signature by the way.
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
Agreement is the best conclusion we can reach.
Until next time then.
A while ago he asked me what he should have printed on my business cards. I said 'Wizard'.
I read books which nobody else understand. Then I do something which nobody understands. After that the computer does something which nobody understands. When asked, I say things about the results which nobody understand. But everybody expects miracles from me on a regular basis. Looks to me like the classical definition of a wizard.
|
|
|
|
|
HTML
Please, who decided that tags like <br> didn't have to be closed. Now parsers have to waste their time checking for a closing tag. Also, how could people think that <b><i></b></i> is ok? And what about <div><div></div>?
And what about JavaScript and the like? Why consider ' and " only within a script tag, and then allow <, but outside a script tag treat any instance of < as a tag opener?
People's laziness in writing HTML slows down my computer by wasting processing.
But seriously, why did people decide that HTMLers would be too stupid/lazy to close tags and layer them correctly?
|
|
|
|
|
To add to it, how hard would it be to write an HTML editor that closes the tags for those lazy HTMLers
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|