getting rid of old vb6 code

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • chookeater

    getting rid of old vb6 code

    Hi All.

    My introduction to VB was through VB.Net but I am working with a lot
    of code that was written by programmers with pre-dotnet experience. As
    a result there are lots of function calls and "non-OOP aware" code.

    Is there any program available that I can get to sweep through VB.Net
    projects and flag these older VB functions/things ?

    I don't want to have to learn pre-dotnet VB to just to know what I
    should be getting rid of.

    Thanks in advance (perhaps)
    Chook.
  • Scott M.

    #2
    Re: getting rid of old vb6 code

    You could remove the reference to the Microsoft.Visua lBasic namespace and
    see what breaks.

    "chookeater " <chookeater55@h otmail.com> wrote in message
    news:9f64df6.03 12222038.188ca5 93@posting.goog le.com...[color=blue]
    > Hi All.
    >
    > My introduction to VB was through VB.Net but I am working with a lot
    > of code that was written by programmers with pre-dotnet experience. As
    > a result there are lots of function calls and "non-OOP aware" code.
    >
    > Is there any program available that I can get to sweep through VB.Net
    > projects and flag these older VB functions/things ?
    >
    > I don't want to have to learn pre-dotnet VB to just to know what I
    > should be getting rid of.
    >
    > Thanks in advance (perhaps)
    > Chook.[/color]


    Comment

    • Cor

      #3
      Re: getting rid of old vb6 code

      Hi Scott,

      What has the Microsoft.Visau alBasic namespace to do with non OOP
      programming?

      Cor

      [color=blue]
      > You could remove the reference to the Microsoft.Visua lBasic namespace and
      > see what breaks.[/color]
      [color=blue][color=green]
      > > My introduction to VB was through VB.Net but I am working with a lot
      > > of code that was written by programmers with pre-dotnet experience. As
      > > a result there are lots of function calls and "non-OOP aware" code.
      > >
      > > Is there any program available that I can get to sweep through VB.Net
      > > projects and flag these older VB functions/things ?
      > >
      > > I don't want to have to learn pre-dotnet VB to just to know what I
      > > should be getting rid of.[/color][/color]


      Comment

      • Herfried K. Wagner [MVP]

        #4
        Re: getting rid of old vb6 code

        * chookeater55@ho tmail.com (chookeater) scripsit:[color=blue]
        > My introduction to VB was through VB.Net but I am working with a lot
        > of code that was written by programmers with pre-dotnet experience. As
        > a result there are lots of function calls and "non-OOP aware" code.
        >
        > Is there any program available that I can get to sweep through VB.Net
        > projects and flag these older VB functions/things ?
        >
        > I don't want to have to learn pre-dotnet VB to just to know what I
        > should be getting rid of.[/color]

        Maybe this tool will help you:

        Micrososoft Visual Basic Code Advisor
        <http://msdn.microsoft. com/library/default.asp?url =/library/en-us/dnvb600/html/vb6_FixItRuleTo ol.asp>

        --
        Herfried K. Wagner [MVP]
        <http://www.mvps.org/dotnet>

        Comment

        • Scott M.

          #5
          Re: getting rid of old vb6 code


          "Cor" <non@non.com> wrote in message
          news:OZvlAeTyDH A.3416@tk2msftn gp13.phx.gbl...[color=blue]
          > Hi Scott,
          >
          > What has the Microsoft.Visau alBasic namespace to do with non OOP
          > programming?
          >
          > Cor
          >[/color]

          I know this is bound to open a can of worms here, but much of what is in
          that namespace is throwbacks to the "old" VB 6.0 syntax. MsgBox() for
          example.

          The OP said he was looking for a way to get away from VB 6.0 functions and
          get more to OOP techniques. If I take away the MsgBox() function, you are
          left with the MessageBox class and its show method, which is the more OO
          approach.



          Comment

          • Cor

            #6
            Re: getting rid of old vb6 code

            Hi Scott,

            Something that is C style code is not OOP, C style keywords have nothing to
            do with OOP

            OOp is today the best way to get reusable uniform code

            To archive that you can use things as overloading, inheriting, protecting,
            etc.

            But maybe am I wrong and is using

            dim a as string = b.substring(0,2 ) instead of a MID function complete OOP.
            But from that I see no benefit in reusable uniform code.

            (I myself use mostly the C style code, but that is mainly because of the
            zero indexer)

            But please correct me if I am wrong?

            Cor





            Comment

            • Scott M.

              #7
              Re: getting rid of old vb6 code

              I really don't know what "C style code" is supposed to mean, so I really
              can't follow what you are trying to say in your post.


              "Cor" <non@non.com> wrote in message
              news:O6dLnNXyDH A.2712@TK2MSFTN GP11.phx.gbl...[color=blue]
              > Hi Scott,
              >
              > Something that is C style code is not OOP, C style keywords have nothing[/color]
              to[color=blue]
              > do with OOP
              >
              > OOp is today the best way to get reusable uniform code
              >
              > To archive that you can use things as overloading, inheriting, protecting,
              > etc.
              >
              > But maybe am I wrong and is using
              >
              > dim a as string = b.substring(0,2 ) instead of a MID function complete[/color]
              OOP.[color=blue]
              > But from that I see no benefit in reusable uniform code.
              >
              > (I myself use mostly the C style code, but that is mainly because of the
              > zero indexer)
              >
              > But please correct me if I am wrong?
              >
              > Cor
              >
              >
              >
              >
              >[/color]


              Comment

              • Jay B. Harlow [MVP - Outlook]

                #8
                Re: getting rid of old vb6 code

                Chook,
                Here are two more items that may help.

                1: Code Critics & Code Analyzers (Herfield's link is for a Code Critic that
                runs on VB6). There are also Code Critics & Analyzers available for VB.NET,
                such as http://www.fmsinc.com/reviews/tnanalyzer/sd1202.htm

                2: Refactoring http://www.refactoring.com

                Hope this helps
                Jay

                "chookeater " <chookeater55@h otmail.com> wrote in message
                news:9f64df6.03 12222038.188ca5 93@posting.goog le.com...[color=blue]
                > Hi All.
                >
                > My introduction to VB was through VB.Net but I am working with a lot
                > of code that was written by programmers with pre-dotnet experience. As
                > a result there are lots of function calls and "non-OOP aware" code.
                >
                > Is there any program available that I can get to sweep through VB.Net
                > projects and flag these older VB functions/things ?
                >
                > I don't want to have to learn pre-dotnet VB to just to know what I
                > should be getting rid of.
                >
                > Thanks in advance (perhaps)
                > Chook.[/color]


                Comment

                • Herfried K. Wagner [MVP]

                  #9
                  Re: getting rid of old vb6 code

                  * "Scott M." <s-mar@BADSPAMsnet .net> scripsit:[color=blue]
                  > I know this is bound to open a can of worms here, but much of what is in
                  > that namespace is throwbacks to the "old" VB 6.0 syntax. MsgBox() for
                  > example.[/color]

                  I still don't know what's bad about 'MsgBox' and the other functions.
                  [color=blue]
                  > The OP said he was looking for a way to get away from VB 6.0 functions and
                  > get more to OOP techniques.[/color]

                  I think he wanted to get back from a bad application design using
                  various modules. Using 'MsgBox' isn't bad. Using the
                  non-object-oriented '+' operator isn't bad too.
                  [color=blue]
                  > If I take away the MsgBox() function, you are
                  > left with the MessageBox class and its show method, which is the more OO
                  > approach.[/color]

                  IMO there isn't any difference. The 'Show' method of the 'MessageBox'
                  is a static method too.

                  --
                  Herfried K. Wagner [MVP]
                  <http://www.mvps.org/dotnet>

                  Comment

                  • Herfried K. Wagner [MVP]

                    #10
                    Re: getting rid of old vb6 code

                    * "Cor" <non@non.com> scripsit:[color=blue]
                    > Something that is C style code is not OOP, C style keywords have nothing to
                    > do with OOP[/color]

                    ACK. C was an OOP-less programming language...
                    [color=blue]
                    > OOp is today the best way to get reusable uniform code
                    >
                    > To archive that you can use things as overloading, inheriting, protecting,
                    > etc.
                    >
                    > But maybe am I wrong and is using
                    >
                    > dim a as string = b.substring(0,2 ) instead of a MID function complete OOP.
                    > But from that I see no benefit in reusable uniform code.[/color]

                    That's the main point. It doesn't matter if you use 'MsgBox' or
                    'MessageBox.Sho w' as it doesn't matter if you use 'Substring' or 'Mid'.
                    What matters, is the design, the architecture of the application. A
                    good class design which is CLS compliant.

                    --
                    Herfried K. Wagner [MVP]
                    <http://www.mvps.org/dotnet>

                    Comment

                    • Herfried K. Wagner [MVP]

                      #11
                      Re: getting rid of old vb6 code

                      * "Scott M." <s-mar@BADSPAMsnet .net> scripsit:[color=blue]
                      > I really don't know what "C style code" is supposed to mean, so I really
                      > can't follow what you are trying to say in your post.[/color]

                      My interpretation: Procedural programming.

                      --
                      Herfried K. Wagner [MVP]
                      <http://www.mvps.org/dotnet>

                      Comment

                      • Cor

                        #12
                        Re: getting rid of old vb6 code

                        Hi Scott,

                        You got your answers from Herfried, I have nothing to add in this.

                        Cor


                        Comment

                        • Scott M.

                          #13
                          Re: getting rid of old vb6 code

                          And what does this have to do with our prior posts about the
                          Microsoft.Visua lBasic namespace?

                          "Cor" <non@non.com> wrote in message
                          news:ui1NOzXyDH A.2116@TK2MSFTN GP11.phx.gbl...[color=blue]
                          > Hi Scott,
                          >
                          > You got your answers from Herfried, I have nothing to add in this.
                          >
                          > Cor
                          >
                          >[/color]


                          Comment

                          • Scott M.

                            #14
                            Re: getting rid of old vb6 code


                            "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
                            news:%23DOfmoXy DHA.1680@TK2MSF TNGP12.phx.gbl. ..[color=blue]
                            > * "Scott M." <s-mar@BADSPAMsnet .net> scripsit:[color=green]
                            > > I know this is bound to open a can of worms here, but much of what is in
                            > > that namespace is throwbacks to the "old" VB 6.0 syntax. MsgBox() for
                            > > example.[/color]
                            >
                            > I still don't know what's bad about 'MsgBox' and the other functions.[/color]

                            This is the "can of worms" I mentioned earlier because there are strong
                            opinions on both sides of the fence. When you use the MsgBox() function,
                            all that happens is that a call to the .show method of the MessagBox class
                            occurs. Why take the extra step with the function when you can go straight
                            to the functionality you want with the method.
                            [color=blue]
                            >[color=green]
                            > > The OP said he was looking for a way to get away from VB 6.0 functions[/color][/color]
                            and[color=blue][color=green]
                            > > get more to OOP techniques.[/color]
                            >
                            > I think he wanted to get back from a bad application design using
                            > various modules. Using 'MsgBox' isn't bad. Using the
                            > non-object-oriented '+' operator isn't bad too.[/color]

                            See above.
                            [color=blue]
                            >[color=green]
                            > > If I take away the MsgBox() function, you are
                            > > left with the MessageBox class and its show method, which is the more OO
                            > > approach.[/color]
                            >
                            > IMO there isn't any difference. The 'Show' method of the 'MessageBox'
                            > is a static method too.[/color]

                            But there is an extra processing step when using the MsgBox() function.

                            [color=blue]
                            >
                            > --
                            > Herfried K. Wagner [MVP]
                            > <http://www.mvps.org/dotnet>[/color]


                            Comment

                            • Cor

                              #15
                              Re: getting rid of old vb6 code

                              Hi Scott,

                              With Removing the Microsoft.Visua l.Basic namespace you are not making OOP
                              programs,

                              You are restricting yourself useless by only using a part of the .Net
                              framework.

                              Cor
                              [color=blue]
                              > And what does this have to do with our prior posts about the
                              > Microsoft.Visua lBasic namespace?[/color]


                              Comment

                              Working...