Possibly the worst codebase ever.



  • I'm working on VB6 code written by a Dutch speaker and maintained by an Italian (with variables and comments in those languages), with no indentation whatsoever.

    Rather than use a string array, they repeatedly feed the same massive string literal into a Split function. This is done for every string resource the program uses.

    For reasons beyond my understanding, there is this:
    ikownjou = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...[snip]" & Chr(1)
    ikownjou = ikownjou & "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...[snip]" & Chr(1)

    There are 40 timers on the main form, all arranged in a grid. It looks like Flava Flav's coat of arms.

    Rather than use different resource files for the 8 languages it's translated into, every time a form is loaded all 4 billion captions and menu items are set with a separate call to the 'locale("resource_name")' function which opens a file, looks for the entry for the current language, and closes the file.

    Rather than use "Sub", they always use a "Function" with no return value that's peppered with about 70 "Exit Function" statements throughout its body.

    All the non-static information is crammed in thousands of text files scattered across subfolders of subfolders, rather than in a database. Their version of "SELECT * FROM" is "DIR *.txt".

    I replaced 4002 lines of this:

    Public Function B64Length(ByVal TheString As String) As Integer
        Select Case TheString
            Case "@@"
                B64Length = 0
                Exit Function
            Case "@A"
                B64Length = 1
                Exit Function
            Case "@B"
                B64Length = 2
                Exit Function
            Case "@C"
                B64Length = 3
                Exit Function
            Case "@D"
                B64Length = 4
                Exit Function
    ----------[snip]------------
        End Select
    End Function

    with two lines:

    Private Const B64Compare = "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}- €"
    Public Function B64Length(ByVal strEncoded As String) As Integer
        B64Length = (InStr(1, B64Compare, Left(strEncoded, 1)) - 1) * 64 + (InStr(1, B64Compare, Right(strEncoded, 1)) - 1)
    End Function



  •  What sort of application needs 40 timers on a form?

     I haven't used VB since VB5...but that boggles my mind.



  • btw, 'ikownjou' means  'I own You' or 'I PWN YOU'



  •  @Jonathan Holland said:

     What sort of application needs 40 timers on a form?

     I haven't used VB since VB5...but that boggles my mind.

    The worst possible kind?



  • @Publius said:

    There are 40 timers on the main form, all arranged in a grid. It looks like Flava Flav's coat of arms.
    Not having heard of Falva Flav, and thus unable to visualise his coat of arms, I went in search:

    http://images.google.co.uk/images?svnum=100&um=1&hl=en&q=Flava+Flav+coat+of+arms&btnG=Search+Images

     None of these looks like a VB form I've ever seen. <font color="#ff9900">Should I be looking under ssds://flava+flav+coat+of+arms ?</font>



  • Without bashing the language,

    VB6 cannot spawn a popup menu from a spawned form, if the spawned form was done in the event handler of a popup menu in the main form.  So, if you have main form A, and subform B ... if you right click on A and click the option that spawns B, B can't have a popup menu on it.  The way to do it is to create a timer on A, with an interval of 1ms, and spawn form B.  The timer disables itself in the event, and the timer is enabled by clicking the menu option.  That way VB can dispose of its menu properly without breaking sub forms.



  • @PJH said:

    @Publius said:

    There are 40 timers on the main form, all arranged in a grid. It looks like Flava Flav's coat of arms.
    Not having heard of Falva Flav, and thus unable to visualise his coat of arms, I went in search:

    http://images.google.co.uk/images?svnum=100&um=1&hl=en&q=Flava+Flav+coat+of+arms&btnG=Search+Images

     None of these looks like a VB form I've ever seen. <font color="#ff9900">Should I be looking under ssds://flava+flav+coat+of+arms ?</font>

    @Wikipedia said:
    Flavor Flav's visual trademark is an oversized clock hanging from his neck.

     http://images.google.co.uk/images?q=Flava+Flav

     


     




  •  I admire your courage. If I had to maintain that, sooner or later I would end up on the evening news.

    And after that there would be new legislation on gun control. 



  • @insta said:

    Without bashing the language,

    I think you demonstrated that even just to explain it is inherently to bash it.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.