|
I am blind, omg I just saw it. Well sarcasm is hard to see in forums sometimes. I am sorry
Microsoft ... the only place where VARIANT_TRUE != true
|
|
|
|
|
Argonia wrote: I don't see any point of using try catch with a throw in the first place
I do. Imagine a pretty red dot on the left margin. Every time this code fails the breakpoint is hit and you can see what exception will be thrown to the rest of the code, especially when it is called from many places.
You can find this in "Real World Programming Patterns", chapter IV: "Abuse of debugger".
|
|
|
|
|
We don't need no stinking documentation...the code is the documentation.
Code documentation done after the fact is probably worse than having to create a user manual! Even worse is documenting someone else's code!
"Go forth into the source" - Neal Morse
|
|
|
|
|
I clearly remember coming across a comment in the source of an old product called C-Scape.
(That was a common meme back then: C-Scape, C-Front, C-Shell, etc. How I laughed.)
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
Alan Kay.
|
|
|
|
|
I must say I see this exact kind of foolishness pretty often, in the questions at the Q&A forum.
—SASergey A Kryukov
|
|
|
|
|
Just saw this in a colleague's code:
for (int i = 0; i < 2; i++)
{
if (i < 1)
{
}
else if (i > 0)
{
}
}
and a little further down:
for (int i = 0; i < 2; i++)
{
if (i < 1)
{
}
else
}
What is this talk of release? I do not release software. My software escapes leaving a bloody trail of designers and quality assurance people in its wake.
|
|
|
|
|
Has he done some kind of operator overloading and is now laughing at your post?
|
|
|
|
|
And there is no code outside of the if/else construct that runs in both executions of the loop body? Maybe at some time there was such code and it was removed later.
The good thing about pessimism is, that you are always either right or pleasently surprised.
|
|
|
|
|
Maybe. The guy that wrote it told me that he was playing around with the code, testing out a few ideas to deal with a bug. It's quite possible that this weirdness is a leftover of that.
What is this talk of release? I do not release software. My software escapes leaving a bloody trail of designers and quality assurance people in its wake.
|
|
|
|
|
without viewing his full code you cant judge him..
|
|
|
|
|
I'm curious, under what circumstances would you find the code the OP posted reasonable?
|
|
|
|
|
Keith Barrow wrote: I'm curious, under what circumstances would you find the code the OP posted reasonable? When the intent of the code is to find itself on Weird-and-Wonderful perhaps?
|
|
|
|
|
Oh yes, we can
[Flags]
public enum Bool {
True,
False,
ForSure,
Maybe,
ProbablyNot,
Depends,
NotDecidedYet,
Undefined
}
|
|
|
|
|
public static int TenSeconds = 10;
|
|
|
|
|
Maybe it is used as a symbolic constant in various places and the author wanted to be able to change it in just one place. However, in this case the variable name is not the best choice and it should of course be const.
The good thing about pessimism is, that you are always either right or pleasently surprised.
|
|
|
|
|
it is used in exactly one place.
And the uselessness of it is EXACTLY the naming of it.
|
|
|
|
|
Coding standards 1 common sense 0 (this is almost certainly because of a 'no magic numbers' code rule)
|
|
|
|
|
But... that is not a variant of BASIC.. how can bad code be written in a non-BASIC language? Did we experience a shift to an alternate universe?
|
|
|
|
|
Tim Carmichael wrote: how can bad code be written in a non-BASIC language?
You evidently haven't worked the same places I have
worst code I ever saw was in COBOL!
|
|
|
|
|
Seems fair but should be declared as const.
|
|
|
|
|
I think the developer believed in "Self Documented Code".
It would have been much better if was something like:
public static int TenSeconds = 20;
|
|
|
|
|
Recently I looked into the source code of one of my colleges.
He wrote:
Private Sub startdestroy()
Dim th As New System.Threading.Thread(AddressOf destroy)
th.Start()
End Sub
Public Sub destroy()
Dim uuid As System.Guid = Nothing
While True
uuid = System.Guid.NewGuid()
End While
End Sub
I didn't understand what he was trying to achieve, so I asked him. What is this source code about? This thread is only costing performance doing nothing.
It could cause the garbage collector to throw out of memory exceptions. and the program will be dead And anyway this strange combination of public and private seems odd to me.
Tell me why you programmed this?
Very simple, told me my college. If I run this code on many computers, a lot of GUIDs will be created.
And capitalism relies on GUIDs . After a few years running my code on as many computers as possible, there are no GUIDs left in this world, and the capitalists cannot transfer money anymore, because they need a way to identify each money transaction in a unique way . I fired this routine in an own thread so nobody will notice what evil thing is going on in the background. It's a timebomb against capitalism.
This is why I am running this code on many computers. Just to destroy capitalism.
I agreed on the point that destroying evil captitalism is a good thing to do. But I said: If you continue your evil work, not only banks and capitalists are effected. Also good institutions like health care are effected. Rescue services can't operate anymore because they are also using GUIDs and they will certainly run out of GUIDs if you continue your evil work. Emergency numbers won't work without GUIDs.
I few hours later I got an EMAIL from my college stating rhat
he removed the code because of the great sideeffects. Yes, he agreed that rescue services need GUIDs to store medical data. And that the revenue department needs them too, so they can store financial transactions originating from the Cayman Islands and fight tax offenders.
Instead he will run for parlament in the next general elections. The good sideeffect is: He will earn tons of money , because members of parlament earn much more money than programmers do.
|
|
|
|
|
My previous manager considered code reviews a waste of time. I have just sent him this
|
|
|
|
|
This is really stupid. There is no central GUID system or whatever. A GUID is just generated and not taken from a pool of available GUIDs.
|
|
|
|
|
really
And i thought I saved capitalism and the world by stoping my college
OK back to work using GUIDs. I am creating a lot of them nowadays
Imports System.Runtime.InteropServices
<Guid("xxxxxxxx-1DFD-40d2-BA5F-62C961B2AAC8"), _
ClassInterface(ClassInterfaceType.None), _
ProgId("xxxx.xxxx")> _
Public Class xxxxx
Implements xxxxx
COM, yes COM seems to be popular again
xxxx just for hiding my true identity
|
|
|
|