• (cs) in reply to Licky Lindsay
    Licky Lindsay:
    Someone enlighten this old-schooler.

    Are you seriously telling me that GOTO has not been removed from the BASIC language in the last 20 years?

    Can you also still PEEK and POKE?

    you can't peek and poke in basic anymore, but you can peek and poke in C and C++

    & and * That's peekin and pokin, folks.

    Except i don't know if you can peek arbitrary values (probably, though)

    in basic you would peek stuff like coordinates on the screen or a certain place in ram to see if there was a printer installed. or a floppy drive.

    If i remember correctly, writing binary files to disk required poking. it's been so long i forgotten so much about really oldschool basic (like on the atari, for instance) that it makes me glad that i also forgot assembler on the Apple IIgs. can't have one worthless skill floating around with none of the other ones.

    Peeking would have been a lot more useful if you could have coded multithreaded applications... have a flag that is true if the thread is done, false if it isnt, have the main logic peek the flag's location to see its value, then you know if it is done or not. but alas, no multithreading.

  • Other guy. (unregistered) in reply to Marcin
    Marcin:
    Nat5an:
    Dave C.:
    rStacey:
    No, the = operator is overloaded for comparision and assignment depending on context.
    A huge WTF right there.

    Meh, SQL does the same thing, as do other languages, I'm sure. It's not that big of a WTF. Just because it's not like C or Java doesn't make it completely crazy.

    Defend this statement. Please show me a valid sql query which has assignment.

    Declare @foo as int

    Select @foo = idfield from stuff where something = 'nothing'

    ... valid in SQL 2000 at least

  • (cs) in reply to Other guy.
    Other guy.:

    Declare @foo as int

    Select @foo = idfield from stuff where something = 'nothing'

    ... valid in SQL 2000 at least

    Is that the same as Select @foo = idfield from stuff where TRUE ? or am i missing the assignment part? Maybe. i do, after all, suck.

  • Bill (unregistered) in reply to cruise
    cruise:
    No one else think that basing the entire logic around a specfic exception is pretty barmy? Or is that sort of thing so common in a wtf that we don't blink anymore? :P

    Code smells are fun.....

    Looks like the framework maker had an error they couldn't fight through properly, so they devised a "Clever" way to eat it.

    I know "I" like my frameworks to out-and-out hide errors from me. :s

  • Other guy. (unregistered) in reply to GeneWitch
    GeneWitch:
    Other guy.:

    Declare @foo as int

    Select @foo = idfield from stuff where something = 'nothing'

    ... valid in SQL 2000 at least

    Is that the same as Select @foo = idfield from stuff where TRUE ? or am i missing the assignment part? Maybe. i do, after all, suck.

    I think you're missing the assignment part there...

    Select @foo = idfield is the assignment...

    where something = 'nothing' is the test part

  • (cs) in reply to Dave C.
    Dave C.:
    rStacey:
    No, the = operator is overloaded for comparision and assignment depending on context.
    A huge WTF right there.
    While I much prefer C's = vs. ==, I'm still not a big fan of that either, at least aesthetically. We all grew up learning that "=" means equality in mathematics, not assignment. = vs. == is still a WTF in my opinion, though a much smaller one than VB's = vs. =.

    My favourite is APL, which uses = for equality, and a non-ASCII character that looks like a left-pointing arrow (much like <-) for assignment. Very easy to grok. Quite possibly the only thing in APL that's easy to grok...

  • (cs) in reply to cowbert
    cowbert:
    JTK:
    Yeah -- I was so stunned by the attempt to actually do something useful with an exception thrown by the database that I missed the whole goto/continue wierdness. I mean, if your database code is so whacked that you consider exceptions as non-catastrophic and part of your typical process flow, then that's truly Worse Than Failure...

    Uhm, there is no real(tm) exception handling in VB. So using goto to write an exception handler is perfectly fine. Of course, in that case you're supposed to use goto in the context of OnError Goto, so it really doesn't excuse this particular wtf, but as a BASIC practice (harhar) it is a favorable pattern (it's obviously worse to stick your error handler smack in the middle of the loop or if block).

    Do me a favor and define "real exception handling"?

    Because last time i checked

    Try cacheobject = createobject("cacheobject.factory", "moo") cacheobject.open("connection information") catch ex as CacheException write("an exception occured, it was ") writeline(ex) end try

    Is real exception handling.

  • Shinobu (unregistered) in reply to Will

    In VB the meaning of = depends on context. In a statement context

    a = b
    is shorthand for

    Let a = b

    In an expression context

    a = b
    compares two values for equality.

    Sub Swap(  As Boolean,    As Boolean)
       =   =   
       =   =   
       =   =   
    End Sub
  • (cs)

    It's been a while, but I think Pascal does it best:

    a = b means "is a equal to b?" a := b means "assign to a the value of b"

    This keeps = meaning what we always learned it to be, and simply introduces a new syntax for assignment. That's kind of the opposite of how C,C#,Java,etc do it, yet to me it makes much more sense.

  • (cs) in reply to AssimilatedByBorg
    AssimilatedByBorg:
    Dave C.:
    rStacey:
    No, the = operator is overloaded for comparision and assignment depending on context.
    A huge WTF right there.
    While I much prefer C's = vs. ==, I'm still not a big fan of that either, at least aesthetically. We all grew up learning that "=" means equality in mathematics, not assignment. = vs. == is still a WTF in my opinion, though a much smaller one than VB's = vs. =.

    My favourite is APL, which uses = for equality, and a non-ASCII character that looks like a left-pointing arrow (much like <-) for assignment. Very easy to grok. Quite possibly the only thing in APL that's easy to grok...

    Here:

    x + 2y = 72 Solve for x (equality)

    x + 2y = 72; x = 14 Solve for y (assignment)

  • Anon (unregistered) in reply to rStacey
    rStacey:
    No, the = operator is overloaded for comparision and assignment depending on context.

    Hasn't this always been the case for pretty much all flavors of basic?

  • Glenn Lasher (unregistered) in reply to KattMan
    x = y = z x = (y = z)

    Just try to grok that and tell me what the value of x is in each case.

    If it behaves like classic BASIC (you remember, the one with numbered lines?) then, if my memory serves (as it sometimes does), then the first case will result in x being equal to z, and the latter case will result in x being a boolean, depending on the relative values of y and z.

    In classic BASIC, the latter case would often equal 0 for false and -1 for true, though there were a mind-numbing number of implementations, all different, requiring someone writing code to write not just with the hardware platform in mind, but also the BASIC implementation in mind.

    I'm glad that's changed (yeah, right!)

  • (cs)

    Without looking at the other comments, I see:

    • using goto to break out of a for loop
    • a useless continue inside the for loop
    • exceptions other than the one being looked for are suppressed

    I'm trying mightily to avoid adding "using Visual Basic" to that list.

  • (cs) in reply to Scott
    Scott:

    GOTO is also still in all descendants of C, including C#.

    PEEK and POKE are gone though....

    Weird. If Java doesn't need GOTO, why does C# ?

  • Ken (unregistered) in reply to RobertB
    RobertB:
    (Proud VB coder since 1992. TRS-80 BASIC before that.)
    Oh, a newcomer? :-)

    I don't use any dialect of BASIC anymore, but I used VB1 (before they had source files in text) and VB2. Other dialects, including TRS-80 and AppleSoft, before that. And Dartmouth BASIC before that, starting in late 1971. Anyone else learn from "Basic BASIC"?

  • Shinobu (unregistered) in reply to Jeff S

    I tend to agree. Although the VB way is not bad either; you'd put assignments in their own statements in any case. Using multiple assignments in one statement potentially causes all kinds of order-of-execution problems. The real WTF is that C & co. allow it.

  • JTK (unregistered) in reply to cowbert
    cowbert:
    JTK:
    Yeah -- I was so stunned by the attempt to actually do something useful with an exception thrown by the database that I missed the whole goto/continue wierdness. I mean, if your database code is so whacked that you consider exceptions as non-catastrophic and part of your typical process flow, then that's truly Worse Than Failure...

    Uhm, there is no real(tm) exception handling in VB. So using goto to write an exception handler is perfectly fine. Of course, in that case you're supposed to use goto in the context of OnError Goto, so it really doesn't excuse this particular wtf, but as a BASIC practice (harhar) it is a favorable pattern (it's obviously worse to stick your error handler smack in the middle of the loop or if block).

    No, my point was that I was amazed that they seemed to be processing the exception as part of the standard code flow, and not logging and rolling back (as a normal person would). Using exceptions as part of typical program flow is A Bad Thing, and the fact that they are anticipating this error at all means they have serious problems in the database layer.

  • (cs) in reply to Licky Lindsay
    Licky Lindsay:
    Scott:
    GOTO is also still in all descendants of C, including C#.

    PEEK and POKE are gone though....

    Weird. If Java doesn't need GOTO, why does C# ?
    Because Microsoft wanted another reason to point at to show that C# wasn't Java, really. "Embrace and Extend" and all that.

  • benk (unregistered) in reply to GeneWitch
    GeneWitch:
    Here:

    x + 2y = 72 Solve for x (equality)

    x + 2y = 72; x = 14 Solve for y (assignment)

    No, that's solving a system of equations. It'd be the same as x + 2y = 72; x + y = 43. As a math major and a software engineer, I've grokked both = as equality only and the C system. It's just syntax, people. On the other hand, APL uses non-ASCII characters? That's a real wtf.

  • (cs) in reply to GeneWitch
    GeneWitch:
    Here:

    x + 2y = 72 Solve for x (equality)

    x + 2y = 72; x = 14 Solve for y (assignment)

    I'm not quite sure what you're getting at...

    What I mean, is that in algebra, arguably there is no such thing as assignment. (There are other reasonable interpretations with which I'm not going to quibble.)

    In your example: x = 14 x + 2y = 72 There are no assignments. Two axioms are presented. "x is equal to 14" and "x + 2y is equal to 72". Two truth-statements involving equality, in other words. (Again, just my world-view. I'm not saying other views are wrong.)

    If I'm going to argue that algebra does not have assignment, then I'm going to conclude that programming languages ought to introduce a new syntax for assignment. Lots of languages did, VB did not. C took the unfortunate choice, IMO, of introducing a new syntax for equality while using the algebraic syntax of equality for assignment.

    I'm not saying C should have introduced a non-ASCII character the way APL did, but there were other choices, such as Pascal's := assignment statement.

  • (cs)

    I'm surprised that no one feels funny about the way the code determines the kind of exception that got thrown. (And what if the database changes its error message strings slightly between versions?)

  • (cs) in reply to GeneWitch
    GeneWitch:
    you can't peek and poke in basic anymore, but you can peek and poke in C and C++

    & and * That's peekin and pokin, folks.

    Except i don't know if you can peek arbitrary values (probably, though)

    One expects that kind of thing in C. Peeking and poking at various naughty bits is how stuff gets done down there.

    VB is supposed to be a higher level language though, higher even than (say) Java, so I'm not surprised for it to be gone.

  • trianglman (unregistered) in reply to RobertB
    RobertB:
    Marcin:
    Nat5an:
    Meh, SQL does the same thing, as do other languages, I'm sure. It's not that big of a WTF. Just because it's not like C or Java doesn't make it completely crazy.
    Defend this statement. Please show me a valid sql query which has assignment.
    Here's an example of an assignment and a comparison in a simple SQL query.
    Select PseudoFieldName = 'Some value'
    From TableName
    Where Something = Nothing
    And don't forget stored procedures:
    Declare @x int, @y int
    Select @x = 2, @y = 2
    If @x + @y = 5
       Select RetVal = 'For sufficiently large values of 2'
    Else
       Select RetVal = 'You took the blue pill'
    

    Or, much more simply "UPDATE table SET field=1 WHERE otherField=2

    However, SQL has very clear seperation between where comparisons are used and where assignments are. Conditionals in code, not always.

  • (cs) in reply to AssimilatedByBorg
    AssimilatedByBorg:
    I'm not saying C should have introduced a non-ASCII character the way APL did, but there were other choices, such as Pascal's := assignment statement.

    Maybe with Unicode, the world at large is finally ready for languages with non-ASCII syntax.

    a ? b; // assignment a = b; // comparison a ? b; // negative comparison a = b; // less than ... etc ...

    EDIT: well, apparently the forum software isn't ready for them, so maybe not. :-(

  • Andrew (unregistered) in reply to dyslexia
    dyslexia:
    Will: (re: 'If n = 0' ...)

    This is not an assignment. In VB (and VB.NET, which is what this WTF is written in), = is either assignment or equality depending on the context.

    If Foo = 1 Then ' <-- Equality Foo = 2 ' <-- Assignment End If

    Perhaps not the best idea, but historically it's been that way, and they kept it in the move to .NET.

    No, in this respect, VB has it right, like most languages. The point is not that the token (i.e. terminal) '=' is used for both assignment & logical-equals. It the conditional block (i.e. non-terminal) within IF (conditional) THEN.

    Very few languages have side-effects inside an IF..THEN conditional. It is bad compiler design to do so. The conditional could change values before the THEN or ELSE block is executed to unwanted states. This is a major defect in C/C++ & Java compiler definitions. Pascal's definition forbids this.

    Pascal even requires a counting loop-variable to be unchanged by the DO block. It restricts student programmers to good (i.e. safe) practices.

    FOR I := 1 TO 10 DO BEGIN I := I + 1; (* This is illegal! *) END

    I write code in C, & accept that is a "low-level" language. It allows code that is "like assembly". I understand, and use the side-effect operations in for, if, & other control structures appropriately.

    Programmer's should KNOW that C is not a typical language, and NOT base their idea of a general programming language on it.

  • (cs) in reply to Glenn Lasher
    Glenn Lasher:
    x = y = z x = (y = z)

    Just try to grok that and tell me what the value of x is in each case.

    If it behaves like classic BASIC (you remember, the one with numbered lines?) then, if my memory serves (as it sometimes does), then the first case will result in x being equal to z, and the latter case will result in x being a boolean, depending on the relative values of y and z.

    In classic BASIC, the latter case would often equal 0 for false and -1 for true, though there were a mind-numbing number of implementations, all different, requiring someone writing code to write not just with the hardware platform in mind, but also the BASIC implementation in mind.

    I'm glad that's changed (yeah, right!)

    Actually incorrect, you forgot the declarations above those lines. In both cases x = false. Try it out sometime.

  • Lucas (unregistered)

    In relation to the Rorschach test, the code looks like ASCII art from that old Star Trek game on BBSes.

    In regards to VB.NET. Get off it people. I grew up on C++, programmed in machine-code, assmebly, etc. Even used ADA once (Don't get me started on the WTFs of that language), and I can honestly say that VB.NET is NOT a WTF. Perhaps if you didn't have an aut-completing IDE I would agree with the verbosity being a small WTF, but with VS 2005, it takes imperceptably longer to write anything in VB.NET over C# and is SIGNIFICANTLY easier to maintain (More readable at a glance).

    Additionally, the == crap in C++/C#/C/Java always drove me nuts. The fact that a good code practice in C++ was to always put the constant first when doing equality checks is a HUGE WTF. Throws a compiler error that way instead of causing a subtle bug from missing the second equals. Anyone who's written more then 1000 lines of C++ has had this happen ATLEAST once.

    And yes, I still concider C++ my primary language, though I use VB.NET daily these days.

    Captch: atari - Man I miss mine. THAT was a fun system.

  • darryl (unregistered) in reply to Anon
    Anon:
    rStacey:
    No, the = operator is overloaded for comparision and assignment depending on context.

    Hasn't this always been the case for pretty much all flavors of basic?

    Yes, except that it's misleading to describe "=" as an overloaded operator.

    Basic has always clearly differentiated between assignment statements and equality expressions. There is a major difference between Basic and C-like languages here: C, and its friends, allow expressions to be statements. (In fact, most lines of C code are expressions, making the generation of terrifically obfuscated code possible.) A line of code in C like "i++;" or "x = 2;" is an expression with side effects. Basic's expressions don't have side effects, and an expression by itself is invalid syntax.

    The equal sign only does assignment in a very limited context: the assignment statement, of the form "x = foo". In old-school Basic, this would have been "LET x = foo" to make it clear that this was a LET statement, not just some weird floating expression. The LET keyword was soon made optional, since it was unnecessary; "x = 2" always means "LET x = 2" and can never means anything else.

    The statement-vs-expression difference can also be seen in, for example, the fact that QuickBASIC implements both SUBs and FUNCTIONs. A SUB is used as a statement, and does not return a value. A FUNCTION is used as part of an expression, and always returns a value. The syntax used makes this difference clear, as well.

    Other languages have been influencing BASIC for a number of years now, with the result that a lot of newer language constructs make sense from, say, a C++ programmer's perspective, but are actually at odds with the traditional approach that BASIC has taken. I think this is a bad thing -- a language with an identity crisis is a lot easier to write seriously bad code in.

  • AGould (unregistered) in reply to Jeff S
    Jeff S:
    Enough with the VB bashing, kids, lets try something a little more original. And remember: if you truly, honestly feel that if you are forced to use VB that you will be forced to write bad code, then that pretty much says it all about your programming skills.

    Agreed - sometimes you don't need to pull out the big guns. If your client just needs his Excel spreadsheet to talk to his Access database, VB makes a lot more sense from a lot of perspectives (not the least of which is that they can't see a difference - it's just a better spreadsheet).

  • Darron (unregistered) in reply to Scott
    Scott:
    Licky Lindsay:
    Someone enlighten this old-schooler.

    Are you seriously telling me that GOTO has not been removed from the BASIC language in the last 20 years?

    Can you also still PEEK and POKE?

    GOTO is also still in all descendants of C, including C#.

    PEEK and POKE are gone though....

    Except Java. In Java goto is a reserved word, with no implementation.

  • (cs) in reply to Jeff S
    Jeff S:
    It's been a while, but I think Pascal does it best:

    a = b means "is a equal to b?" a := b means "assign to a the value of b"

    This keeps = meaning what we always learned it to be, and simply introduces a new syntax for assignment. That's kind of the opposite of how C,C#,Java,etc do it, yet to me it makes much more sense.

    And just to give people migraines, VB has it too!

    Private Function Foo(Bar As Integer, Baz As Integer) As Boolean
    ...
    End Function
    
    ...
       ' This:
       bRet = Foo(1, 2)
    
       ' can be written like this for clarity:
       bRet = Foo(Bar:=1, Baz:=2)
    
       ' or like this for dyslexia:
       bRet = Foo(Baz:=2, Bar:=1)
    

    I think this was introduced in VB5. It actually comes in handy when you have optional parameters and you want to leave some of them at their default values.

    But it causes major confusion sometimes, when the function's parameter happens to have a name similar to the calling routine's variable.

    bRet = Foo(Baz:=Bar, Bar:=Baz)

    Every language lets you shoot yourself in the foot. VB just comes with instructions.

  • (cs) in reply to Jeff S
    Jeff S:
    VB BASHING RULES

    If you'd like to be "witty" and "original" and "clever" and bash VB in a response, you MUST first answer this question before your post:

    If you are forced to use VB.NET (or VB6 or VBA or even VBScript) to write a fairly complex program, would you be able to write code that not only works reliably but that is also clean, maintainable and efficient?

    Answer that question first ( a simple yes or no is fine), and then bash away with your original, witty anti-VB statements.

    (hint: if you say "no", then that says it all about your programming skills -- you are either a pretty horrible programmer, or you don't have sufficient knowledge of VB so you have no business criticizing it. If you say "yes", then you have no business bashing VB because you just demonstrated that it is the programmer, not the language.)

    Thanks!

    I can write good code in VB. I can also write good code in Scheme, Ada, Prolog, or MIPS R3000 Assembly, but I'm sure as hell not going to consider them for developing my next web framework, either.

  • dolo54 (unregistered) in reply to lizardfoot
    lizardfoot:
    Everytime you use a GoTo, God kills a puppy.

    10 PRINT "TOO MANY GODDAM PUPPIES!!!" 20 GOTO 10

  • (cs) in reply to Andrew
    Andrew:
    No, in this respect, VB has it right, like most languages. The point is not that the token (i.e. terminal) '=' is used for both assignment & logical-equals. It the conditional block (i.e. non-terminal) within IF (conditional) THEN.

    Very few languages have side-effects inside an IF..THEN conditional. It is bad compiler design to do so. The conditional could change values before the THEN or ELSE block is executed to unwanted states. This is a major defect in C/C++ & Java compiler definitions. Pascal's definition forbids this.

    Pascal even requires a counting loop-variable to be unchanged by the DO block. It restricts student programmers to good (i.e. safe) practices.

    FOR I := 1 TO 10 DO BEGIN I := I + 1; (* This is illegal! *) END

    I write code in C, & accept that is a "low-level" language. It allows code that is "like assembly". I understand, and use the side-effect operations in for, if, & other control structures appropriately.

    Programmer's should KNOW that C is not a typical language, and NOT base their idea of a general programming language on it.

    First, allowing side effects in conditionals is not bad compiler design. If the language allows for it, your compiler must, too. Otherwise you've designed your compiler very badly indeed. Whether it is bad language design is debatable. While it can lead to unexpected states, so can lazy evaluation, short-circuit logic, dynamic typing, and about a thousand other concepts. It's what you do with them that determines whether they are good or bad. And why shouldn't C be used as a basis for comparison of general programming languages? It's basic structure is in use in some of the most popular programming languages in the world. Why not use the most common thing as a baseline?

  • (cs) in reply to bstorer
    Jeff S:
    VB BASHING RULES

    If you'd like to be "witty" and "original" and "clever" and bash VB in a response, you MUST first answer this question before your post:

    If you are forced to use VB.NET (or VB6 or VBA or even VBScript) to write a fairly complex program, would you be able to write code that not only works reliably but that is also clean, maintainable and efficient?

    Answer that question first ( a simple yes or no is fine), and then bash away with your original, witty anti-VB statements.

    (hint: if you say "no", then that says it all about your programming skills -- you are either a pretty horrible programmer, or you don't have sufficient knowledge of VB so you have no business criticizing it. If you say "yes", then you have no business bashing VB because you just demonstrated that it is the programmer, not the language.)

    Thanks!

    No.

    Before you set down the rules under which we can bash VB, you must do the following:

    1. Prove that VB is a language worth using, at all, for anything; and

    2. Eat a can of pork brains, cold.

  • (cs) in reply to Jeff S
    Jeff S:
    VB BASHING RULES

    ...

    That's just great. I'm going to use that someday. Verbatim, if you don't mind.

    While I typically don't use VB for anything critical, sometimes it's just the best tool for the job. Sometimes, however, it's not, and a language like C, C++, Perl, PHP, Python, Ruby, Java, *Script, AWK, sed, *nix shell, Windows batch, ... is more fitting to help solve the problem.

    Newsflash, kids: Programming languages are problem-solving tools. They're not (or shouldn't be) marks of how 1337 you are or how M4D your 5K1LLZ are. A real programmer is able to adapt to their environment without too much effort.

    True, X language may be able to do ABC a little better than Y language, but Y language may be better at DEF than X language. However, in the end, you should be prepared to completely abandon any given language, even if it is your favorite language to use.

  • (cs) in reply to Jeff S
    Jeff S:
    VB BASHING RULES

    If you'd like to be "witty" and "original" and "clever" and bash VB in a response, you MUST first answer this question before your post:

    If you are forced to use VB.NET (or VB6 or VBA or even VBScript) to write a fairly complex program, would you be able to write code that not only works reliably but that is also clean, maintainable and efficient?

    Answer that question first ( a simple yes or no is fine), and then bash away with your original, witty anti-VB statements.

    (hint: if you say "no", then that says it all about your programming skills -- you are either a pretty horrible programmer, or you don't have sufficient knowledge of VB so you have no business criticizing it. If you say "yes", then you have no business bashing VB because you just demonstrated that it is the programmer, not the language.)

    Thanks!

    No.

    And If I had to do that on a turing machine tape, or a neural network memory, or on raw machine code, I'd be unable to do write good code either. Guess that makes me a bad programmer...

  • (cs) in reply to mrprogguy
    mrprogguy:
    Jeff S:
    VB BASHING RULES

    If you'd like to be "witty" and "original" and "clever" and bash VB in a response, you MUST first answer this question before your post:

    If you are forced to use VB.NET (or VB6 or VBA or even VBScript) to write a fairly complex program, would you be able to write code that not only works reliably but that is also clean, maintainable and efficient?

    Answer that question first ( a simple yes or no is fine), and then bash away with your original, witty anti-VB statements.

    (hint: if you say "no", then that says it all about your programming skills -- you are either a pretty horrible programmer, or you don't have sufficient knowledge of VB so you have no business criticizing it. If you say "yes", then you have no business bashing VB because you just demonstrated that it is the programmer, not the language.)

    Thanks!

    No.

    Before you set down the rules under which we can bash VB, you must do the following:

    1. Prove that VB is a language worth using, at all, for anything; and

    2. Eat a can of pork brains, cold.

    And there you have it .. a typical "vb-basher". Need I say more?

  • (cs) in reply to Mcoder
    Mcoder:
    Jeff S:
    VB BASHING RULES

    If you'd like to be "witty" and "original" and "clever" and bash VB in a response, you MUST first answer this question before your post:

    If you are forced to use VB.NET (or VB6 or VBA or even VBScript) to write a fairly complex program, would you be able to write code that not only works reliably but that is also clean, maintainable and efficient?

    Answer that question first ( a simple yes or no is fine), and then bash away with your original, witty anti-VB statements.

    (hint: if you say "no", then that says it all about your programming skills -- you are either a pretty horrible programmer, or you don't have sufficient knowledge of VB so you have no business criticizing it. If you say "yes", then you have no business bashing VB because you just demonstrated that it is the programmer, not the language.)

    Thanks!

    No.

    And If I had to do that on a turing machine tape, or a neural network memory, or on raw machine code, I'd be unable to do write good code either. Guess that makes me a bad programmer...

    Maybe .. or, you don't know VB very well. Could be one or the other, for your sake I really hope it's the latter ... to claim that you cannot write any decent code in VB if you actually know how to use the language isn't really something I'd be proud of. It's actually quite easy, you know. Try it some time, and then criticize. (Though I do recommend VB.NET, definitely not VB<=6).

  • Jonathan Allen (unregistered) in reply to strickdd
    strickdd:
    I don't know if you realized, the "Continue For" was in the catch block. If you didn't include it, then the loop would automatically exit.

    No it wouldn't. I cann't even imagine what makes you think that it would.

  • Bert (unregistered) in reply to Scott

    goto is a reserved word in Java, but not implemented.

    I bet the original implementation probably had the compiler delete the offending source file immediately, but they couldn't get it past QA.

    Here is a snippet from the bug report:

    Responsibility: javac compiler team Priority: infinity Overview: I was trying to write a "master" test case that looped through some other test cases, and it keeps deleting the master.java file instead of compiling it.

  • Jonathan Allen (unregistered) in reply to Marcin
    Marcin:
    Nat5an:
    Dave C.:
    rStacey:
    No, the = operator is overloaded for comparision and assignment depending on context.
    A huge WTF right there.

    Meh, SQL does the same thing, as do other languages, I'm sure. It's not that big of a WTF. Just because it's not like C or Java doesn't make it completely crazy.

    Defend this statement. Please show me a valid sql query which has assignment.

    Declare @A int Declare @B int

    Select @A = Count(*) From Cars

    If @A = 0 Set @B = 100 Else Set @B = 50

  • (cs) in reply to Jeff S
    Jeff S:
    VB BASHING RULES

    If you are forced to use VB.NET (or VB6 or VBA or even VBScript) to write a fairly complex program, would you be able to write code that not only works reliably but that is also clean, maintainable and efficient?

    Yes I can, I have, I still do on occasion. And you are correct in your assessment, those that answer no just don't have sufficient experience with the language to do so, therefore are not qualified to bash it.

    If this question were asked about C++ a few years back I would have had to say Maybe. These days, moving to C# I think is actually helping my understanding of C++. It also is proving that these days, who cares if it is VB.Net or C#, it all compiles to the same IL code so it is the same language, different syntax.

    And for the poster that mentioned that VB just gives you instructions on how to shoot yourself in the foot, well I would much rather it be that way, don't want my neighbor misunderstanding the concept and shooting himself in MY foot.

  • (cs) in reply to Jonathan Allen
    Jonathan Allen:
    strickdd:
    I don't know if you realized, the "Continue For" was in the catch block. If you didn't include it, then the loop would automatically exit.

    No it wouldn't. I cann't even imagine what makes you think that it would.

    Correct, The catch block would execute then fall out, of the try block. Following that you would get to the Next and continue executing the For loop. It would only completely exit the For loop if he was to throw the exception again.

  • Mirque (unregistered) in reply to Nat5an
    Nat5an:
    Dave C.:
    rStacey:
    No, the = operator is overloaded for comparision and assignment depending on context.
    A huge WTF right there.

    Meh, SQL does the same thing, as do other languages, I'm sure. It's not that big of a WTF. Just because it's not like C or Java doesn't make it completely crazy.

    True... I suspect more languages use = for comparison and assignment than use different operators.

    In other words "I'm not familiar with that" != "screwed up"

  • (cs) in reply to Darron
    Can you also still PEEK and POKE?
    Yes In VB6 you had to use LSet to achive peek or poke type affect. In VB .NET you have InteropServices.Marshal.ReadByte and InteropServices.Marshal.WriteByte Plus various flavours for reading writing more bytes at a time.

    x=y=z Most of the flavours of BASIC I have used would have treated the second = as an assignment. I thought BBC basic allowed the several assignments but I just tried it on a BBC emulator and it also made x=0 (false) becuase y<>z (!= for the C amongst you) Maybe one day I will try it on a real BBC B (I have one upstairs, anyone know where I can get a monitor?)

    BASIC bashing time Yes, I could write a large system in VB .NET and have it maintainable. In fact we are in the first 6 months of such a system. I primarily use VB .NET and have used flavours of BASIC all my (programming) life. The only thing I have against BASIC is that GOTO should just not exist. I grew out of using it in high school, and believe me, I still managed to write some pretty nasty code! I also used to use STOS on an Atari ST, no procedures, AT ALL, only GOTO and GOSUB, and...

    ON x GOSUB

    You all remember that? Please tell me that no longer exists in any modern language.

    VB .NET has improved greatly on the WTF's of its ancestors. We now have NO reason to use GOTO, even if it is still there. Line has a sane syntax, Try...Catch has arrived, we even have Using. Hey C# lot, you complain about VB using = for 2 different meanings, what about Using? I think VB .NET is a really cool language but maybe thats just becuase I am comfortable with it.

  • Bert (unregistered) in reply to Andrew
    dyslexia:
    Will: (re: 'If n = 0' ...)

    Pascal even requires a counting loop-variable to be unchanged by the DO block. It restricts student programmers to good (i.e. safe) practices.

    FOR I := 1 TO 10 DO BEGIN I := I + 1; (* This is illegal! *) END

    Fortran had the same restriction with DO loops. This allowed compilers to do optimizations like calculate the number of times a loop would iterate ahead of time and stick the count in a register for a decrement/branch-not-zero opcode. I still remember the freaking formula: num_loops = (final_value - initial_value) / step_size (integer arithmetic of course)
  • dyslexia (unregistered) in reply to Mirque
    Mirque:
    Nat5an:
    Dave C.:
    rStacey:
    No, the = operator is overloaded for comparision and assignment depending on context.
    A huge WTF right there.

    Meh, SQL does the same thing, as do other languages, I'm sure. It's not that big of a WTF. Just because it's not like C or Java doesn't make it completely crazy.

    True... I suspect more languages use = for comparison and assignment than use different operators.

    In other words "I'm not familiar with that" != "screwed up"

    No no, you don't understand: any language or language feature that isn't identical to C is obviously a massive WTF. That's, like, totally in the l33t hax0r rulebook!

    Rule #1 of the l33t hax0r: if it's different from what I'm used to, the language was designed wrong!

  • Harrow (unregistered) in reply to RobertB
    RobertB:
    Why all the VB hate? A poster in a previous discussion summed it up nicely: "A poor workman blames his tools".
    I have heard this bromide from enough lazy ignorant sources to begin to find it really annoying. It is an attempt to slander anyone who is interested in tool improvement, using a logical fallacy cowering behind a veiled accusation. Tell me this: what does a good workman say if his tools are essentially shit?

    In other words, the converse is not true. Not everyone who "blames his tools" is "a poor workman".

    If good workmen found it needful and proper to accept any quality of tool without comment, we would all still be biting sticks to make them pointy.

    And coding everything in Visual Basic.

    -Harrow.

  • (cs) in reply to Jeff S
    Jeff S:
    VB BASHING RULES

    If you'd like to be "witty" and "original" and "clever" and bash VB in a response, you MUST first answer this question before your post:

    If you are forced to use VB.NET (or VB6 or VBA or even VBScript) to write a fairly complex program, would you be able to write code that not only works reliably but that is also clean, maintainable and efficient?

    Answer that question first ( a simple yes or no is fine), and then bash away with your original, witty anti-VB statements.

    (hint: if you say "no", then that says it all about your programming skills -- you are either a pretty horrible programmer, or you don't have sufficient knowledge of VB so you have no business criticizing it. If you say "yes", then you have no business bashing VB because you just demonstrated that it is the programmer, not the language.)

    Thanks!

    And, lest we forget, it's not that VB([1-6]|.NET|Script|A)? is a WTF in and of itself, it's the little quirks that make life so much fun that are, such as Stop being a reserved word in VBScript but it doesn't do anything unless you're using it in a [CW]Script context, Escape not being mentioned whatsoever in any VBScript docs ever, but does the same as J(ava)Script's escape(), something set to vbUseDefault is also True (even though the internal value is -2 as against -1 [another WTF there]) or more properly Not(False) so you have to explicitly check instead of just a If variable Then, etc., etc...

Leave a comment on “Visual Basic Triple Play”

Log In or post as a guest

Replying to comment #:

« Return to Article