getting rid of old vb6 code

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

    #31
    Re: getting rid of old vb6 code

    > That's IMO one of the biggest misinterpretati ons ever done.

    What is? That's what the OP said he wanted:

    "Is there any program available that I can get to sweep through VB.Net
    projects and flag these older VB functions/things?"
    [color=blue]
    > Code written using the functions contained in 'Microsoft VisualBasic'[/color]
    won't[color=blue]
    > reduce readability and maintainability of the code.[/color]

    Sure it would, to the novice programmer. If I run across: Mid(blah blah),
    would I intuitively know that Mid was a string function? No. But if I see a
    string object with a method after it, I know that that method must be a
    string method.
    [color=blue]
    > In some cases, it will increase intuitivity.[/color]

    Maybe, but I can't think of any. Can you?
    [color=blue]
    > And last bug not least, using the "old" functions won't lead to more[/color]
    errors in the code.

    Sure they could. Again novice programmers could use a string function on a
    date, a date function on a string, a math funciton on a date, etc. This
    method approach will prevent type mismatches.
    [color=blue][color=green]
    > > Because of the fact that the "old" functions have "new" method calls[/color][/color]
    that[color=blue][color=green]
    > > are more efficient, there is (again IMHO) no reason to continue their[/color][/color]
    use.[color=blue]
    >
    > Who says that they are more efficient? Sometimes there isn't even a
    > replacement in the FCL. An interesting article on this topic can be
    > found here:
    >
    >[/color]
    <http://msdn.microsoft.com/library/de...-us/dv_vstecha
    rt/html/vbtchMicrosoftV isualBasicNETIn ternals.asp>[color=blue]
    >[/color]

    If a function has to call a method then isn't it more effecient to just call
    the method directly and not have to pass data an extra time? You are right,
    sometimes there isn't a replacement, and so we are not talking about ALL VB
    6.0 functions.

    It's also interesting in that article you posted a link to that they discuss
    the Microsoft.Visua lBasic.Compatib ility namespace and say that "The
    compatibility classes should not be used for new development."

    The compatability namespace and the VisualBaisc namespace have certain
    similarities.

    [color=blue][color=green]
    > > I work with a global insurance giant that recently disabled the use of[/color][/color]
    this[color=blue][color=green]
    > > namespace enterprise-wide as an attempt to come closer to a more OO and[/color][/color]
    ..NET[color=blue][color=green]
    > > approach to application development.[/color]
    >
    > I don't see any advantages...
    >[/color]

    Ok, we agree to disagree.


    Comment

    • chookeater

      #32
      Re: getting rid of old vb6 code

      Thanks Scott.

      Always the simple answers that are the best :-)

      Removing the Namespace at least alerts me to code to avoid in future projects.

      Thanks to all the others who responded as well.

      Chook.

      "Scott M." <s-mar@BADSPAMsnet .net> wrote in message news:<#CN2F#QyD HA.2452@tk2msft ngp13.phx.gbl>. ..[color=blue]
      > 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=green]
      > > 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][/color]

      Comment

      • Herfried K. Wagner [MVP]

        #33
        Re: getting rid of old vb6 code

        * "Scott M." <s-mar@BADSPAMsnet .net> scripsit:[color=blue][color=green]
        >> That's IMO one of the biggest misinterpretati ons ever done.[/color]
        >
        > What is? That's what the OP said he wanted:
        >
        > "Is there any program available that I can get to sweep through VB.Net
        > projects and flag these older VB functions/things?"[/color]

        Do you want to flag all 'If's, 'Do's, 'With's etc. too? They are "old"
        too.
        [color=blue][color=green]
        >> Code written using the functions contained in 'Microsoft VisualBasic'
        >> won't reduce readability and maintainability of the code.[/color]
        >
        > Sure it would, to the novice programmer. If I run across: Mid(blah blah),
        > would I intuitively know that Mid was a string function? No. But if I see a
        > string object with a method after it, I know that that method must be a
        > string method.[/color]

        No, absolutely not. Calling a 'String' object's method isn't more
        intuitive for a "beginner" who isn't familiar with object oriented
        programming. IMO it's impossible to be a good OO programmer without
        having good knowledge in procedural programming, which is a basis.
        [color=blue][color=green]
        >> In some cases, it will increase intuitivity.[/color]
        >
        > Maybe, but I can't think of any. Can you?[/color]

        'Strings.Left', 'Strings.Right' , for example. There is no direct and
        descriptive replacement available in the string class.
        [color=blue][color=green]
        >> And last bug not least, using the "old" functions won't lead to more
        >> errors in the code.[/color]
        >
        > Sure they could. Again novice programmers could use a string function on a
        > date, a date function on a string, a math funciton on a date, etc. This
        > method approach will prevent type mismatches.[/color]

        You can still pass wrong datatypes to methods of objects. I think
        that's not a big problem.
        [color=blue][color=green][color=darkred]
        >>> Because of the fact that the "old" functions have "new" method calls
        >>> that
        >>> are more efficient, there is (again IMHO) no reason to continue their
        >>> use.[/color]
        >>
        >> Who says that they are more efficient? Sometimes there isn't even a
        >> replacement in the FCL. An interesting article on this topic can be
        >> found here:
        >>[/color]
        > <http://msdn.microsoft.com/library/de...-us/dv_vstecha
        > rt/html/vbtchMicrosoftV isualBasicNETIn ternals.asp>
        >
        > If a function has to call a method then isn't it more effecient to just call
        > the method directly and not have to pass data an extra time? You are right,
        > sometimes there isn't a replacement, and so we are not talking about ALL VB
        > 6.0 functions.[/color]

        ACK.
        [color=blue]
        > It's also interesting in that article you posted a link to that they discuss
        > the Microsoft.Visua lBasic.Compatib ility namespace and say that "The
        > compatibility classes should not be used for new development."[/color]

        I wouldn't use the /compatibility/ classes which reside in the Microsoft
        Visual Basic .NET Compatibility Library, as the documentation states
        that it may not be included in a future release.
        [color=blue]
        > The compatability namespace and the VisualBaisc namespace have certain
        > similarities.[/color]

        Let's see it from an other point of view: Microsoft made a strict
        distinction between the compatibility library and the VB.NET
        class/method library.
        [color=blue][color=green][color=darkred]
        >>> approach to application development.[/color]
        >>
        >> I don't see any advantages...[/color]
        >
        > Ok, we agree to disagree.[/color]

        :-)

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

        Comment

        • Scott M.

          #34
          Re: getting rid of old vb6 code

          > Do you want to flag all 'If's, 'Do's, 'With's etc. too? They are "old"[color=blue]
          > too.[/color]

          Well now, you are just being sarcastic. I know that you know that these are
          language constructs and not functions.
          [color=blue]
          > No, absolutely not. Calling a 'String' object's method isn't more
          > intuitive for a "beginner" who isn't familiar with object oriented
          > programming. IMO it's impossible to be a good OO programmer without
          > having good knowledge in procedural programming, which is a basis.
          >[/color]

          Would a beginner programmer know what the string methods are intuitively?
          No. But if they type a "." next to a string object, intellisense will help
          them to learn what the string methods are.
          [color=blue][color=green][color=darkred]
          > >> In some cases, it will increase intuitivity.[/color]
          > >
          > > Maybe, but I can't think of any. Can you?[/color]
          >
          > 'Strings.Left', 'Strings.Right' , for example. There is no direct and
          > descriptive replacement available in the string class.[/color]

          It's true that there are no string method replacements for those, but that's
          not an example of how the old Left() and Right() are more intuitive. I
          still have to know of thier existance before I can use them. I wouldn't
          just intuitively know that they exist.
          [color=blue]
          >[color=green][color=darkred]
          > >> And last bug not least, using the "old" functions won't lead to more
          > >> errors in the code.[/color]
          > >
          > > Sure they could. Again novice programmers could use a string function[/color][/color]
          on a[color=blue][color=green]
          > > date, a date function on a string, a math funciton on a date, etc. This
          > > method approach will prevent type mismatches.[/color]
          >
          > You can still pass wrong datatypes to methods of objects. I think
          > that's not a big problem.[/color]

          Yes, but I'm taling about using a date function when you should have been
          using a string function, not passing a date when you should have passed a
          string. Intelisense will help the user in either the old or new way to pass
          the right data into the function/method, but with the older functions, the
          programmer has to somehow now the categories of functions. With methods,
          there's no possibilty of that.



          Comment

          • Herfried K. Wagner [MVP]

            #35
            Re: getting rid of old vb6 code

            * "Scott M." <s-mar@BADSPAMsnet .net> scripsit:[color=blue][color=green]
            >> Do you want to flag all 'If's, 'Do's, 'With's etc. too? They are "old"
            >> too.[/color]
            >
            > Well now, you are just being sarcastic. I know that you know that these are
            > language constructs and not functions.[/color]

            Yep -- I was a little bit sarcastic.
            [color=blue][color=green]
            >> No, absolutely not. Calling a 'String' object's method isn't more
            >> intuitive for a "beginner" who isn't familiar with object oriented
            >> programming. IMO it's impossible to be a good OO programmer without
            >> having good knowledge in procedural programming, which is a basis.
            >>[/color]
            >
            > Would a beginner programmer know what the string methods are intuitively?
            > No. But if they type a "." next to a string object, intellisense will help
            > them to learn what the string methods are.[/color]

            Not every "beginner" uses the VS.NET IDE for writing his/her source
            code.

            ;-)
            [color=blue][color=green][color=darkred]
            >>>> In some cases, it will increase intuitivity.
            >>>
            >>> Maybe, but I can't think of any. Can you?[/color]
            >>
            >> 'Strings.Left', 'Strings.Right' , for example. There is no direct and
            >> descriptive replacement available in the string class.[/color]
            >
            > It's true that there are no string method replacements for those, but that's
            > not an example of how the old Left() and Right() are more intuitive. I
            > still have to know of thier existance before I can use them. I wouldn't
            > just intuitively know that they exist.[/color]

            The same with the methods of the 'String' class... Without getting the
            information somewhere, I don't know it.
            [color=blue][color=green]
            >> You can still pass wrong datatypes to methods of objects. I think
            >> that's not a big problem.[/color]
            >
            > Yes, but I'm taling about using a date function when you should have been
            > using a string function, not passing a date when you should have passed a
            > string. Intelisense will help the user in either the old or new way to pass
            > the right data into the function/method, but with the older functions, the
            > programmer has to somehow now the categories of functions. With methods,
            > there's no possibilty of that.[/color]

            As mentioned previously, I agree with you for most cases. The methods
            of the classes are better, but sometimes there doesn't exist an 1:1
            equivalent and VB.NET's function is more intuitive. It would be nice if
            the "missing" methods would be added to the classes contained in the
            FCL, so they can be removed from the VB.NET Runtime Library.

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

            Comment

            • Scott M.

              #36
              Re: getting rid of old vb6 code

              > >> No, absolutely not. Calling a 'String' object's method isn't more[color=blue][color=green][color=darkred]
              > >> intuitive for a "beginner" who isn't familiar with object oriented
              > >> programming. IMO it's impossible to be a good OO programmer without
              > >> having good knowledge in procedural programming, which is a basis.
              > >>[/color]
              > >
              > > Would a beginner programmer know what the string methods are[/color][/color]
              intuitively?[color=blue][color=green]
              > > No. But if they type a "." next to a string object, intellisense will[/color][/color]
              help[color=blue][color=green]
              > > them to learn what the string methods are.[/color]
              >
              > Not every "beginner" uses the VS.NET IDE for writing his/her source
              > code.
              >[/color]

              Even more of a case for organizing old functions into object methods! Less
              chaotic!
              [color=blue][color=green]
              > > It's true that there are no string method replacements for those, but[/color][/color]
              that's[color=blue][color=green]
              > > not an example of how the old Left() and Right() are more intuitive. I
              > > still have to know of thier existance before I can use them. I wouldn't
              > > just intuitively know that they exist.[/color]
              >
              > The same with the methods of the 'String' class... Without getting the
              > information somewhere, I don't know it.[/color]

              You want the information somewhere? Type a dot "." after your object.
              [color=blue]
              > As mentioned previously, I agree with you for most cases. The methods
              > of the classes are better, but sometimes there doesn't exist an 1:1
              > equivalent and VB.NET's function is more intuitive. It would be nice if
              > the "missing" methods would be added to the classes contained in the
              > FCL, so they can be removed from the VB.NET Runtime Library.[/color]

              And on that point we agree! Good night.


              Comment

              • Herfried K. Wagner [MVP]

                #37
                Re: getting rid of old vb6 code

                * "Scott M." <s-mar@BADSPAMsnet .net> scripsit:[color=blue][color=green]
                >> The same with the methods of the 'String' class... Without getting the
                >> information somewhere, I don't know it.[/color]
                >
                > You want the information somewhere? Type a dot "." after your object.[/color]

                Type 'Strings' and a ".", then...

                ;->
                [color=blue]
                > And on that point we agree! Good night.[/color]

                Good night.

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

                Comment

                • Cor

                  #38
                  Re: getting rid of old vb6 code

                  Hi Scott,

                  From who do you have this information, some own made?
                  [color=blue]
                  >
                  > By disabling the Microsoft.Visua lBasic namespace, you disable many of the
                  > old VB 6 functions and therefore you are left with the new .NET object
                  > methods (which, as I stated earlier are usually more efficient because[/color]
                  there[color=blue]
                  > is no extra step to invoke them).[/color]

                  It is not true the are sometimes more efficient some time less efficient.

                  Why I don't know but probably because they have to carry some extra with
                  them.

                  The Find of a string is twice as fast as the Instring.

                  Cor


                  Comment

                  • Cor

                    #39
                    Re: getting rid of old vb6 code

                    Hi Scott,

                    My problem with this kind of answers from you is (and this is not the first
                    time) that you give the OP the idea that by removing the classic VB
                    functions he starts writing OOP.

                    That is not, when he does only what you say, he is is making JavaScript
                    look-alike VB programs.

                    Because I have seen in other groups that you probably come from that
                    direction, it is possible that you have that misunderstandin g.

                    This is not to flame; in opposite of that, it is just to get a better
                    understanding why you are always post this kind of messages.

                    Cor


                    [color=blue]
                    > IMHO it doesn't seem that complex to use an object method instead of a
                    > function. In fact, it seems more intuitive. String objects will have
                    > string methods, math objects will have math methods, numeric objects with
                    > have numeric methods, data objects will have date methods AND the
                    > intellisense will only show those methods that are applicable to that
                    > particular object. If I use the old function approach, I open the door to
                    > type mismatches and I have to remember the names of all those functions[/color]
                    (no[color=blue]
                    > intellisense).[/color]


                    Comment

                    • Herfried K. Wagner [MVP]

                      #40
                      Re: getting rid of old vb6 code

                      * "Cor" <non@non.com> scripsit:[color=blue]
                      > My problem with this kind of answers from you is (and this is not the first
                      > time) that you give the OP the idea that by removing the classic VB
                      > functions he starts writing OOP.[/color]

                      Full ACK. Writing good OO code doesn't depend on using procedures or
                      don't using them inside the implementation. Far more important is the
                      application's class design, methods, good encapsulation etc. By
                      avioding the use of VB.NET's procedures, an application's design isn't
                      improved.

                      But I understand Scott -- he loves OOP and he loves /only/ OOP.

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

                      Comment

                      • Scott M.

                        #41
                        Re: getting rid of old vb6 code


                        "Cor" <non@non.com> wrote in message
                        news:eshTrVfyDH A.1804@TK2MSFTN GP09.phx.gbl...[color=blue]
                        > Hi Scott,
                        >
                        > From who do you have this information, some own made?
                        >[color=green]
                        > >
                        > > By disabling the Microsoft.Visua lBasic namespace, you disable many of[/color][/color]
                        the[color=blue][color=green]
                        > > old VB 6 functions and therefore you are left with the new .NET object
                        > > methods (which, as I stated earlier are usually more efficient because[/color]
                        > there[color=green]
                        > > is no extra step to invoke them).[/color]
                        >
                        > It is not true the are sometimes more efficient some time less efficient.
                        >
                        > Why I don't know but probably because they have to carry some extra with
                        > them.
                        >
                        > The Find of a string is twice as fast as the Instring.[/color]

                        That's my point exactly!


                        Comment

                        • Scott M.

                          #42
                          Re: getting rid of old vb6 code

                          > My problem with this kind of answers from you is (and this is not the
                          first[color=blue]
                          > time) that you give the OP the idea that by removing the classic VB
                          > functions he starts writing OOP.[/color]

                          Cor,

                          Yes, we've had these discussions before, but I think what you are missing is
                          that I NEVER said that by removing the classic functions, you are writing
                          OOP.

                          The OP asked:

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

                          Where is the request for OOP in that statement? What I supplied was an
                          answer to the OP about how old VB functions could be flagged and then
                          (presumably) replaced.

                          I appreciate your opinion, but it seems that each time this question comes
                          up, you take my answer to be something it was never intended to be.


                          Comment

                          • Cor

                            #43
                            Re: getting rid of old vb6 code

                            Hi Scott,

                            I told you why I am acting like this. I told you I almost never use
                            Microsoft.Visua l basic functions

                            However, sometimes I get the idea that when this kind of questions comes in
                            this newsgroup, that you are the first one who wants to tell not to use
                            those functions.

                            I think in some cases they are very good and nowhere is written that they
                            are old.
                            I do not like them, but that is my own decision.

                            It is not important because I think all is clear, but this was the start of
                            the message from the OP.
                            [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.[/color]

                            In my opinion is he pointing on "non-OOP aware" code.

                            I think it had been better to ask what he did mean with that sentence than
                            directly telling that he should get rid with the Microsoft.Visua lBasic
                            namespace.

                            That the name is Microsoft instead of System does not mean it is not in the
                            Net, it is even a part of the Linux Mono code as Tom Shelton told us.

                            However, marry Christmas,

                            No hard feeling at all, just wanted to clear this more.

                            Cor




                            Comment

                            • Scott M.

                              #44
                              Re: getting rid of old vb6 code

                              > I told you why I am acting like this. I told you I almost never use[color=blue]
                              > Microsoft.Visua l basic functions[/color]

                              Ok, fine. As I told Herfried, the decision to not use them was IMHO.
                              [color=blue]
                              > However, sometimes I get the idea that when this kind of questions comes[/color]
                              in[color=blue]
                              > this newsgroup, that you are the first one who wants to tell not to use
                              > those functions.[/color]

                              That may be true. I don't see any advantage at all to using them, so IMHO I
                              suggest not to. But in this case I was responding (as I said) to the OP who
                              wanted a way to flag the "old" VB 6.0 functions and this will certainly do
                              the trick. The OP already responded to me yesterday that this was what he
                              was looking for.

                              "Thanks Scott.

                              Always the simple answers that are the best :-)

                              Removing the Namespace at least alerts me to code to avoid in future
                              projects.

                              Thanks to all the others who responded as well.

                              Chook."
                              [color=blue]
                              > I think in some cases they are very good and nowhere is written that they[/color]
                              are old.

                              They've been around for approaching 10 years or more! Now that, in and of
                              itself does not make them bad. But there are new (and in my opinion more
                              intuitive and more efficient ways to accomplish most of the "old"
                              functions). So, I think to use the terms "old" and "new" is appropriate.
                              [color=blue]
                              > I do not like them, but that is my own decision.[/color]

                              Again, ok. I'm not twisting anyone's arm. I'm simply pointing out that
                              there are newer (more efficient & more intuitive) ways to do these things.
                              By the way, I've yet to hear ANYONE supply an example of why the old
                              functions would be a better way to go (other than that they are familiar
                              with them, which for a newbie to VB.NET wouldn't be a good reason to use
                              them).
                              [color=blue]
                              > It is not important because I think all is clear, but this was the start[/color]
                              of the message from the OP.[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.[/color]
                              >
                              > In my opinion is he pointing on "non-OOP aware" code.
                              >
                              > I think it had been better to ask what he did mean with that sentence than
                              > directly telling that he should get rid with the Microsoft.Visua lBasic
                              > namespace.[/color]

                              I see his question as trying to avoid 2 things "function calls" and "non-OOP
                              aware" code (that's exactly what he wrote). I answered the first of his 2
                              questions. That's all. I think the problem is that you interpreted my
                              answer as an answer to part 2 as well.

                              Again, the OP already responded that my answer was what he wanted, so I
                              think I interpreted the question correctly.

                              [color=blue]
                              > That the name is Microsoft instead of System does not mean it is not in[/color]
                              the Net, it is even a part of the Linux Mono code as Tom Shelton told us.

                              I've never made a statement saying that it wasn't.

                              MERRY CHRISTMAS TO ALL!!


                              Comment

                              Working...