Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. VB 6

VB 6

Scheduled Pinned Locked Moved The Weird and The Wonderful
dotnetquestionloungelearning
36 Posts 22 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Chris Meech

    At least in English, the poems ryhme. :)

    Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]

    R Offline
    R Offline
    Rob Grainger
    wrote on last edited by
    #10

    Doesn't improve spelling much though, eh?

    1 Reply Last reply
    0
    • L Lutoslaw

      1. Option Explicit Off 2. On Error Goto Label37 3.

      With Object.Its.So.Nested

      (...)

      abc = .Some.Property // WTF?

      (...)

      End With

      4. Global myVar As String = "magic" 5. someInteger = CInt(int1/int2) (divide operator on two ints gives... a double). 6. Non-zero based arrays -- a fantastic source of confusion 7. Propagating null value in nullable boolean logic -- three-state logic? uhm? I won't be suprised if the next VB version would have a fuzzy logic implemented. Not a problem with a language? I don't think so...

      Greetings - Jacek

      R Offline
      R Offline
      Rob Grainger
      wrote on last edited by
      #11

      Jacek Gajek wrote:

      1. Option Explicit Off

      Yes this is horrible, almost as bad as JavaScript doing exactly the same, but with (until ECMAScript5) no equivalent of Option Explicit On.

      Jacek Gajek wrote:

      2. On Error Goto Label37

      Quite horrible, but to blame VB for a fault in BASIC since the year dot is a bit unfair. 3. With/End With - OK, this is truly a mistake. 4. I don't like globals either, but most languages, particularly of that era, support them. 5. someInteger = CInt(int1/int2) (divide operator on two ints gives... a double). Actually - thats pretty correct. Last time I checked 1/2 in mathematics was 0.5, not 0 or 1. Ideally, a language can distinguish integer division and floating-point division, maybe with different operators, but this doesn't seem too horrible to me. 6. Yes, a terrible decision, and Option Base 0 just made things worse, as code in different modules can have different bases. I don't mind base 0 or 1, consistency is really important. 7. Not sure what you're referring to here, but if you mean null-propagation where nulls occur in boolean expressions (where null is an allowable result), that's the only option. Check the literature on Relational DB's (Codd et al.) for the justification. Actually, Codd proposes 4-state logic (Yes,No,Maybe and Inapplicable, Maybe and Applicable). These are not really boolean logic though, but VB, with typed variables (As Boolean) behaves correctly AFAIK. It's not a great language, but most languages have points that are plain bad (JavaScript springs to mind heavily). Programmer's should be able to avoid features that cause problems - that's what they're paid for. I've seen plenty of bad Javascript too - for basically the same reasons as VB. Maybe we should just ban high-level languages ;-)

      S E OriginalGriffO 3 Replies Last reply
      0
      • L Lutoslaw

        Just for your pleasure, I have opened a random VB 6 program from my archive to post some horror. This is from a program which purpose was to teach user doing simple math tasks, that is multipying, dividing, adding and subtracting. Well it worked, but I still don't know a multiplication table by heart. I suppose Command1 was a "Start" button. Of course, the same code was copied to a "Next task" button.

        Private Sub Command1_Click()
        x = InputBox("Enter a name or a nick:", "Name?!", nz)
        If x = "" Then Exit Sub
        nz = x
        kon = False
        Command3.Enabled = True
        Command4.Enabled = True
        dzial.Interval = Text4 * 1000 // adjustable time restrictions, cool
        odp.Interval = Text5 * 1000
        Label1 = ""
        Label8 = ""
        Label1.Visible = True
        il = 0
        oc = 6
        ' Combo2.AddItem "0 - First component (denary)"
        ' Combo2.AddItem "1 - Both components (denary)"
        ' Combo2.AddItem "2 - First component (hundredth)"
        ' Combo2.AddItem "3 - Both components (hundredth)" <== whatever that means... ;)
        If Check1 = 1 Then
        ul = Combo2.ListIndex
        Else
        ul = 124
        End If
        1:
        Randomize
        d1 = Int((Text2 + 1) * Rnd)
        Randomize // randomize every time -- that time I though that it would give "more random" numbers...
        d2 = Int((Text3 + 1) * Rnd)
        Randomize
        If Check2 = 1 Then
        rd = Int((4) * Rnd + 1)
        Else
        rd = Int((2) * Rnd + 1)
        End If
        If d1 = 0 Or d2 = 0 Or rd < 1 Or d1 = d2 Or d1 = 1 Or d2 = 1 Or rd > 4 Then GoTo 1
        Randomize
        If ul = 0 Or ul = 1 Then
        a = Int((9 + 1) * Rnd)
        a = Left(a, 1)
        c = Str(d1)
        c = c & "." & Str(a) //Whoa...
        d1 = CDbl(c)
        End If
        If ul = 1 Then
        a = Int((9 + 1) * Rnd)
        a = Left(a, 1)
        c = Str(d2)
        c = c & "." & Str(a)
        d2 = CDbl(c)
        End If
        If ul = 2 Or ul = 3 Then
        a = Int((99 + 1) * Rnd)
        a = Left(a, 2)
        c = Str(d1)
        c = c & "." & Str(a)
        d1 = CDbl(c)
        End If
        If ul = 3 Then
        a = Int((99 + 1) * Rnd)
        a = Left(a, 2)
        c = Str(d2)
        c = c & "." & Str(a)
        d2 = CDbl(c)
        End If
        If rd = 1 Then
        w = d1 * d2
        Label1 = d1 & " times " & d2 & " =?"
        ElseIf rd = 2 Then
        w = d2
        Label1 = d1 * d2 & " divided by " & d1 & " =?"
        ElseIf rd = 3 Then
        w = d1 + d2
        Label1 = d1 & " add " & d2 & " =?"
        ElseIf rd = 4 Then
        w = d1 - d2
        Label1 = d1 & " minus " & d2 & " =?"
        End If
        dzial.Enabled = True
        odp.Enabled = True
        Command4.Enabled = False
        Frame1.Enabled = False
        Text1.SetFocus
        Text1.SelStart = 0
        Text1.SelLength = Len(Text1)
        Command2.Enabled = False
        End Sub

        A correct answer was stored in a global vari

        X Offline
        X Offline
        xperroni
        wrote on last edited by
        #12

        I worked on VB6 for some three years, and while I did see a lot of ugly code, I never found the language itself (or its IDE for that matter) to be particularly at fault. Sure it missed a decent array initialization mechanism, and its concept of "object-orientation" was laughable when compared to Java - but between a couple good practices (such as always using Option Explicit to enforce variable declaration) and a bit of boilerplate code to abstract away the worst idiosyncrasies, it wasn't bad at all to program; I for one didn't find it any more hard to program modular, loosely-coupled, highly-cohesive classes in VB than in Pascal. Perhaps VB's ugly code base was more a consequence of the target public it was aimed at? Microsoft marketed it as a tool for novice programmers to write simple applications with, so it's no wonder we find a lot of bad code written in VB.

        1 Reply Last reply
        0
        • L Lutoslaw

          Just for your pleasure, I have opened a random VB 6 program from my archive to post some horror. This is from a program which purpose was to teach user doing simple math tasks, that is multipying, dividing, adding and subtracting. Well it worked, but I still don't know a multiplication table by heart. I suppose Command1 was a "Start" button. Of course, the same code was copied to a "Next task" button.

          Private Sub Command1_Click()
          x = InputBox("Enter a name or a nick:", "Name?!", nz)
          If x = "" Then Exit Sub
          nz = x
          kon = False
          Command3.Enabled = True
          Command4.Enabled = True
          dzial.Interval = Text4 * 1000 // adjustable time restrictions, cool
          odp.Interval = Text5 * 1000
          Label1 = ""
          Label8 = ""
          Label1.Visible = True
          il = 0
          oc = 6
          ' Combo2.AddItem "0 - First component (denary)"
          ' Combo2.AddItem "1 - Both components (denary)"
          ' Combo2.AddItem "2 - First component (hundredth)"
          ' Combo2.AddItem "3 - Both components (hundredth)" <== whatever that means... ;)
          If Check1 = 1 Then
          ul = Combo2.ListIndex
          Else
          ul = 124
          End If
          1:
          Randomize
          d1 = Int((Text2 + 1) * Rnd)
          Randomize // randomize every time -- that time I though that it would give "more random" numbers...
          d2 = Int((Text3 + 1) * Rnd)
          Randomize
          If Check2 = 1 Then
          rd = Int((4) * Rnd + 1)
          Else
          rd = Int((2) * Rnd + 1)
          End If
          If d1 = 0 Or d2 = 0 Or rd < 1 Or d1 = d2 Or d1 = 1 Or d2 = 1 Or rd > 4 Then GoTo 1
          Randomize
          If ul = 0 Or ul = 1 Then
          a = Int((9 + 1) * Rnd)
          a = Left(a, 1)
          c = Str(d1)
          c = c & "." & Str(a) //Whoa...
          d1 = CDbl(c)
          End If
          If ul = 1 Then
          a = Int((9 + 1) * Rnd)
          a = Left(a, 1)
          c = Str(d2)
          c = c & "." & Str(a)
          d2 = CDbl(c)
          End If
          If ul = 2 Or ul = 3 Then
          a = Int((99 + 1) * Rnd)
          a = Left(a, 2)
          c = Str(d1)
          c = c & "." & Str(a)
          d1 = CDbl(c)
          End If
          If ul = 3 Then
          a = Int((99 + 1) * Rnd)
          a = Left(a, 2)
          c = Str(d2)
          c = c & "." & Str(a)
          d2 = CDbl(c)
          End If
          If rd = 1 Then
          w = d1 * d2
          Label1 = d1 & " times " & d2 & " =?"
          ElseIf rd = 2 Then
          w = d2
          Label1 = d1 * d2 & " divided by " & d1 & " =?"
          ElseIf rd = 3 Then
          w = d1 + d2
          Label1 = d1 & " add " & d2 & " =?"
          ElseIf rd = 4 Then
          w = d1 - d2
          Label1 = d1 & " minus " & d2 & " =?"
          End If
          dzial.Enabled = True
          odp.Enabled = True
          Command4.Enabled = False
          Frame1.Enabled = False
          Text1.SetFocus
          Text1.SelStart = 0
          Text1.SelLength = Len(Text1)
          Command2.Enabled = False
          End Sub

          A correct answer was stored in a global vari

          F Offline
          F Offline
          Fabio Franco
          wrote on last edited by
          #13

          I remember my early days in programming. I started with VB5 at the age of 15. Oh my... The fact that I didn't need to declare a variable simply knocks me out today. I remember when I realized that this was really bad, I remembered to always use "Option Explicit". The more I got skilled in programming the farther I got away from VB. It was like a calling to code horrors. Soon enough though, I abandoned VB two to three years later in favor of C++. The fact is that VB draws many people who either are not born to code or suck at coding because they are just starting.

          B 1 Reply Last reply
          0
          • L Lutoslaw

            Just for your pleasure, I have opened a random VB 6 program from my archive to post some horror. This is from a program which purpose was to teach user doing simple math tasks, that is multipying, dividing, adding and subtracting. Well it worked, but I still don't know a multiplication table by heart. I suppose Command1 was a "Start" button. Of course, the same code was copied to a "Next task" button.

            Private Sub Command1_Click()
            x = InputBox("Enter a name or a nick:", "Name?!", nz)
            If x = "" Then Exit Sub
            nz = x
            kon = False
            Command3.Enabled = True
            Command4.Enabled = True
            dzial.Interval = Text4 * 1000 // adjustable time restrictions, cool
            odp.Interval = Text5 * 1000
            Label1 = ""
            Label8 = ""
            Label1.Visible = True
            il = 0
            oc = 6
            ' Combo2.AddItem "0 - First component (denary)"
            ' Combo2.AddItem "1 - Both components (denary)"
            ' Combo2.AddItem "2 - First component (hundredth)"
            ' Combo2.AddItem "3 - Both components (hundredth)" <== whatever that means... ;)
            If Check1 = 1 Then
            ul = Combo2.ListIndex
            Else
            ul = 124
            End If
            1:
            Randomize
            d1 = Int((Text2 + 1) * Rnd)
            Randomize // randomize every time -- that time I though that it would give "more random" numbers...
            d2 = Int((Text3 + 1) * Rnd)
            Randomize
            If Check2 = 1 Then
            rd = Int((4) * Rnd + 1)
            Else
            rd = Int((2) * Rnd + 1)
            End If
            If d1 = 0 Or d2 = 0 Or rd < 1 Or d1 = d2 Or d1 = 1 Or d2 = 1 Or rd > 4 Then GoTo 1
            Randomize
            If ul = 0 Or ul = 1 Then
            a = Int((9 + 1) * Rnd)
            a = Left(a, 1)
            c = Str(d1)
            c = c & "." & Str(a) //Whoa...
            d1 = CDbl(c)
            End If
            If ul = 1 Then
            a = Int((9 + 1) * Rnd)
            a = Left(a, 1)
            c = Str(d2)
            c = c & "." & Str(a)
            d2 = CDbl(c)
            End If
            If ul = 2 Or ul = 3 Then
            a = Int((99 + 1) * Rnd)
            a = Left(a, 2)
            c = Str(d1)
            c = c & "." & Str(a)
            d1 = CDbl(c)
            End If
            If ul = 3 Then
            a = Int((99 + 1) * Rnd)
            a = Left(a, 2)
            c = Str(d2)
            c = c & "." & Str(a)
            d2 = CDbl(c)
            End If
            If rd = 1 Then
            w = d1 * d2
            Label1 = d1 & " times " & d2 & " =?"
            ElseIf rd = 2 Then
            w = d2
            Label1 = d1 * d2 & " divided by " & d1 & " =?"
            ElseIf rd = 3 Then
            w = d1 + d2
            Label1 = d1 & " add " & d2 & " =?"
            ElseIf rd = 4 Then
            w = d1 - d2
            Label1 = d1 & " minus " & d2 & " =?"
            End If
            dzial.Enabled = True
            odp.Enabled = True
            Command4.Enabled = False
            Frame1.Enabled = False
            Text1.SetFocus
            Text1.SelStart = 0
            Text1.SelLength = Len(Text1)
            Command2.Enabled = False
            End Sub

            A correct answer was stored in a global vari

            M Offline
            M Offline
            M i s t e r L i s t e r
            wrote on last edited by
            #14

            VB should just be put out of it's misery !

            1 Reply Last reply
            0
            • R Rob Grainger

              Jacek Gajek wrote:

              1. Option Explicit Off

              Yes this is horrible, almost as bad as JavaScript doing exactly the same, but with (until ECMAScript5) no equivalent of Option Explicit On.

              Jacek Gajek wrote:

              2. On Error Goto Label37

              Quite horrible, but to blame VB for a fault in BASIC since the year dot is a bit unfair. 3. With/End With - OK, this is truly a mistake. 4. I don't like globals either, but most languages, particularly of that era, support them. 5. someInteger = CInt(int1/int2) (divide operator on two ints gives... a double). Actually - thats pretty correct. Last time I checked 1/2 in mathematics was 0.5, not 0 or 1. Ideally, a language can distinguish integer division and floating-point division, maybe with different operators, but this doesn't seem too horrible to me. 6. Yes, a terrible decision, and Option Base 0 just made things worse, as code in different modules can have different bases. I don't mind base 0 or 1, consistency is really important. 7. Not sure what you're referring to here, but if you mean null-propagation where nulls occur in boolean expressions (where null is an allowable result), that's the only option. Check the literature on Relational DB's (Codd et al.) for the justification. Actually, Codd proposes 4-state logic (Yes,No,Maybe and Inapplicable, Maybe and Applicable). These are not really boolean logic though, but VB, with typed variables (As Boolean) behaves correctly AFAIK. It's not a great language, but most languages have points that are plain bad (JavaScript springs to mind heavily). Programmer's should be able to avoid features that cause problems - that's what they're paid for. I've seen plenty of bad Javascript too - for basically the same reasons as VB. Maybe we should just ban high-level languages ;-)

              S Offline
              S Offline
              sergiogarcianinja
              wrote on last edited by
              #15

              Rob, You should consider more two VB features: 8. Automatic type conversions like:

              Dim a As Integer = "1"

              9. Not assigment or type checking at compile type:

              Dim c As Object

              Select Case c
              Case 1
              ' do something 1
              Case "horror"
              ' its really bad
              Case Color.Green
              ' its even worst
              End Select

              This code generates a warning for use of c before its assignment, a incredible error, because it will never run. And it happens in modern VB.Net versions. --- We could assume that you like VB and we could accept it. Every programmer have your "perfect" language and consider it best as no one other. I know VB since version 5.0 and even today I use this language in a lot of legacy projects, but never in a new project. I know a lot of other languages (C, C++, C#, Python, Perl, PHP, Javascript, Bash, Java, Delphi) and each time I will start a new project, I never consider VB, because its problems. Fact is Basic and VB are extremely easy to start programming but they "easiness" are really complicated for the real programmer. A real programmer should be able to run a program and it need to be deterministic. Same input, same output. Some time a go, a friend mine was asking why a simple sum operation became wrong. She was using ASP 3.0, which uses VBScript, and 1 + 1 are equal to 11. As I saw that, I told her, perfect normal, what was you expecting? I told her simple to type her variables Dim a As Integer = 1, problem solved. As me, and probably you, use VB along time both of us know that its evolution is really impressive. In version 5 and 6 its is a really poor in resource for type checking and compile time checking. Today it is more impressive, today 1 + 1 is really 2. The easiness of VB 1, 2, 3, 4, 5 and we can consider version 6 to create and deploy windows applications are amazing, because your RAD and "good" (for the time) IDE. Even with creation of Delphi, VB had evangelized his people. But again, today, we can consider VB a good choice in real big and important projects. Project which requires use of good patterns, use o interfaces, a lot of modules, etc. VB can't handle this. But again, it's my opinion. I consider VB a easy language not a good one.

              R 1 Reply Last reply
              0
              • R Rob Grainger

                Jacek Gajek wrote:

                1. Option Explicit Off

                Yes this is horrible, almost as bad as JavaScript doing exactly the same, but with (until ECMAScript5) no equivalent of Option Explicit On.

                Jacek Gajek wrote:

                2. On Error Goto Label37

                Quite horrible, but to blame VB for a fault in BASIC since the year dot is a bit unfair. 3. With/End With - OK, this is truly a mistake. 4. I don't like globals either, but most languages, particularly of that era, support them. 5. someInteger = CInt(int1/int2) (divide operator on two ints gives... a double). Actually - thats pretty correct. Last time I checked 1/2 in mathematics was 0.5, not 0 or 1. Ideally, a language can distinguish integer division and floating-point division, maybe with different operators, but this doesn't seem too horrible to me. 6. Yes, a terrible decision, and Option Base 0 just made things worse, as code in different modules can have different bases. I don't mind base 0 or 1, consistency is really important. 7. Not sure what you're referring to here, but if you mean null-propagation where nulls occur in boolean expressions (where null is an allowable result), that's the only option. Check the literature on Relational DB's (Codd et al.) for the justification. Actually, Codd proposes 4-state logic (Yes,No,Maybe and Inapplicable, Maybe and Applicable). These are not really boolean logic though, but VB, with typed variables (As Boolean) behaves correctly AFAIK. It's not a great language, but most languages have points that are plain bad (JavaScript springs to mind heavily). Programmer's should be able to avoid features that cause problems - that's what they're paid for. I've seen plenty of bad Javascript too - for basically the same reasons as VB. Maybe we should just ban high-level languages ;-)

                E Offline
                E Offline
                edmurphy99
                wrote on last edited by
                #16

                on error goto Shoot_Foot

                1 Reply Last reply
                0
                • L Lutoslaw

                  Just for your pleasure, I have opened a random VB 6 program from my archive to post some horror. This is from a program which purpose was to teach user doing simple math tasks, that is multipying, dividing, adding and subtracting. Well it worked, but I still don't know a multiplication table by heart. I suppose Command1 was a "Start" button. Of course, the same code was copied to a "Next task" button.

                  Private Sub Command1_Click()
                  x = InputBox("Enter a name or a nick:", "Name?!", nz)
                  If x = "" Then Exit Sub
                  nz = x
                  kon = False
                  Command3.Enabled = True
                  Command4.Enabled = True
                  dzial.Interval = Text4 * 1000 // adjustable time restrictions, cool
                  odp.Interval = Text5 * 1000
                  Label1 = ""
                  Label8 = ""
                  Label1.Visible = True
                  il = 0
                  oc = 6
                  ' Combo2.AddItem "0 - First component (denary)"
                  ' Combo2.AddItem "1 - Both components (denary)"
                  ' Combo2.AddItem "2 - First component (hundredth)"
                  ' Combo2.AddItem "3 - Both components (hundredth)" <== whatever that means... ;)
                  If Check1 = 1 Then
                  ul = Combo2.ListIndex
                  Else
                  ul = 124
                  End If
                  1:
                  Randomize
                  d1 = Int((Text2 + 1) * Rnd)
                  Randomize // randomize every time -- that time I though that it would give "more random" numbers...
                  d2 = Int((Text3 + 1) * Rnd)
                  Randomize
                  If Check2 = 1 Then
                  rd = Int((4) * Rnd + 1)
                  Else
                  rd = Int((2) * Rnd + 1)
                  End If
                  If d1 = 0 Or d2 = 0 Or rd < 1 Or d1 = d2 Or d1 = 1 Or d2 = 1 Or rd > 4 Then GoTo 1
                  Randomize
                  If ul = 0 Or ul = 1 Then
                  a = Int((9 + 1) * Rnd)
                  a = Left(a, 1)
                  c = Str(d1)
                  c = c & "." & Str(a) //Whoa...
                  d1 = CDbl(c)
                  End If
                  If ul = 1 Then
                  a = Int((9 + 1) * Rnd)
                  a = Left(a, 1)
                  c = Str(d2)
                  c = c & "." & Str(a)
                  d2 = CDbl(c)
                  End If
                  If ul = 2 Or ul = 3 Then
                  a = Int((99 + 1) * Rnd)
                  a = Left(a, 2)
                  c = Str(d1)
                  c = c & "." & Str(a)
                  d1 = CDbl(c)
                  End If
                  If ul = 3 Then
                  a = Int((99 + 1) * Rnd)
                  a = Left(a, 2)
                  c = Str(d2)
                  c = c & "." & Str(a)
                  d2 = CDbl(c)
                  End If
                  If rd = 1 Then
                  w = d1 * d2
                  Label1 = d1 & " times " & d2 & " =?"
                  ElseIf rd = 2 Then
                  w = d2
                  Label1 = d1 * d2 & " divided by " & d1 & " =?"
                  ElseIf rd = 3 Then
                  w = d1 + d2
                  Label1 = d1 & " add " & d2 & " =?"
                  ElseIf rd = 4 Then
                  w = d1 - d2
                  Label1 = d1 & " minus " & d2 & " =?"
                  End If
                  dzial.Enabled = True
                  odp.Enabled = True
                  Command4.Enabled = False
                  Frame1.Enabled = False
                  Text1.SetFocus
                  Text1.SelStart = 0
                  Text1.SelLength = Len(Text1)
                  Command2.Enabled = False
                  End Sub

                  A correct answer was stored in a global vari

                  B Offline
                  B Offline
                  bwallan
                  wrote on last edited by
                  #17

                  Beautiful! Just absolutely beautiful... bwa

                  1 Reply Last reply
                  0
                  • R Rob Grainger

                    Jacek Gajek wrote:

                    1. Option Explicit Off

                    Yes this is horrible, almost as bad as JavaScript doing exactly the same, but with (until ECMAScript5) no equivalent of Option Explicit On.

                    Jacek Gajek wrote:

                    2. On Error Goto Label37

                    Quite horrible, but to blame VB for a fault in BASIC since the year dot is a bit unfair. 3. With/End With - OK, this is truly a mistake. 4. I don't like globals either, but most languages, particularly of that era, support them. 5. someInteger = CInt(int1/int2) (divide operator on two ints gives... a double). Actually - thats pretty correct. Last time I checked 1/2 in mathematics was 0.5, not 0 or 1. Ideally, a language can distinguish integer division and floating-point division, maybe with different operators, but this doesn't seem too horrible to me. 6. Yes, a terrible decision, and Option Base 0 just made things worse, as code in different modules can have different bases. I don't mind base 0 or 1, consistency is really important. 7. Not sure what you're referring to here, but if you mean null-propagation where nulls occur in boolean expressions (where null is an allowable result), that's the only option. Check the literature on Relational DB's (Codd et al.) for the justification. Actually, Codd proposes 4-state logic (Yes,No,Maybe and Inapplicable, Maybe and Applicable). These are not really boolean logic though, but VB, with typed variables (As Boolean) behaves correctly AFAIK. It's not a great language, but most languages have points that are plain bad (JavaScript springs to mind heavily). Programmer's should be able to avoid features that cause problems - that's what they're paid for. I've seen plenty of bad Javascript too - for basically the same reasons as VB. Maybe we should just ban high-level languages ;-)

                    OriginalGriffO Offline
                    OriginalGriffO Offline
                    OriginalGriff
                    wrote on last edited by
                    #18

                    Any language which contains code to deliberately hide errors and pretend they didn't happen should not be released into the wild. Particularly if innocent and impressionable children (read: students) can be contaminated by it. "On Error Resume Next" X|

                    Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.

                    "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                    "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                    T 1 Reply Last reply
                    0
                    • L Lutoslaw

                      Just for your pleasure, I have opened a random VB 6 program from my archive to post some horror. This is from a program which purpose was to teach user doing simple math tasks, that is multipying, dividing, adding and subtracting. Well it worked, but I still don't know a multiplication table by heart. I suppose Command1 was a "Start" button. Of course, the same code was copied to a "Next task" button.

                      Private Sub Command1_Click()
                      x = InputBox("Enter a name or a nick:", "Name?!", nz)
                      If x = "" Then Exit Sub
                      nz = x
                      kon = False
                      Command3.Enabled = True
                      Command4.Enabled = True
                      dzial.Interval = Text4 * 1000 // adjustable time restrictions, cool
                      odp.Interval = Text5 * 1000
                      Label1 = ""
                      Label8 = ""
                      Label1.Visible = True
                      il = 0
                      oc = 6
                      ' Combo2.AddItem "0 - First component (denary)"
                      ' Combo2.AddItem "1 - Both components (denary)"
                      ' Combo2.AddItem "2 - First component (hundredth)"
                      ' Combo2.AddItem "3 - Both components (hundredth)" <== whatever that means... ;)
                      If Check1 = 1 Then
                      ul = Combo2.ListIndex
                      Else
                      ul = 124
                      End If
                      1:
                      Randomize
                      d1 = Int((Text2 + 1) * Rnd)
                      Randomize // randomize every time -- that time I though that it would give "more random" numbers...
                      d2 = Int((Text3 + 1) * Rnd)
                      Randomize
                      If Check2 = 1 Then
                      rd = Int((4) * Rnd + 1)
                      Else
                      rd = Int((2) * Rnd + 1)
                      End If
                      If d1 = 0 Or d2 = 0 Or rd < 1 Or d1 = d2 Or d1 = 1 Or d2 = 1 Or rd > 4 Then GoTo 1
                      Randomize
                      If ul = 0 Or ul = 1 Then
                      a = Int((9 + 1) * Rnd)
                      a = Left(a, 1)
                      c = Str(d1)
                      c = c & "." & Str(a) //Whoa...
                      d1 = CDbl(c)
                      End If
                      If ul = 1 Then
                      a = Int((9 + 1) * Rnd)
                      a = Left(a, 1)
                      c = Str(d2)
                      c = c & "." & Str(a)
                      d2 = CDbl(c)
                      End If
                      If ul = 2 Or ul = 3 Then
                      a = Int((99 + 1) * Rnd)
                      a = Left(a, 2)
                      c = Str(d1)
                      c = c & "." & Str(a)
                      d1 = CDbl(c)
                      End If
                      If ul = 3 Then
                      a = Int((99 + 1) * Rnd)
                      a = Left(a, 2)
                      c = Str(d2)
                      c = c & "." & Str(a)
                      d2 = CDbl(c)
                      End If
                      If rd = 1 Then
                      w = d1 * d2
                      Label1 = d1 & " times " & d2 & " =?"
                      ElseIf rd = 2 Then
                      w = d2
                      Label1 = d1 * d2 & " divided by " & d1 & " =?"
                      ElseIf rd = 3 Then
                      w = d1 + d2
                      Label1 = d1 & " add " & d2 & " =?"
                      ElseIf rd = 4 Then
                      w = d1 - d2
                      Label1 = d1 & " minus " & d2 & " =?"
                      End If
                      dzial.Enabled = True
                      odp.Enabled = True
                      Command4.Enabled = False
                      Frame1.Enabled = False
                      Text1.SetFocus
                      Text1.SelStart = 0
                      Text1.SelLength = Len(Text1)
                      Command2.Enabled = False
                      End Sub

                      A correct answer was stored in a global vari

                      J Offline
                      J Offline
                      JasonPSage
                      wrote on last edited by
                      #19

                      This is a response to all the posts in this topic before mine... you might know what I'm referring to if you read this thread up until this post... I've written miles of VB5,6 code and folks can knock it all they like but I think it was one of the best products Microsoft has made alongside forcefeedback joysticks, access 2003, excel 2003 and DirectX in my opinion. It is one of first totally RAD programming languages in my opinion: True Binary, tons of widget addons, ADO, ODBC, RDO .. tons of ways to communicate with databases and whip up applications quickly with integrated set up and deployment tools - all wrapped into one seamless package if you wen corporate - not to mention it supports various client/server (two tier/three tier systems easily. On error resume next? You can test the error result after that command - SO? what's the problem? How is that different then try catch? You can do the same thing... and frankly - there is a time and place for any code construct - even GOTO. I love when folks get indignant about GOTO and other coding philosophy. I truly believe users just want software that works - less flash and more "DO" ... and * If you write beautiful code that is easy to read and performs great: AWESOME! * If you write ugly code that works.. well.. I wouldn't recommend it but before I chastise ya: How much time did you have to get it done? Boss breathing down your neck? Simply didn't care? All valid reasons to write crap and "Git-R-Dun" in my opinion... Example: Coder: I need two days to do this right! Boss: I need it NOW.. an Hour! Worker: Sure thing boss! VB6 is pretty darn sweet and I say if they had a vb7 by the same development team with better multi-tasking - I would chose it over .Net any day! --Jason

                      Know way too many languages... master of none!

                      L 1 Reply Last reply
                      0
                      • L Lutoslaw

                        1. Option Explicit Off 2. On Error Goto Label37 3.

                        With Object.Its.So.Nested

                        (...)

                        abc = .Some.Property // WTF?

                        (...)

                        End With

                        4. Global myVar As String = "magic" 5. someInteger = CInt(int1/int2) (divide operator on two ints gives... a double). 6. Non-zero based arrays -- a fantastic source of confusion 7. Propagating null value in nullable boolean logic -- three-state logic? uhm? I won't be suprised if the next VB version would have a fuzzy logic implemented. Not a problem with a language? I don't think so...

                        Greetings - Jacek

                        L Offline
                        L Offline
                        leonej_dt
                        wrote on last edited by
                        #20

                        3. VB has an integer division operator: 9 \ 4 returns 2, not 2.25. 4. Propagating the null value in expressions is correct. Technically, there is a difference between

                        Dim a As Variant
                        a = long_expression_possibly_returning_null
                        If a = True Then
                        some_code
                        Else
                        more_code
                        End If

                        and

                        Dim a As Variant
                        a = long_expression_possibly_returning_null
                        If a = True Then
                        some_code
                        ElseIf a = False Then
                        more_code
                        End If

                        And the difference consists on how the program handles the case in which a Is Null. Still, I agree that VB is a very horrible language: 1. Default ByRef parameters? What were VB designers smoking? 2. No support for object-oriented programming would have been better than the weak support VB offers. 3. Weak support for value data types, which does not include operator overloading. (Java is guilty of this as well.) 4. Fairly common data structures such as collections and dictionaries are a mess. 5. Even more common Generic data structures such as stacks, queues and trees are simply not supported. And there is no clean, efficient way to implement them. 6. The only way to take full advantage of the power of the Win32 API is use gross hacks à la Bruce McKinney's Hardcore Visual Basic, aka, C (not even C++!) programming in VB.

                        If you can play The Dance of Eternity (Dream Theater), then we shall make a band.

                        1 Reply Last reply
                        0
                        • L Lutoslaw

                          Just for your pleasure, I have opened a random VB 6 program from my archive to post some horror. This is from a program which purpose was to teach user doing simple math tasks, that is multipying, dividing, adding and subtracting. Well it worked, but I still don't know a multiplication table by heart. I suppose Command1 was a "Start" button. Of course, the same code was copied to a "Next task" button.

                          Private Sub Command1_Click()
                          x = InputBox("Enter a name or a nick:", "Name?!", nz)
                          If x = "" Then Exit Sub
                          nz = x
                          kon = False
                          Command3.Enabled = True
                          Command4.Enabled = True
                          dzial.Interval = Text4 * 1000 // adjustable time restrictions, cool
                          odp.Interval = Text5 * 1000
                          Label1 = ""
                          Label8 = ""
                          Label1.Visible = True
                          il = 0
                          oc = 6
                          ' Combo2.AddItem "0 - First component (denary)"
                          ' Combo2.AddItem "1 - Both components (denary)"
                          ' Combo2.AddItem "2 - First component (hundredth)"
                          ' Combo2.AddItem "3 - Both components (hundredth)" <== whatever that means... ;)
                          If Check1 = 1 Then
                          ul = Combo2.ListIndex
                          Else
                          ul = 124
                          End If
                          1:
                          Randomize
                          d1 = Int((Text2 + 1) * Rnd)
                          Randomize // randomize every time -- that time I though that it would give "more random" numbers...
                          d2 = Int((Text3 + 1) * Rnd)
                          Randomize
                          If Check2 = 1 Then
                          rd = Int((4) * Rnd + 1)
                          Else
                          rd = Int((2) * Rnd + 1)
                          End If
                          If d1 = 0 Or d2 = 0 Or rd < 1 Or d1 = d2 Or d1 = 1 Or d2 = 1 Or rd > 4 Then GoTo 1
                          Randomize
                          If ul = 0 Or ul = 1 Then
                          a = Int((9 + 1) * Rnd)
                          a = Left(a, 1)
                          c = Str(d1)
                          c = c & "." & Str(a) //Whoa...
                          d1 = CDbl(c)
                          End If
                          If ul = 1 Then
                          a = Int((9 + 1) * Rnd)
                          a = Left(a, 1)
                          c = Str(d2)
                          c = c & "." & Str(a)
                          d2 = CDbl(c)
                          End If
                          If ul = 2 Or ul = 3 Then
                          a = Int((99 + 1) * Rnd)
                          a = Left(a, 2)
                          c = Str(d1)
                          c = c & "." & Str(a)
                          d1 = CDbl(c)
                          End If
                          If ul = 3 Then
                          a = Int((99 + 1) * Rnd)
                          a = Left(a, 2)
                          c = Str(d2)
                          c = c & "." & Str(a)
                          d2 = CDbl(c)
                          End If
                          If rd = 1 Then
                          w = d1 * d2
                          Label1 = d1 & " times " & d2 & " =?"
                          ElseIf rd = 2 Then
                          w = d2
                          Label1 = d1 * d2 & " divided by " & d1 & " =?"
                          ElseIf rd = 3 Then
                          w = d1 + d2
                          Label1 = d1 & " add " & d2 & " =?"
                          ElseIf rd = 4 Then
                          w = d1 - d2
                          Label1 = d1 & " minus " & d2 & " =?"
                          End If
                          dzial.Enabled = True
                          odp.Enabled = True
                          Command4.Enabled = False
                          Frame1.Enabled = False
                          Text1.SetFocus
                          Text1.SelStart = 0
                          Text1.SelLength = Len(Text1)
                          Command2.Enabled = False
                          End Sub

                          A correct answer was stored in a global vari

                          M Offline
                          M Offline
                          Matt McGuire
                          wrote on last edited by
                          #21

                          true, that does hurt. but you should have seen some c code I had to take over when I first arived at the company I now work for. something along the lines--- void _add{ int a,b,c,d,e,f,g,h,i,j,k,l,m,n; int aa,bb,cc,iiii,iii,ii,i; if {z==0}n=3; /*declared in globals*/ b=1 } all of the code was like this, with vars never even refrenced in the code, except for one var that is assigned a variable, but never actually used. the names of the functions had no correlation to the body of code inside of them! yes, most of it was scrubbed, as no one could follow the majority of the logic.

                          L 1 Reply Last reply
                          0
                          • C Chris Meech

                            At least in English, the poems ryhme. :)

                            Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]

                            J Offline
                            J Offline
                            jmoralesv
                            wrote on last edited by
                            #22

                            As in Spanish also ;) I love my language :-D

                            1 Reply Last reply
                            0
                            • M Matt McGuire

                              true, that does hurt. but you should have seen some c code I had to take over when I first arived at the company I now work for. something along the lines--- void _add{ int a,b,c,d,e,f,g,h,i,j,k,l,m,n; int aa,bb,cc,iiii,iii,ii,i; if {z==0}n=3; /*declared in globals*/ b=1 } all of the code was like this, with vars never even refrenced in the code, except for one var that is assigned a variable, but never actually used. the names of the functions had no correlation to the body of code inside of them! yes, most of it was scrubbed, as no one could follow the majority of the logic.

                              L Offline
                              L Offline
                              Lutoslaw
                              wrote on last edited by
                              #23

                              Maybe a programmer who wrote this was using a lot an early version of BASIC, where variables had to match a pattern ([A-Z][A-Z]) (identifiers not longer than two characters, not case sensitive, a-z letters can be accesed via an array A, e.g. A[3]=C as well as other "advantages"). BTW in your code i is declared twice.

                              Greetings - Jacek

                              1 Reply Last reply
                              0
                              • S sergiogarcianinja

                                Rob, You should consider more two VB features: 8. Automatic type conversions like:

                                Dim a As Integer = "1"

                                9. Not assigment or type checking at compile type:

                                Dim c As Object

                                Select Case c
                                Case 1
                                ' do something 1
                                Case "horror"
                                ' its really bad
                                Case Color.Green
                                ' its even worst
                                End Select

                                This code generates a warning for use of c before its assignment, a incredible error, because it will never run. And it happens in modern VB.Net versions. --- We could assume that you like VB and we could accept it. Every programmer have your "perfect" language and consider it best as no one other. I know VB since version 5.0 and even today I use this language in a lot of legacy projects, but never in a new project. I know a lot of other languages (C, C++, C#, Python, Perl, PHP, Javascript, Bash, Java, Delphi) and each time I will start a new project, I never consider VB, because its problems. Fact is Basic and VB are extremely easy to start programming but they "easiness" are really complicated for the real programmer. A real programmer should be able to run a program and it need to be deterministic. Same input, same output. Some time a go, a friend mine was asking why a simple sum operation became wrong. She was using ASP 3.0, which uses VBScript, and 1 + 1 are equal to 11. As I saw that, I told her, perfect normal, what was you expecting? I told her simple to type her variables Dim a As Integer = 1, problem solved. As me, and probably you, use VB along time both of us know that its evolution is really impressive. In version 5 and 6 its is a really poor in resource for type checking and compile time checking. Today it is more impressive, today 1 + 1 is really 2. The easiness of VB 1, 2, 3, 4, 5 and we can consider version 6 to create and deploy windows applications are amazing, because your RAD and "good" (for the time) IDE. Even with creation of Delphi, VB had evangelized his people. But again, today, we can consider VB a good choice in real big and important projects. Project which requires use of good patterns, use o interfaces, a lot of modules, etc. VB can't handle this. But again, it's my opinion. I consider VB a easy language not a good one.

                                R Offline
                                R Offline
                                Rob Grainger
                                wrote on last edited by
                                #24

                                Sergio, Fair points - actually, I have to use VB at work but would much prefer use C#, or even better a true OO language like Smalltalk, but there seems little call for that in this neck of the woods. I've used VB in one form or another intermittently since VB 1.0 - at that stage, even though primitive by todays standards, the IDE was mind-blowing, the first time I was able to draw a GUI, and add event-handling code so easily. I agree re. auto type conversion - in a typed language that's horrible, although many modern languages seem to do this sort of stuff (particularly in the Scripting arena, and I'd guess VB's kind of midway between there and a typical statically-typed language). Like you I have experience with a wide range of languages (slightly different selection, but generally similar). Many languages have these kinds of faults - JavaScript has a whole set of them, but it seems to get nothing like the volume of criticism directed at VB. C has a whole different set, that tend to lead to more catastrophic run-time errors. The basic fact remains that whatever language you use, you need to learn its strengths and, particularly, its weaknesses, so you can exploit one and avoid the other. Regards, Rob

                                1 Reply Last reply
                                0
                                • J JasonPSage

                                  This is a response to all the posts in this topic before mine... you might know what I'm referring to if you read this thread up until this post... I've written miles of VB5,6 code and folks can knock it all they like but I think it was one of the best products Microsoft has made alongside forcefeedback joysticks, access 2003, excel 2003 and DirectX in my opinion. It is one of first totally RAD programming languages in my opinion: True Binary, tons of widget addons, ADO, ODBC, RDO .. tons of ways to communicate with databases and whip up applications quickly with integrated set up and deployment tools - all wrapped into one seamless package if you wen corporate - not to mention it supports various client/server (two tier/three tier systems easily. On error resume next? You can test the error result after that command - SO? what's the problem? How is that different then try catch? You can do the same thing... and frankly - there is a time and place for any code construct - even GOTO. I love when folks get indignant about GOTO and other coding philosophy. I truly believe users just want software that works - less flash and more "DO" ... and * If you write beautiful code that is easy to read and performs great: AWESOME! * If you write ugly code that works.. well.. I wouldn't recommend it but before I chastise ya: How much time did you have to get it done? Boss breathing down your neck? Simply didn't care? All valid reasons to write crap and "Git-R-Dun" in my opinion... Example: Coder: I need two days to do this right! Boss: I need it NOW.. an Hour! Worker: Sure thing boss! VB6 is pretty darn sweet and I say if they had a vb7 by the same development team with better multi-tasking - I would chose it over .Net any day! --Jason

                                  Know way too many languages... master of none!

                                  L Offline
                                  L Offline
                                  Lost User
                                  wrote on last edited by
                                  #25

                                  I concur. We have a time & attendance system that was originally developed in VB6 that serves thousands of clients on a daily basis. (Some of these clients have > 10,000 employees). The current enterprise-level solution is now a mix of the VB6 stuff and .Net. Since 2005 the management kept saying "in 6 months we'll get rid of VB6 code". Now, years later, the ratio of the VB6 code to the .Net section is about the same. Why? The stuff just plain works, that's why. Agreed, .Net is far more refined a product than VB6 is - it had better be, it's 12 years newer (in its latest version that is). However even now the VB6 code continues to ensure that paychecks are accurately produced and the system continues to hum along. VB6 may wind up being the next COBOL. It will eventually fall off the radar but in the background will continue to get results for years to come. One developer said that he'd never take another job where he would have to deal with VB6. That's all right son, just send that work my way. I won't turn my nose up - they pay me big bucks to fix systems that the kids don't want to bother with anymore. :-) I love .Net (absolutely crazy about C#) but, at the same time I find it a breath of fresh air sometimes to go back to VB6. Besides being a competent development environment it is just plain FUN. -Max :-)

                                  1 Reply Last reply
                                  0
                                  • L Lutoslaw

                                    Just for your pleasure, I have opened a random VB 6 program from my archive to post some horror. This is from a program which purpose was to teach user doing simple math tasks, that is multipying, dividing, adding and subtracting. Well it worked, but I still don't know a multiplication table by heart. I suppose Command1 was a "Start" button. Of course, the same code was copied to a "Next task" button.

                                    Private Sub Command1_Click()
                                    x = InputBox("Enter a name or a nick:", "Name?!", nz)
                                    If x = "" Then Exit Sub
                                    nz = x
                                    kon = False
                                    Command3.Enabled = True
                                    Command4.Enabled = True
                                    dzial.Interval = Text4 * 1000 // adjustable time restrictions, cool
                                    odp.Interval = Text5 * 1000
                                    Label1 = ""
                                    Label8 = ""
                                    Label1.Visible = True
                                    il = 0
                                    oc = 6
                                    ' Combo2.AddItem "0 - First component (denary)"
                                    ' Combo2.AddItem "1 - Both components (denary)"
                                    ' Combo2.AddItem "2 - First component (hundredth)"
                                    ' Combo2.AddItem "3 - Both components (hundredth)" <== whatever that means... ;)
                                    If Check1 = 1 Then
                                    ul = Combo2.ListIndex
                                    Else
                                    ul = 124
                                    End If
                                    1:
                                    Randomize
                                    d1 = Int((Text2 + 1) * Rnd)
                                    Randomize // randomize every time -- that time I though that it would give "more random" numbers...
                                    d2 = Int((Text3 + 1) * Rnd)
                                    Randomize
                                    If Check2 = 1 Then
                                    rd = Int((4) * Rnd + 1)
                                    Else
                                    rd = Int((2) * Rnd + 1)
                                    End If
                                    If d1 = 0 Or d2 = 0 Or rd < 1 Or d1 = d2 Or d1 = 1 Or d2 = 1 Or rd > 4 Then GoTo 1
                                    Randomize
                                    If ul = 0 Or ul = 1 Then
                                    a = Int((9 + 1) * Rnd)
                                    a = Left(a, 1)
                                    c = Str(d1)
                                    c = c & "." & Str(a) //Whoa...
                                    d1 = CDbl(c)
                                    End If
                                    If ul = 1 Then
                                    a = Int((9 + 1) * Rnd)
                                    a = Left(a, 1)
                                    c = Str(d2)
                                    c = c & "." & Str(a)
                                    d2 = CDbl(c)
                                    End If
                                    If ul = 2 Or ul = 3 Then
                                    a = Int((99 + 1) * Rnd)
                                    a = Left(a, 2)
                                    c = Str(d1)
                                    c = c & "." & Str(a)
                                    d1 = CDbl(c)
                                    End If
                                    If ul = 3 Then
                                    a = Int((99 + 1) * Rnd)
                                    a = Left(a, 2)
                                    c = Str(d2)
                                    c = c & "." & Str(a)
                                    d2 = CDbl(c)
                                    End If
                                    If rd = 1 Then
                                    w = d1 * d2
                                    Label1 = d1 & " times " & d2 & " =?"
                                    ElseIf rd = 2 Then
                                    w = d2
                                    Label1 = d1 * d2 & " divided by " & d1 & " =?"
                                    ElseIf rd = 3 Then
                                    w = d1 + d2
                                    Label1 = d1 & " add " & d2 & " =?"
                                    ElseIf rd = 4 Then
                                    w = d1 - d2
                                    Label1 = d1 & " minus " & d2 & " =?"
                                    End If
                                    dzial.Enabled = True
                                    odp.Enabled = True
                                    Command4.Enabled = False
                                    Frame1.Enabled = False
                                    Text1.SetFocus
                                    Text1.SelStart = 0
                                    Text1.SelLength = Len(Text1)
                                    Command2.Enabled = False
                                    End Sub

                                    A correct answer was stored in a global vari

                                    C Offline
                                    C Offline
                                    cwp42
                                    wrote on last edited by
                                    #26

                                    It always depends on the coder !!! You can do this horror in every language.

                                    cwp42

                                    1 Reply Last reply
                                    0
                                    • OriginalGriffO OriginalGriff

                                      Any language which contains code to deliberately hide errors and pretend they didn't happen should not be released into the wild. Particularly if innocent and impressionable children (read: students) can be contaminated by it. "On Error Resume Next" X|

                                      Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.

                                      T Offline
                                      T Offline
                                      Thomas Eyde
                                      wrote on last edited by
                                      #27

                                      Try with an empty catch does just the same. Does this statement apply to all these languages, including C# and Java?

                                      OriginalGriffO 1 Reply Last reply
                                      0
                                      • T Thomas Eyde

                                        Try with an empty catch does just the same. Does this statement apply to all these languages, including C# and Java?

                                        OriginalGriffO Offline
                                        OriginalGriffO Offline
                                        OriginalGriff
                                        wrote on last edited by
                                        #28

                                        No, it doesn't! Try with an empty catch would only work the same if you surrounded each and every single line of code with it's own, independent, try...empty catch block. Not even the laziest programmer on the planet would do that... Having said that, it is possible a very thick student might. But he wouldn't get a passing grade for it.

                                        Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.

                                        "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                                        "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                                        T R 2 Replies Last reply
                                        0
                                        • OriginalGriffO OriginalGriff

                                          No, it doesn't! Try with an empty catch would only work the same if you surrounded each and every single line of code with it's own, independent, try...empty catch block. Not even the laziest programmer on the planet would do that... Having said that, it is possible a very thick student might. But he wouldn't get a passing grade for it.

                                          Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.

                                          T Offline
                                          T Offline
                                          Thomas Eyde
                                          wrote on last edited by
                                          #29

                                          That's true. My point was that a swallowed exception leaves the program in an invalid state. Even if the magnitude is smaller, no language can protect us from bad practice.

                                          OriginalGriffO 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups