syntax.vb

« Return to Article
  • Aaron 2008-09-19 08:07
    Public Sub begin_comment()
    begin()
    End
    End Sub
  • Gerino 2008-09-19 08:17
    The goggles!
    They do none()!
  • bbobb 2008-09-19 08:24
    I see the WTF in the in_() functions. They really only needed the first one; the rest were redundant and limiting. What if they had 22 items? They could have solved it much more elegantly as:

    result = in_(v,p1) OrElse in_(v,p2) OrElse in_(v,p3) ... OrElse in_(v,p20) OrElse in_(v,p21) OrElse in_(v,p22)

    :-þ
  • JonC 2008-09-19 08:26
    This is one of the first entries in a while to actually make me say WTF!

    Not least for the fact that the developer hasn't heard of ParamArrays in VB.NET
    The whole thing is a complete trainwreck
  • Me 2008-09-19 08:31
    I WANNA KNOW WHAT begin() DOES!!!!!
  • Me 2008-09-19 08:32
    Me:
    I WANNA KNOW WHAT begin() DOES!!!!!


    Oh wait... it does nothing. Never mind.
  • fuzzix 2008-09-19 08:33
    More accurately, they were the Long set of _in() methods.
    Aren't they in_() methods?
    Though he suspected that the ECC system was yet another tentacle of the great Codethulhu...
    Isn't it CEE?

    The quality of MFD is seeping into the articles! NOOO!
  • David 2008-09-19 08:34
    Me:
    I WANNA KNOW WHAT begin() DOES!!!!!

    It's an alias for goggles()
  • bg 2008-09-19 08:36
    Me:
    I WANNA KNOW WHAT begin() DOES!!!!!
    I WANT YOU TO SHOW MEEE...
  • derfy 2008-09-19 08:40
    And now I'm going to have that running through my head all day. :(


    Hrm, 'gravis'. Two blasts from the past. Now all I need is a rickroll and my Friday is complete.
  • iusto 2008-09-19 08:44
    The real WTF is giving a "VB programmer" VB.NET and turning them lose to ruin the name of .NET :(
  • blub 2008-09-19 08:45
    TRWTF is not using VB6!
  • Grammatischer Sturmführer 2008-09-19 08:52
    iusto:
    and turning them lose


    Wow, one so seldom sees confusing 'lose' and 'loose' this way. Usually it is the other way around.
  • Zab Brannigan 2008-09-19 09:09
    This kind of pisses me off! If I saw this at work I become (more?) physically and verbally abusive. I've seen something similar. We had a consultant that was Unix bigot. He created a Unix shell for DOS on his PC by using .bat files and renaming system commands. Of course, after seeing this, another programmer made a DOS shell for Unix.
  • snoofle 2008-09-19 09:11
    While I agree that overloading everything is horrifying, I can see the need for optional begin() and end() methods, though not implemented quite this way...

    Think about it, if you rename them preProcessing() and postProcessing(), they make nice placeholders for data transformations. Most app servers and messaging systems have hooks for these sorts of things, except that they implement it properly.
  • snoofle 2008-09-19 09:15
    Zab Brannigan:
    ...created a Unix shell for DOS on his PC by using .bat files and renaming system commands. Of course, after seeing this, another programmer made a DOS shell for Unix.

    As someone who frequently has to work in both environments, I can see why he did this, and it has nothing to do with elitism.

    You know two different sets of commands to perform the same actions. Invariably, you end up typing the Unix commands when in a DOS window, and the DOS commands when in a Unix window. It's just easier to have aliases or scripts that implement the other set of commands in each environment so no matter which command you enter, it still performs your intended action.
  • Bruce 2008-09-19 09:16
    The code isn't so bad. I've seen MUCH worse. The Begin() is obviously there for debugging purposes so that they could put a logging statement into the Begin function when desired.
    That's not the right way to do it in .NET, but it would work.

    The in_ functions are interesting - doesn't VB.Net have VarArgs?
  • gabba 2008-09-19 09:17
    snoofle:
    While I agree that overloading everything is horrifying, I can see the need for optional begin() and end() methods, though not implemented quite this way...

    Think about it, if you rename them preProcessing() and postProcessing(), they make nice placeholders for data transformations. Most app servers and messaging systems have hooks for these sorts of things, except that they implement it properly.


    Good thinking. But why stop there? You're gonna need a afterPreProcessing(), a midProcessing(), a beforePostProcessing(), and perhaps many others. Gotta plan ahead.
  • Bruce 2008-09-19 09:21
    Zab Brannigan:
    This kind of pisses me off! If I saw this at work I become (more?) physically and verbally abusive. I've seen something similar. We had a consultant that was Unix bigot. He created a Unix shell for DOS on his PC by using .bat files and renaming system commands. Of course, after seeing this, another programmer made a DOS shell for Unix.

    I worked with a programmer who didn't like C++ very much so he defined preprocessor macros so that he could make his code look like FORTRAN. Now that was a WTF!
    #define EQ ==
    #define begin {
    #defing end }
    etc...
  • snoofle 2008-09-19 09:21
    gabba:
    snoofle:
    While I agree that overloading everything is horrifying, I can see the need for optional begin() and end() methods, though not implemented quite this way...

    Think about it, if you rename them preProcessing() and postProcessing(), they make nice placeholders for data transformations. Most app servers and messaging systems have hooks for these sorts of things, except that they implement it properly.


    Good thinking. But why stop there? You're gonna need a afterPreProcessing(), a midProcessing(), a beforePostProcessing(), and perhaps many others. Gotta plan ahead.

    I know you're joking, but some messaging systems I've worked on actually had the following:


    - pre processing hook
    - hook after underlying system starts but before getting to
    your transformation
    - hook after transformation but before sending message
    - hook after sending message but before cleanup
    - hook after cleanup

    and then the same thing on the receiving side

  • snoofle 2008-09-19 09:26
    Bruce:

    I worked with a programmer who didn't like C++ very much so he defined preprocessor macros so that he could make his code look like FORTRAN. Now that was a WTF!
    #define EQ ==
    #define begin {
    #defing end }
    etc...

    A guy I worked with when we migrated from Pascal to C (very long time ago) did this to turn C into Pascal-looking code.

    I can sort of see why someone would be psychologically attached to a language, but folks, ya gotta learn to let go!
  • Bob 2008-09-19 09:33
    Hang on a minute, you're saying that every method in the codebase calls "begin()" but the begin method actually does nothing? Wow, just wow. You can't even argue that this is for some pre processing operation, since the same begin method is called from every other method. Unless every single method in the system requires the same pre processing which is wholly unrealistic and would undoubtedly hint at a far bigger WTF that the ones on display today. Just what the fu... oh, there it is.
  • h 2008-09-19 09:37
    bbobb:
    I see the WTF in the in_() functions. They really only needed the first one; the rest were redundant and limiting. What if they had 22 items? They could have solved it much more elegantly as:

    result = in_(v,p1) OrElse in_(v,p2) OrElse in_(v,p3) ... OrElse in_(v,p20) OrElse in_(v,p21) OrElse in_(v,p22)

    :-þ

    I don't get why he didn't reuse his code for more elegantly problem solvings...

    Public Function in_(ByVal v As Long, ByVal p1 As Long, ByVal p2 As Long, _
    ByVal p3 As Long, ByVal p4 As Long, ByVal p5 As Long, _
    ...
    ByVal p18 As Long, ByVal p19 As Long, ByVal p20 As Long _
    ) As Boolean
    begin()
    Return in_(v,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10) OrElse in_(v,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20)
    End Function 'in_(20)


    Makes much more sense to me - best practices at their... best..
  • JiffyPop 2008-09-19 09:38
    The whole data acquisition system at the lab I worked at had C/C++ as FORTRAN macros. It wasn't used by the people writing the underlying code (including a custom Linux kernel), but the physicists abused it appropriately. Surprised the heck out of me when I discovered it, though.
  • cod3_complete 2008-09-19 09:42
    WTF just WTF. This crap code looks surprisingly familiar to some kludges I've seen before. I would bet 10 bucks that this moron was a former vb6 coder who was 'drafted' to work with VB.NET. *Sigh*
  • blah 2008-09-19 09:49
    Maybe author read an article on AOP and tried to cram it into the app and then gave up.
  • bluprintz 2008-09-19 09:54
    Looks like someone is trying to implement Aspect Oriented Programming... for Visual Basic.

    The begin() is obviously addressing some cross-cutting concerns.

    Run! Run away now!
  • Zab Brannigan 2008-09-19 09:56
    snoofle:
    Zab Brannigan:
    ...created a Unix shell for DOS on his PC by using .bat files and renaming system commands. Of course, after seeing this, another programmer made a DOS shell for Unix.

    As someone who frequently has to work in both environments, I can see why he did this, and it has nothing to do with elitism...
    Based on a single point of data you have drawn a reasonable conclusion. I worked with the fellow a couple of years. I believe his brain cavity is filled with Portland cement.
  • sir_flexalot 2008-09-19 09:59
    Now that is some serious WTF code! I love the 'recreate the language with the language' ones.
  • OneMHz 2008-09-19 10:00
    if(boolVal)

    No...

    if(true_(boolVal))

    No...

    if(true_(boolVal) = _true(True))

    No...

    if(true_(boolVal) = _true(_true(True)))

    .... damnit, now I need to write in_ methods for boolean types. I'll need 5 overloads for true, false, FileNotFound, -1, Tuesday, not set and unknown.
  • JM 2008-09-19 10:02
    snoofle:
    gabba:
    snoofle:
    While I agree that overloading everything is horrifying, I can see the need for optional begin() and end() methods, though not implemented quite this way...

    Think about it, if you rename them preProcessing() and postProcessing(), they make nice placeholders for data transformations. Most app servers and messaging systems have hooks for these sorts of things, except that they implement it properly.


    Good thinking. But why stop there? You're gonna need a afterPreProcessing(), a midProcessing(), a beforePostProcessing(), and perhaps many others. Gotta plan ahead.

    I know you're joking, but some messaging systems I've worked on actually had the following:


    - pre processing hook
    - hook after underlying system starts but before getting to
    your transformation
    - hook after transformation but before sending message
    - hook after sending message but before cleanup
    - hook after cleanup

    and then the same thing on the receiving side

    And importantly, this is not a WTF, it's what's good for you -- as long as actually implementing each of those hooks is optional, of course. Hooks are good. Love the hooks. Good for extensibility.

    Of course, we are talking about messaging systems here. Doing this for every method is either insanity (if you do it manually) or aspect-oriented programming (if you do it automatically). The jury's still out on the usefulness of the latter...
  • akatherder 2008-09-19 10:03
    snoofle:
    Bruce:

    I worked with a programmer who didn't like C++ very much so he defined preprocessor macros so that he could make his code look like FORTRAN. Now that was a WTF!
    #define EQ ==
    #define begin {
    #defing end }
    etc...

    A guy I worked with when we migrated from Pascal to C (very long time ago) did this to turn C into Pascal-looking code.

    I can sort of see why someone would be psychologically attached to a language, but folks, ya gotta learn to let go!


    They get real pissy when you do a search and replace.

    When I was a sysadmin, we all had our "specialty" but we all worked on UNIX and Windows systems. We had the informal standard of turning windows terminals one color and UNIX the other color (white on black vs. black on white) and that helped out surprisingly well to keep you in the right mindset of whether to use ls or dir.
  • rg 2008-09-19 10:04
    I think the guy had good intentions with the begin()... end() stuff. Those would make good debugging and tracing hooks, BUT he could not figure out, because it's impossible, how to put in a single end() call and still do a return someexpression from multiple places..

    I would not have a big problem with having just one layer of abstraction on the equality tests, but having it go many times wide and deep is a bit much. Especially since the code does not really do anything. Maybe this guy was being paid by the line?
  • fruey 2008-09-19 10:09
    snoofle:
    Zab Brannigan:
    ...created a Unix shell for DOS on his PC by using .bat files and renaming system commands. Of course, after seeing this, another programmer made a DOS shell for Unix.

    As someone who frequently has to work in both environments, I can see why he did this, and it has nothing to do with elitism.

    You know two different sets of commands to perform the same actions. Invariably, you end up typing the Unix commands when in a DOS window, and the DOS commands when in a Unix window. It's just easier to have aliases or scripts that implement the other set of commands in each environment so no matter which command you enter, it still performs your intended action.


    Personally I find it usually helps when I type "ls" and I get an error, to remind me that I'm in DOS.

    Because one day, I might be in DOS somewhere else and will not have my batch files. Or vice versa with a POSIX bash shell, or something.
  • TopCod3r 2008-09-19 10:19
    TRWTF is that Hank doesn't understand OO programming in VB. It is obvious, to me anyways, that begin() is implemented in another class that inherits from this one, but is not shown. All methods in VB are virtual, and this WTF leaves out important details in determining if the WTF is in the code or in Hank's grossly inadequate VB knowledge.
  • Code Slave 2008-09-19 10:20
    I'd be happy if the goggles did nothing... instead they magnify and intensify!!!! Arg!!! My retinas be burned to a crisp!
  • TopCod3r 2008-09-19 10:22
    rg:
    I think the guy had good intentions with the begin()... end() stuff. Those would make good debugging and tracing hooks, BUT he could not figure out, because it's impossible, how to put in a single end() call and still do a return someexpression from multiple places..


    Wow, you are a walking WTF! Ever hear of Try/Catch/FINALLY?
  • DaveAronson 2008-09-19 10:22
    Zab Brannigan:
    We had a consultant that was Unix bigot. He created a Unix shell for DOS on his PC by using .bat files and renaming system commands.
    Sounds like a wannabe, who never heard of Cygwin.
    Of course, after seeing this, another programmer made a DOS shell for Unix.
    Not surprising. Coughcough years ago, when I were a lad, in college, a bunch of us made (and traded) alias-scripts so we could use our familiar TOPS-20 commands when we got access to a Unix box. Gotta admit, the command names do tend to be rather cryptic....
  • snoofle 2008-09-19 10:23
    Zab Brannigan:
    I worked with the fellow a couple of years. I believe his brain cavity is filled with Portland cement.

    I too have had the, ahem, pleasure, of working with someone like that. Thanks for the laugh!
  • snoofle 2008-09-19 10:26
    DaveAronson:
    Sounds like a wannabe, who never heard of Cygwin.

    It's possible he's heard of it, but is unable to install it (some places restrict installation of software).

    I would love to have cygwin, but can't install it, so I have a bin directory full of batch files implementing unix command equivalents... especially useful for stuff that doesn't have DOS equivalents.
  • Flagger 2008-09-19 11:11
    Bob:
    Hang on a minute, you're saying that every method in the codebase calls "begin()" but the begin method actually does nothing? Wow, just wow. You can't even argue that this is for some pre processing operation, since the same begin method is called from every other method. Unless every single method in the system requires the same pre processing which is wholly unrealistic and would undoubtedly hint at a far bigger WTF that the ones on display today. Just what the fu... oh, there it is.

    You underestimate the power of global variables.
  • Some dude 2008-09-19 11:40
    TRWTF is VB. I'm surprised nobody has recognized that, yet.
  • jDeepBeep 2008-09-19 11:45
    I lost about 4 IQ points, permanently, from reading through that.
  • yet another anonymous coward 2008-09-19 12:07
    true_(), false_(), remainder() etc are not WTF, because in VB.NET, as far as I remember it (I'm not VB programmer) functions are first-class objects, but operators aren't. So if you need to generate some code at runtime they may come useful. Or not.

    begin() is WTF because having dummy calls just everywhere is probably greatly affecting the code's performance. It can be used for some hook system, though.

    in_() is a genuine WTF, because it really should be implemented with proper Set datatype with polyvariadic helper functions, so new sets could be generated and checked by some simple Set(1,2,3,4,5).Contains(2). If sets are homogeneous, generics should help with strongly-typed collections, like SetOf<Integer>, further improving code quality.


    Eh, and my English is probably a WTF too...
  • Satanicpuppy 2008-09-19 12:29
    Zab Brannigan:
    This kind of pisses me off! If I saw this at work I become (more?) physically and verbally abusive. I've seen something similar. We had a consultant that was Unix bigot. He created a Unix shell for DOS on his PC by using .bat files and renaming system commands. Of course, after seeing this, another programmer made a DOS shell for Unix.


    I work on Unix, Windows, and MPE/iX systems constantly, which means I'm constantly unable to list the files in a directory because I type "LISTF" or "ls -al" or "DIR" without thinking.

    So yea, I have those things aliased with batch files, shell scripts, and actual aliases, so regardless which system I'm in, they all work, and I don't derail my train of thought for the sake of some trivial piece of syntax.

    If you worked on multiple OS's this would seem normal, and since the commands don't actually overlap at all, your snobbery is completely unnecessary.

    If he was really just a snob, he'd have used cygwin.
  • Satanicpuppy 2008-09-19 12:31
    fruey:
    snoofle:
    Zab Brannigan:
    ...created a Unix shell for DOS on his PC by using .bat files and renaming system commands. Of course, after seeing this, another programmer made a DOS shell for Unix.

    As someone who frequently has to work in both environments, I can see why he did this, and it has nothing to do with elitism.

    You know two different sets of commands to perform the same actions. Invariably, you end up typing the Unix commands when in a DOS window, and the DOS commands when in a Unix window. It's just easier to have aliases or scripts that implement the other set of commands in each environment so no matter which command you enter, it still performs your intended action.


    Personally I find it usually helps when I type "ls" and I get an error, to remind me that I'm in DOS.

    Because one day, I might be in DOS somewhere else and will not have my batch files. Or vice versa with a POSIX bash shell, or something.


    It's not like he doesn't know the difference. But it saves a ton of time in the long run to have that stuff just work regardless of the system.
  • Sean D 2008-09-19 12:52
    The real WTF is that he only has begin() and end(). Where's "middle()"? Or how about "keep_going()"?

    If you don't tell your code to keep running, it's just going to sit there doing nothing.
  • Steve 2008-09-19 12:59
    Oh my.

    I wonder if some of this isn't an artifact of some kind of crude code instrumentation. Not being a VB programmer, I'm not sure what facilities there are for tracking function/method usage and/or timing of routines (I assume there is some) but in that context this make some vague amount of sense.

    It may have seemed a good idea at the time.

    Either that or the programmer was completely bonkers.
  • Maurits 2008-09-19 13:03
    What's wrong with in_? Seems reasonable to me. The 20 methods could have been generated code.
  • gisTimmy 2008-09-19 13:52
    bbobb:
    I see the WTF in the in_() functions. They really only needed the first one; the rest were redundant and limiting. What if they had 22 items? They could have solved it much more elegantly as:

    result = in_(v,p1) OrElse in_(v,p2) OrElse in_(v,p3) ... OrElse in_(v,p20) OrElse in_(v,p21) OrElse in_(v,p22)

    :-þ


    Even more *elegant*:

    Public Function in_(ByVal v As Long, ByVal p1 As Long) As Boolean
    begin()
    Return v = p1
    End Function 'in_(1)

    Public Function in_(ByVal v As Long, ByVal p1 As Long, ByVal p2 As Long) As Boolean
    begin()
    Return in_(v, p1) OrElse in_(v, p2)
    End Function 'in_(2)

    Public Function in_(ByVal v As Long, ByVal p1 As Long, ByVal p2 As Long, _
    ByVal p3 As Long) As Boolean
    begin()
    Return in_(v, p1, p2) OrElse in_(v, p3)
    End Function 'in_(3)

    Public Function in_(ByVal v As Long, ByVal p1 As Long, ByVal p2 As Long, _
    ByVal p3 As Long, ByVal p4 As Long) As Boolean
    begin()
    Return in_(v, p1, p2, p3) OrElse in_(v, p4)
    End Function 'in_(4)
  • m0ffx 2008-09-19 13:55
    The most important is carry_on(). That one actually does something before returning. It adds 60's and 70's British comedy to your code.
  • Franz_Kafka 2008-09-19 14:00
    Zab Brannigan:
    This kind of pisses me off! If I saw this at work I become (more?) physically and verbally abusive. I've seen something similar. We had a consultant that was Unix bigot. He created a Unix shell for DOS on his PC by using .bat files and renaming system commands. Of course, after seeing this, another programmer made a DOS shell for Unix.


    I guess he never heard of cygwin...

    Still, MS behavior irritates me, but it isn't worth that sort of hassle.
  • moowar 2008-09-19 15:00

    Function in_(ByVal ParamArray v() As Object) As Boolean
    If IsArray(v) And UBound(v) > 1 Then
    Dim i
    For i = 1 To UBound(v)
    in_ = (v(0) = v(i))
    If in_ Then Exit For
    Next i
    End If
    End Function
  • danixdefcon5 2008-09-19 15:13
    VB is already an ugly syntax with its insistence of using words as code block delimiters. But it seems like whoever did this code didn't think that was enough, as it seems like begin() works basically as a code delimiter.

    Or maybe, just maybe, begin() is actually the Call of Codethulu
  • danixdefcon5 2008-09-19 15:14
    Franz_Kafka:
    Zab Brannigan:
    This kind of pisses me off! If I saw this at work I become (more?) physically and verbally abusive. I've seen something similar. We had a consultant that was Unix bigot. He created a Unix shell for DOS on his PC by using .bat files and renaming system commands. Of course, after seeing this, another programmer made a DOS shell for Unix.


    I guess he never heard of cygwin...

    Still, MS behavior irritates me, but it isn't worth that sort of hassle.
    Or SFU. (Services For Unix, that is.) It adds a nice Interix subsystem to Windows and you can Unix your way around Windows, using ksh or csh.
  • real_aardvark 2008-09-19 15:27
    danixdefcon5:
    Franz_Kafka:
    Zab Brannigan:
    This kind of pisses me off! If I saw this at work I become (more?) physically and verbally abusive. I've seen something similar. We had a consultant that was Unix bigot. He created a Unix shell for DOS on his PC by using .bat files and renaming system commands. Of course, after seeing this, another programmer made a DOS shell for Unix.


    I guess he never heard of cygwin...

    Still, MS behavior irritates me, but it isn't worth that sort of hassle.
    Or SFU. (Services For Unix, that is.) It adds a nice Interix subsystem to Windows and you can Unix your way around Windows, using ksh or csh.
    Yes, SFU was a thing of surpassing loveliness. Of course, it was never open-sourced, because that would make no sense at all, would it? And, of course, it's only available on 32-bit systems, which effectively means that it's discontinued.

    The BallRog giveth and the BallRog taketh away.

    Sometimes I wonder what goes on inside Steve's sweaty little Marketing Guru head.
  • real_aardvark 2008-09-19 15:29
    bluprintz:
    Looks like someone is trying to implement Aspect Oriented Programming... for Visual Basic.

    The begin() is obviously addressing some cross-cutting concerns.

    Run! Run away now!
    I believe the term you're looking for is Abject Oriented Programming.

    Oh, wait ... there's no difference, is there?
  • CoyneT 2008-09-19 16:31
    h:
    bbobb:
    I see the WTF in the in_() functions. They really only needed the first one; the rest were redundant and limiting. What if they had 22 items? They could have solved it much more elegantly as:

    result = in_(v,p1) OrElse in_(v,p2) OrElse in_(v,p3) ... OrElse in_(v,p20) OrElse in_(v,p21) OrElse in_(v,p22)

    :-þ

    I don't get why he didn't reuse his code for more elegantly problem solvings...
    Public Function in_(ByVal v As Long, ByVal p1 As Long, ByVal p2 As Long, _
    
    ByVal p3 As Long, ByVal p4 As Long, ByVal p5 As Long, _
    ...
    ByVal p18 As Long, ByVal p19 As Long, ByVal p20 As Long _
    ) As Boolean
    begin()
    Return in_(v,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10) OrElse in_(v,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20)
    End Function 'in_(20)


    Makes much more sense to me - best practices at their... best..


    Nah. It needs to be the other way:
    Public Function in_(ByVal v As Long, ByVal p1 As Long, ByVal p2 As Long, _
    
    ByVal p3 As Long, ByVal p4 As Long, ByVal p5 As Long, _
    ...
    ByVal p18 As Long, ByVal p19 As Long, ByVal p20 As Long _
    ) As Boolean
    begin()
    Return v = p1 OrElse v = p2 OrElse v = p3 ... OrElse v = p20
    End Function 'in_(20)


    Then 19 can be defined on 20:
    Public Function in_(ByVal v As Long, ByVal p1 As Long, ByVal p2 As Long, _
    
    ByVal p3 As Long, ByVal p4 As Long, ByVal p5 As Long, _
    ...
    ByVal p18 As Long, ByVal p19 As Long
    ) As Boolean
    begin()
    Return in_(v,p1,p2,p3,...,p18,p19,p19)
    End Function 'in_(19)


    Then the in_(18) function:
    Public Function in_(ByVal v As Long, ByVal p1 As Long, ByVal p2 As Long, _
    
    ByVal p3 As Long, ByVal p4 As Long, ByVal p5 As Long, _
    ...
    ByVal p18 As Long
    ) As Boolean
    begin()
    Return in_(v,p1,p2,p3,...,p18,p18)
    End Function 'in_(18)


    See? That way there's only one actual expression to maintain, in the in_(20) function. Everything else gets defined on the 20 parameter version.

    Greatly reduces the potential for bugs in the system.
  • blunder 2008-09-19 16:43
    A lot of us work on multiple systems. I work on multiple systems. Windows, Mac, Linux, SCO Unix. I don't alias the commands.

    It sounds harsh but it's always just seemed to me to be a redneck way of doing things. They only help in the most basic situations. Even 'ls' does not behave like dir, and they do not support the same switches. The syntax for creating loops is fairly different. So you'd need a lot of aliases. Why go that far for what amounts to putting matching lipstick on a variety of pigs?

    I really wouldn't call it snobbery. It's not like the practice hurts anyone, but you shouldn't be above getting ribbed for it a little, given its hackish nature.
  • JohnFx 2008-09-19 16:58
    Me:
    I WANNA KNOW WHAT begin() DOES!!!!!


    If a constructor for a class is good thing, then a constructor for each method must be even better, right? The only downside is that you have to roll it yourself.

    On top of that he is promoting code reuse by having all the method constructors call the same block. He just hasn't written the massive case statement that uses reflection to determine which block called it and execute the appropriate intialization code.

    And you guys were skeptical. Sheesh. This guy is a pioneer!

    </sarcasm>


  • real_aardvark 2008-09-19 17:16
    CoyneT:
    <code snip -- vide supra/>
    See? That way there's only one actual expression to maintain, in the in_(20) function. Everything else gets defined on the 20 parameter version.

    Greatly reduces the potential for bugs in the system.
    Well, we're about fifty-odd posts in, and AFAIK, nobody has yet mentioned the oddity of naming a file (with any extension) "CustomerClass."

    "Class"?

    I first realised that I was sickening for something, possibly a gin and tonic, when it occurred to me that I actually understood the VB.NET. This will never do.

    I then started to think about the naming convention. What is this? Is there a "CustomerObject.vb"? And, if not, what's the purpose of adding "Class" to anything? (Not that there is any.) I mean, it's not as if there's any useful-type Hungarian notation prepended to the file name to let us know whether or not it's NQOT ("Not Quite Our Type").

    Maybe it uses .NET reflection to automagically generate a CustomerObject.mdl file. Yes, that would be it. It's VB.NET masquerading as Smalltalk! First Class!

    However, on reflection, you could have a point here. It's more likely to be VB.NET masquerading as a true functional language that relies entirely on recursion (good luck on avoiding the side-effects of ON ERROR RETURN NEXT, but I assume that's an exercise for the reader.)

    Finally, VB.NET embraces Greenspun's Tenth Law!

    PS. What are the other nine?
  • Butter 2008-09-19 17:23
    rg:
    I think the guy had good intentions with the begin()... end() stuff. Those would make good debugging and tracing hooks, BUT he could not figure out, because it's impossible, how to put in a single end() call and still do a return someexpression from multiple places..
    return end(ReturnVal)
    Public Function end(Ret as Any) as Any
    return Ret
    End Function

    Doesn't solve the issue of being a massive WTF, but it works.
  • mxsscott 2008-09-19 18:33
    This has actually gone through several revisions of 'optimization'. The begin() method used to contain 'sleep(5)', and has since been optimized 5 times.
  • Scott Nelson 2008-09-19 18:58
    My guess is that he uses the context menu to right-click on the function and then clicks "Definition", that way if the "Begin()" function is at the "beginning" of the document, the cursor goes up there and he is at the top. So that shows another WTF, he didn't know of the "Ctrl+Home" key combo to do that.
  • savar 2008-09-20 00:35
    Aaron:
    Public Sub begin_comment()
    begin()
    End
    End Sub



    This joke is getting more annoying than good ole' fist, because at least the fist people know they're being stupid.
  • Function Array_Length 2008-09-20 01:10
    Public Function Array_Length(ByVal Length As Integer) As Integer
    
    begin()
    Return Length - 1
    End Function 'Array_Length

    This one just made my head explode. You'd expect that a function called "Array_Length" would, say, return the length of an array, but no... this one takes an integer as its input, substracts one, and returns it. In other words:

    myArray.Length == Array_Length(myArray.Length) + 1

    Or you could replace "while(i < myArray.Length)" with "while (i <= Array_Length(myArray.Length))". Whee?
  • Adam 2008-09-20 03:26
    TopCod3r:
    All methods in VB are virtual, and this WTF leaves out important details in determining if the WTF is in the code or in Hank's grossly inadequate VB knowledge.


    No they aren't, that's what the Overridable keyword is for. Before you jump on others' VB knowledge, you may want to check your own.

  • WilliamV 2008-09-20 09:36
    how about go_to() and come_from() ?
  • TopCod3r 2008-09-20 09:41
    Adam:
    TopCod3r:
    All methods in VB are virtual, and this WTF leaves out important details in determining if the WTF is in the code or in Hank's grossly inadequate VB knowledge.


    No they aren't, that's what the Overridable keyword is for. Before you jump on others' VB knowledge, you may want to check your own.



    Um, the overridable keyword does not make a method virtual or not, it just determines whether it can be overridden.

    Unlike other languages (that are inferior to VB), in VB you do not have to specify virtual in the declaration in order to get the virtual behavior.

    I bet my little finger has forgotten more VB than you will ever know.

    By the way, I have passed THREE BrainBench assessments in VB, and scored over 90% on a MeasureUp assessment. My company will be paying for me to pursue the MCAD next year, so I think that tells you all you need to know about by qualifications.
  • real_aardvark 2008-09-20 14:46
    TopCod3r:
    Adam:
    TopCod3r:
    All methods in VB are virtual, and this WTF leaves out important details in determining if the WTF is in the code or in Hank's grossly inadequate VB knowledge.


    No they aren't, that's what the Overridable keyword is for. Before you jump on others' VB knowledge, you may want to check your own.



    Um, the overridable keyword does not make a method virtual or not, it just determines whether it can be overridden.

    Unlike other languages (that are inferior to VB), in VB you do not have to specify virtual in the declaration in order to get the virtual behavior.

    I bet my little finger has forgotten more VB than you will ever know.

    By the way, I have passed THREE BrainBench assessments in VB, and scored over 90% on a MeasureUp assessment. My company will be paying for me to pursue the MCAD next year, so I think that tells you all you need to know about by qualifications.
    Eek!

    We should all learn a lesson from this. Maybe THREE lessons.
  • Rosco 2008-09-20 16:51
    or, use the params keyword. I know C# has it, and i'm just assuming vbnet has it too.

    then loop through all of the items ...
  • imalc 2008-09-20 16:55
    Okay it is clear that the author comes from a Pascal or Delphi background.

    What would be really the icing on the cake would be if they went back to using Delphi and then made that look like VB!
  • Maarten 2008-09-20 18:07
    CEE probably stands for Customer ENTERPRISE Engagement.
  • dkf 2008-09-20 18:22
    real_aardvark:
    We should all learn a lesson from this. Maybe THREE lessons.
    The only lesson I care to draw is that non-virtual methods are a bad dream perpetrated by C++ during one of many fits of "sacrifice much sanity for a little speed".
  • Wessel 2008-09-21 09:07

    Function In_(Of T As IComparable)(ByVal ParamArray values() As T) As Boolean
    If values.Length Mod 2 <> 0 Then Throw New ArgumentException()

    Dim q = From v In values _
    Let index As Integer = Array.IndexOf(values, v) _
    Where v.CompareTo(values(index + 1)) = 0

    Return q.Count() = values.Count()
    End Function
  • Wessel 2008-09-21 09:13
    Eek!


    Function In_(Of T As IComparable)(ByVal ParamArray values() As T) As Boolean
    If values.Length Mod 2 <> 0 Then Throw New ArgumentException()

    Dim q = From v In values _
    Let index As Integer = Array.IndexOf(values, v) _
    Where index = values.Count - 1 OrElse v.CompareTo(values(index + 1)) = 0

    Return q.Count() = values.Count()
    End Function


    Well it's still damn ugly :D
  • real_aardvark 2008-09-21 09:46
    dkf:
    real_aardvark:
    We should all learn a lesson from this. Maybe THREE lessons.
    The only lesson I care to draw is that non-virtual methods are a bad dream perpetrated by C++ during one of many fits of "sacrifice much sanity for a little speed".
    Eek!
  • VB6Coder 2008-09-21 18:02
    Wessel:
    Eek!


    Function In_(Of T As IComparable)(ByVal ParamArray values() As T) As Boolean
    If values.Length Mod 2 <> 0 Then Throw New ArgumentException()

    Dim q = From v In values _
    Let index As Integer = Array.IndexOf(values, v) _
    Where index = values.Count - 1 OrElse v.CompareTo(values(index + 1)) = 0

    Return q.Count() = values.Count()
    End Function




    This must be the most evil code I have ever seen. Why should an odd number of parameters cause an exception?

    In VB6, we don't need all that horrible overloading nonsense, we have variants!


  • psychodrive 2008-09-22 02:25
    Perhaps he needed somewhere to put breakpoints.
  • Dark 2008-09-22 04:55
    VB6Coder:

    This must be the most evil code I have ever seen. Why should an odd number of parameters cause an exception?

    For those use-cases you would use In_Odd_(), of course. It's not a good idea to try to make a single function do everything.
  • Olipro 2008-09-22 05:20
    One can only assume that he was paid according to the amount of code he wrote, what other logical conclusion can you draw about a man who creates functions that do nothing, and the proceeds to call them from absolutely everywhere?

    And I can just imagine that once he finished, they had a guy review his code, note the dishonesty and promptly fire him with no payment.
  • ClaudeSuck.de 2008-09-22 06:24
    Me:
    I WANNA KNOW WHAT begin() DOES!!!!!


    Plz send me teh codez
  • ClaudeSuck.de 2008-09-22 06:49
    real_aardvark:
    bluprintz:
    Looks like someone is trying to implement Aspect Oriented Programming... for Visual Basic.

    The begin() is obviously addressing some cross-cutting concerns.

    Run! Run away now!
    I believe the term you're looking for is Abject Oriented Programming.

    Oh, wait ... there's no difference, is there?


    Absynth Oriented Programming.

    FTFY

  • the real wtf fool 2008-09-22 07:13
    fuzzix:
    More accurately, they were the Long set of _in() methods.
    Aren't they in_() methods?
    Though he suspected that the ECC system was yet another tentacle of the great Codethulhu...
    Isn't it CEE?

    The quality of MFD is seeping into the articles! NOOO!


    You must be new here? Codethulhu predates MFD.
  • the real wtf fool 2008-09-22 07:20
    bg:
    Me:
    I WANNA KNOW WHAT begin() DOES!!!!!

    I WANT YOU TO SHOW MEEE...


    I wanna feel what begin() does
    I know you can show me

    Now this vb I must fix
    Feels like a world upon my shoulders
    Through the goggles I see these horrors
    It makes me die inside a little more

    In my code theres been end_block() and none()
    I dont know if I can face block() again
    Cant stop now, I've travelled so far
    To fix this CEE system

    I wanna know what true_() is
    I want you to show me
    I wanna feel what true_() is
    I know you can show me

    etc.

  • Innkeeper 2008-09-22 09:35
    You are all fools! He was using this project to create artificial intelligence. He needed to teach the code every possibility so the computer will gain awareness.
  • dogz 2008-09-22 11:51
    Function Array_Length:
    Public Function Array_Length(ByVal Length As Integer) As Integer
    
    begin()
    Return Length - 1
    End Function 'Array_Length

    This one just made my head explode. You'd expect that a function called "Array_Length" would, say, return the length of an array, but no... this one takes an integer as its input, substracts one, and returns it. In other words:

    myArray.Length == Array_Length(myArray.Length) + 1

    Or you could replace "while(i < myArray.Length)" with "while (i <= Array_Length(myArray.Length))". Whee?

    I suspect that the code was written by one of those individuals that cannot get their head around zero-based indexes, i.e. the kind of person that uses "Option Base 1" in VB6.

    They should not be allowed to touch computers.
  • cheeseplease 2008-09-22 11:52
    VB6Coder:

    In VB6, we don't need all that horrible overloading nonsense, we have variants!

    Go to your room!
  • moowar 2008-09-22 12:17
    Wessel:
    Eek!


    Function In_(Of T As IComparable)(ByVal ParamArray values() As T) As Boolean
    If values.Length Mod 2 <> 0 Then Throw New ArgumentException()

    Dim q = From v In values _
    Let index As Integer = Array.IndexOf(values, v) _
    Where index = values.Count - 1 OrElse v.CompareTo(values(index + 1)) = 0

    Return q.Count() = values.Count()
    End Function


    Well it's still damn ugly :D


    They're not liked pairs, it's just checking if the others match the first one.


    Function In_(Of t As IComparable)(ByVal ParamArray values() As t) As Boolean
    If values.Length < 2 Then Exit Function
    Dim q = From v In values Let index As Integer = Array.IndexOf(values, v) Where index > 0
    Return Not (q.Count = (values.Count - 1))
    End Function


    linq will make same values share the same index, so if something matches (0), it will be omiited.
  • Tom 2008-09-22 12:40
    Why not add some goto's too...
  • VxJasonxV 2008-09-22 12:50
    Note to the editor:

    It's slightly odd that the name of the software changes from CEE to ECC after the submitters' romp through the madness.

    :).
  • David 2008-09-23 10:14
    Why not just the "Of" keyword
  • OBloodyhell 2008-09-24 20:49
    Sean D:
    The real WTF is that he only has begin() and end(). Where's "middle()"? Or how about "keep_going()"?

    If you don't tell your code to keep running, it's just going to sit there doing nothing.


    My best guess is that it allowed him to drop in checkpoint and trace routines on demand without going straight to the code in question. Not saying that's the best way to do it, but, if the guy was a converted Microsoft Basic programmer, it may well have been a technique holdover from those days.

    Set a global variable, write an alteration to the begin() code which only printed out location and/or variable states when the global was set (multiple values, too, if you wanted to be more subtle), then run it. Voila. Code tracing and desired variable dumping made easy. The biggest flaw would be his lack of comments to that effect, so someone else would understand the otherwise absurd behavior.
  • _ 2008-09-26 10:18
    This looks like generated code.
  • rebecca 2008-10-24 20:57
    Welcome to our website for maple story mesos and buy maple story mesos and cheap maple story mesos service.
  • ������ѧ 2008-11-17 11:47
    �й����հ�����ѧ��������ѧƵ��������ʡ���İ�����ѧ��Ϣ��Ѷƽ̨����������ȫ������ѧ���µİ�����ѧ��Ѷ�й����̺������мҰ̺۶������й��̺۵������й��̺��������Ͼ��̺۱��ر��й����Ӱ̺��������ϰ״����������ۣ������״���������·�������״�������������״��������������״�����������˫���ɰ״�����������������״���������ŭ���״����������º�״��������˴�״��ʺ�ɫ, ���ϰ״��ʺ�ɫ������, ʱ��֮����, ���ְ״��ʺ�ɫ������, ����ɽ�״��ʺ�ɫ����, �й��״��ʺ�ɫ��������, �Ĵ��״��ʺ�ɫ���ſ��״��ʿ���ɫ����Ϊ�״��ʿ���ɫ�����״��ʿ���ɫ��˾��ý�幫˾���״��ʿ���ɫ��ҵ�����ҵ�ṩ���ϰ״��ʿ���ɫ����������ƽ̨ͨ���״��쳣��˾��Ϊһ��רҵ�״��쳣��˾��ӵ�д���רҵ����״��쳣�˲ţ��״��쳣��˾ƾ��׿Խ�İ״��쳣�˲�ʵ�������״���Ѫ��ʲôԭ���������������״���Ѫ��ʲôԭ��Ƶ�����ṩ�����״���Ѫ��ʲôԭ�򾰵㣬�人�״���Ѫ��ʲôԭ�򾰵㣬�ṩ�人�״���Ѫ��ʲôԭ��˾���人�״���Ѫ��ʲôԭ����·������״���Ѫ����ô�����о����״���Ѫ����ô����ͬʱ���д����״���Ѫ����ô�������������Լ��״���Ѫ����ô������ȫ������״���Ѫ����ô�������˵�����
  • huojia 2009-03-02 00:55
    &nbsp;&nbsp;
    货架racking.&nbsp;&nbsp; 仓储货架
    南京货架设备要产品包括:重型货架
    ,阁楼货架,超市Shelf,重量型货架,横梁式货架,驶入式货架... 仓储笼
    货架的形式与材料 · 立体仓库 · 货架厂
    物流规划设计的步骤与程序(货架的设计... 中国物流行业呈现三足鼎立抢市场 · 亚洲第三方物流的现状和发展 ... 托盘
    抽出式货架系列 · 重力式 货架/推入式货架钢托盘
    移动式货架 · 阁楼式货架 · 悬臂式货架
    系列 长件物料储存货架&nbsp;货架公司