|
I'm not keen on the between keyword either - I always have to test if between means exclude or include the bounds.
I much prefer >= and <=.
Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
|
|
|
|
|
I dunno - I do remember that between is inclusive, so I tend to see it as more readable, generally.
However, most of the time I do use explicit tests instead, because I don't want to include the upper or lower bound. Ho Hum.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
I was thinking about why I find something like the word "between" so confusing.
I think the reason follows on from the VB versus C# discussion[^] that was going on in the lounge.
To explain this it goes something like this for me: if someone told me to kick a ball "between" the goal posts this would mean to me to hit anywhere "inbetween" the goal posts and not hit the goal posts themselves.
So for me there is a certain ambiguity in the meaning of "between".
Whereas >= and <= holds no ambiguity for me and this is partly why I like C# over VB - the lack of verbosity seems to make it easier for me to understand...
Maybe I am just too curmudgeonly...
Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
|
|
|
|
|
Yes, there is a difference between words in English and word in coding languages, generally in terms of precision.
The main reasons I prefer C# to VB is that is is more precise: in VB DataRows(17) could be an array element or a function call, in C# the difference is clear. Plus I hate the general use of var , automatic (and normally wrong) casting and don't get me started with On Error Resume Next
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
OriginalGriff wrote: in VB DataRows(17) could be an array element or a function call,
in C# the difference is clear
As much as I prefer C# over VB.NET this is not true.
DataRows[17] could either be an array access or a call to an indexer which is nothing else than a method call.
Robert
|
|
|
|
|
Robert Rohde wrote: DataRows[17] could either be an array access or a call to an indexer which is nothing else than a method call.
An indexer is an operator which is supposed to simulate accessing array's elements by sth like index, so the meaning is clear. A problem appears whe a coder implements an indexer which, for example, serializes an object to a file. However, if a coder knew about a "hidden feature" like indexers the he probably wouldn't be so unwise. In VB, if you see DataRows(17) and know that DataRows is a collection, then you think "well probably it is an indexer".
Greetings - Jacek
|
|
|
|
|
Jacek Gajek wrote: if a coder knew about a "hidden feature" like indexers then he probably wouldn't be so unwise
Nicely said
Excuse me for my improper grammar and typos.
It's because English is my primary language, not my first language.
My first languages are C# and Java.
VB, ASP, JS, PHP and SQL are my second language.
Indonesian came as my third language.
My fourth language? I'm still creating it, I'll let you know when it's done!
|
|
|
|
|
I agree with you here, it is a totally valid keyword, but ugh. I don't think that way. I feel like since it's not accurate, could be vague or ambiguous, and there is a better alternative, I prefer to use >= <=.
"I have a theory that the truth is never told during the nine-to-five hours. "
— Hunter S. Thompson
My comedy.
|
|
|
|
|
Yar. In my opinion BETWEEN should be >= && <
|
|
|
|
|
Exactamundo. It should be [A,B) because those intervals can be put next to each other without overlap. I've had to deal with a few stored procs that have comments recording the changes from + ' 23:59' to + ' 23:59:59' to + ' 23:59:59.999' etc. as the edge cases were slowly uncovered.
|
|
|
|
|
CmdVal has better be "T","F" or "Else"
Public Sub SetWrite(ByVal CmdVal As String)
Select Case UCase(CmdVal)
Case "T"
m_WriteOutErrorLog = True
Case "F"
m_WriteOutErrorLog = False
Case "Else"
MsgBox("Error: Error Logging Parameter not recognised, should be 'T' or 'F'")
End Select
End Sub
|
|
|
|
|
The "or else" my parents would use to threaten me! Glad to see it's made its way into the hall of shame.
"I have a theory that the truth is never told during the nine-to-five hours. "
— Hunter S. Thompson
|
|
|
|
|
Trying to debug some old code written 3-4years ago by a previous employee and came across this - I can't decide if he's a hero or an idiot, what do you think? (and before anyone says it, yes I know its legal - and it works (mostly) but try debugging it when it doesn't!)
for (; (Var1 < Var2) && (Var3 == FALSE) && ( ( Var4 < 0 ) || (Var5 <= Var6) ); Var7++)
{
.
.
.
.
}
|
|
|
|
|
He deserves a medal for being able to construct it!
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC Link[ ^]
Trolls[ ^]
|
|
|
|
|
Well "700 lines of code in a block" = Idiot.
|
|
|
|
|
True. Everybody knows the limit is 558 lines.
Martin Fowler wrote: Any fool can write code that a computer can understand. Good programmers write code that humans can understand.
|
|
|
|
|
it's an coding constant... like the speed of light
(yes|no|maybe)*
|
|
|
|
|
Maybe someone told them the while statement was going to be deprecated.
And they believed it!
I also like the title case for variable names.
"You get that on the big jobs."
|
|
|
|
|
To be fair I changed the variables names myself (to protect the guilty). Capitalising variable names is something I've always done, 20 years or more, it's a hard habit to break - old dog and new tricks if you know what I mean
|
|
|
|
|
Never seen something like that... but it's kind of... attractive... in a way... strange way... forbidden way...
(yes|no|maybe)*
|
|
|
|
|
You must resist - its a sure path to the dark side...
|
|
|
|
|
... I can't... have to write... strange code... oops, no it's been
while
(yes|no|maybe)*
|
|
|
|
|
for(;1==1;i++){if(!i)goto End;}
End:
Still tempted?
|
|
|
|
|
do ne it, until it feels false
(yes|no|maybe)*
|
|
|
|
|
Hard to tell given the level of anonymisation you've done. If it's a hard problem then such a complex test might be appropriate. I'd probably write it as a while loop, since the 'incrementer' is a different variable.
I do agree though that the 'Real WTF' is the 700 lines inside a loop construct.
|
|
|
|