Classes vs. Modules

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

    #61
    Re: Classes vs. Modules

    On Feb 10, 9:01 pm, "Scott M." <s...@nospam.no spamwrote:
    "Tom Leylan" <tley...@nospam .netwrote in message
    >
    news:u3wp%23PXT HHA.496@TK2MSFT NGP06.phx.gbl.. .
    >
    Scott: I just don't know where you are coming from on this. Have you
    tried placing Sub Main in a class and your command line switches didn't
    work or are you imagining it could be problematic and avoiding it as such?
    >
    I'm so sorry that you are having such a hard time Tom. To answer your
    question, no I haven't. But, that what not the OP. Modules are *another*
    way of handling such things. I find them easier for these situations than
    custom classes. I find them quicker to set up and use than custom classes
    and I find them to make more sense from a *flow* standpoint in these
    situations.
    >
    I'm sorry Scott, but you are making absolutely no sense here. The
    fact is that it takes almost exactly the same amount of work to put
    your sub main in a class as it does in a module. There is hardly any
    difference here, except for the addition of the shared keyword on the
    sub main - and that is what happens automatically if you use a module.

    There is no situation that I can think of where a module is superior
    or significantly easier then a class. That could be because I do 99%
    of all my work in C#, and there is no concept of a module there...
    The closest thing is the static class added in C#2.0 - which is a way
    to get the compiler to enforce what most of us do anyway - create a
    class with a private constructor and all static methods :)

    Now, I'm not saying that you shouldn't use Modules. Your style is
    your style. I don't use them when I do VB work, but that is my
    choice. The only thing I object to in your statement is the
    implication that it is more work to use a class.... Simply not true -
    at least in any significant manner.

    --
    Tom Shelton

    Comment

    • Bruce W. Darby

      #62
      Re: Classes vs. Modules

      ROOOOOOOOOBIN,

      Ollie Ollie Oxen Free...Free...F ree... :)

      Bruce

      "RobinS" <RobinS@NoSpam. yah.nonewrote in message
      news:4MmdnTXaD6 2zJFPYnZ2dnUVZ_ tKjnZ2d@comcast .com...
      There's only been one post by me (Robin) *in* this entire thread. Do you
      see this one?
      >
      Robin S.
      ----------------------
      "Scott M." <s-mar@nospam.nosp amwrote in message
      news:OAHhyFZTHH A.4076@TK2MSFTN GP05.phx.gbl...
      >Must have. I don't see anything from Robin in this entire thread.
      >>
      >>
      >"Bruce W. Darby" <kracorat@atcom cast.netwrote in message
      >news:e8GdnRTsg ZVgw1PYnZ2dnUVZ _sWdnZ2d@comcas t.com...
      >>Not sure Scott. Are you seeing other posts by Robin? Or did you
      >>inadvertent ly add him to your killfile?
      >>>
      >>"Scott M." <s-mar@nospam.nosp amwrote in message
      >>news:OewPq6WT HHA.1364@TK2MSF TNGP06.phx.gbl. ..
      >>>Hmmm, why don't I see Robin's message in this thread?
      >>>>
      >>>>
      >>>"Bruce W. Darby" <kracorat@atcom cast.netwrote in message
      >>>news:VPOdnfP nqumNpVPYnZ2dnU VZ_tunnZ2d@comc ast.com...
      >>>>I'll answer that for him, Robin.... because he CAN'T!! I'm coming to
      >>>>the conclusion that our neophyte troll doesn't know how to program. If
      >>>>he can't drag it and drop it, he's lost. Now, he COULD prove me wrong,
      >>>>but I doubt that he'll even attempt to. :)
      >>>>>
      >>>>Bruce
      >>>>>
      >>>>"RobinS" <RobinS@NoSpam. yah.nonewrote in message
      >>>>news:xsidnT 6DOox6ilPYnZ2dn UVZ_vyunZ2d@com cast.com...
      >>>>>Why don't you post some code samples that show the same thing running
      >>>>>in VB6 and VB2005 and show the performance statistics?
      >>>>>>
      >>>>>Robin S.
      >>>>>Ts'i mahnu uterna ot twan ot geifur hingts uto.
      >>>>>-----------------------------------------------
      >>>>>
      >>>>>
      >>>>
      >>>>
      >>>
      >>>
      >>
      >>
      >
      >

      Comment

      • RobinS

        #63
        Re: Classes vs. Modules

        Oh, there you are. I was hiding behind the Sycamore TreeView over there.

        You guys were doing such a great job discussing this, I didn't really need
        to stick my two cents' worth in here. :-)

        Robin S.
        ------------------------------------
        "Bruce W. Darby" <kracorat@atcom cast.netwrote in message
        news:DZednbUNP-dwIFPYnZ2dnUVZ_ uiknZ2d@comcast .com...
        ROOOOOOOOOBIN,
        >
        Ollie Ollie Oxen Free...Free...F ree... :)
        >
        Bruce
        >
        "RobinS" <RobinS@NoSpam. yah.nonewrote in message
        news:4MmdnTXaD6 2zJFPYnZ2dnUVZ_ tKjnZ2d@comcast .com...
        >There's only been one post by me (Robin) *in* this entire thread. Do you
        >see this one?
        >>
        >Robin S.
        >----------------------
        >"Scott M." <s-mar@nospam.nosp amwrote in message
        >news:OAHhyFZTH HA.4076@TK2MSFT NGP05.phx.gbl.. .
        >>Must have. I don't see anything from Robin in this entire thread.
        >>>
        >>>
        >>"Bruce W. Darby" <kracorat@atcom cast.netwrote in message
        >>news:e8GdnRTs gZVgw1PYnZ2dnUV Z_sWdnZ2d@comca st.com...
        >>>Not sure Scott. Are you seeing other posts by Robin? Or did you
        >>>inadvertentl y add him to your killfile?
        >>>>
        >>>"Scott M." <s-mar@nospam.nosp amwrote in message
        >>>news:OewPq6W THHA.1364@TK2MS FTNGP06.phx.gbl ...
        >>>>Hmmm, why don't I see Robin's message in this thread?
        >>>>>
        >>>>>
        >>>>"Bruce W. Darby" <kracorat@atcom cast.netwrote in message
        >>>>news:VPOdnf PnqumNpVPYnZ2dn UVZ_tunnZ2d@com cast.com...
        >>>>>I'll answer that for him, Robin.... because he CAN'T!! I'm coming to
        >>>>>the conclusion that our neophyte troll doesn't know how to program.
        >>>>>If he can't drag it and drop it, he's lost. Now, he COULD prove me
        >>>>>wrong, but I doubt that he'll even attempt to. :)
        >>>>>>
        >>>>>Bruce
        >>>>>>
        >>>>>"RobinS" <RobinS@NoSpam. yah.nonewrote in message
        >>>>>news:xsidn T6DOox6ilPYnZ2d nUVZ_vyunZ2d@co mcast.com...
        >>>>>>Why don't you post some code samples that show the same thing
        >>>>>>running in VB6 and VB2005 and show the performance statistics?
        >>>>>>>
        >>>>>>Robin S.
        >>>>>>Ts'i mahnu uterna ot twan ot geifur hingts uto.
        >>>>>>-----------------------------------------------
        >>>>>>
        >>>>>>
        >>>>>
        >>>>>
        >>>>
        >>>>
        >>>
        >>>
        >>
        >>
        >
        >

        Comment

        • Bruce W. Darby

          #64
          Re: Classes vs. Modules

          Welcome back. :)

          "RobinS" <RobinS@NoSpam. yah.nonewrote in message
          news:3IqdnX5AHN wBXFPYnZ2dnUVZ_ hadnZ2d@comcast .com...
          Oh, there you are. I was hiding behind the Sycamore TreeView over there.
          >
          You guys were doing such a great job discussing this, I didn't really need
          to stick my two cents' worth in here. :-)
          >
          Robin S.

          Comment

          • RobinS

            #65
            Re: Classes vs. Modules

            Thanks! And thanks for not asking what I was doin' over there behind the
            Sycamore. ;-)


            Robin S.
            --------------------------------
            "Bruce W. Darby" <kracorat@atcom cast.netwrote in message
            news:KZ-dnSemW8FQX1PYnZ 2dnUVZ_uOmnZ2d@ comcast.com...
            Welcome back. :)
            >
            "RobinS" <RobinS@NoSpam. yah.nonewrote in message
            news:3IqdnX5AHN wBXFPYnZ2dnUVZ_ hadnZ2d@comcast .com...
            >Oh, there you are. I was hiding behind the Sycamore TreeView over there.
            >>
            >You guys were doing such a great job discussing this, I didn't really
            >need to stick my two cents' worth in here. :-)
            >>
            >Robin S.
            >
            >

            Comment

            • Spam Catcher

              #66
              Re: Classes vs. Modules

              "Zytan" <zytanlithium@y ahoo.comwrote in news:1171055866 .052844.204220
              @h3g2000cwc.goo glegroups.com:
              I try to avoid global vars like the plague, as do most, so I cannot
              see why anyone would still want to use this.
              For redundant functions it doesn't make sent to need to instaniate
              everytime just to use em :-)

              Comment

              • Tom Shelton

                #67
                Re: Classes vs. Modules

                On 2007-02-11, Spam Catcher <spamhoneypot@r ogers.comwrote:
                "Zytan" <zytanlithium@y ahoo.comwrote in news:1171055866 .052844.204220
                @h3g2000cwc.goo glegroups.com:
                >
                >I try to avoid global vars like the plague, as do most, so I cannot
                >see why anyone would still want to use this.
                >
                For redundant functions it doesn't make sent to need to instaniate
                everytime just to use em :-)
                You don't need to - just make the methods/properties shared. For example
                - System.Math. You don't have to create one to use it's functionality.. .

                --
                Tom Shelton

                Comment

                • Cor Ligthert [MVP]

                  #68
                  Re: Classes vs. Modules

                  Tom,

                  Read the comments from Herfried and me, it is seldom that we agree so much,
                  so there must be something.

                  Cor

                  "Tom Shelton" <tom_shelton@co mcast.netschree f in bericht
                  news:1171176790 .009631.58250@j 27g2000cwj.goog legroups.com...
                  On Feb 10, 9:01 pm, "Scott M." <s...@nospam.no spamwrote:
                  >"Tom Leylan" <tley...@nospam .netwrote in message
                  >>
                  >news:u3wp%23PX THHA.496@TK2MSF TNGP06.phx.gbl. ..
                  >>
                  Scott: I just don't know where you are coming from on this. Have you
                  tried placing Sub Main in a class and your command line switches didn't
                  work or are you imagining it could be problematic and avoiding it as
                  such?
                  >>
                  >I'm so sorry that you are having such a hard time Tom. To answer your
                  >question, no I haven't. But, that what not the OP. Modules are
                  >*another*
                  >way of handling such things. I find them easier for these situations
                  >than
                  >custom classes. I find them quicker to set up and use than custom
                  >classes
                  >and I find them to make more sense from a *flow* standpoint in these
                  >situations.
                  >>
                  >
                  I'm sorry Scott, but you are making absolutely no sense here. The
                  fact is that it takes almost exactly the same amount of work to put
                  your sub main in a class as it does in a module. There is hardly any
                  difference here, except for the addition of the shared keyword on the
                  sub main - and that is what happens automatically if you use a module.
                  >
                  There is no situation that I can think of where a module is superior
                  or significantly easier then a class. That could be because I do 99%
                  of all my work in C#, and there is no concept of a module there...
                  The closest thing is the static class added in C#2.0 - which is a way
                  to get the compiler to enforce what most of us do anyway - create a
                  class with a private constructor and all static methods :)
                  >
                  Now, I'm not saying that you shouldn't use Modules. Your style is
                  your style. I don't use them when I do VB work, but that is my
                  choice. The only thing I object to in your statement is the
                  implication that it is more work to use a class.... Simply not true -
                  at least in any significant manner.
                  >
                  --
                  Tom Shelton
                  >

                  Comment

                  • Tom Shelton

                    #69
                    Re: Classes vs. Modules

                    On Feb 11, 3:21 am, "Cor Ligthert [MVP]" <notmyfirstn... @planet.nl>
                    wrote:
                    Tom,
                    >
                    Read the comments from Herfried and me, it is seldom that we agree so much,
                    so there must be something.
                    >
                    Cor
                    >
                    Cor,

                    I have read both your comments - and I have to respectfully disagree
                    with them. Especially the notion by Herfried that a module is a loose
                    grouping of functions. In my mind a module should - like a class -
                    have single purpose. All functionality in that module should be
                    related - like a class.

                    Anyway, I'm not here to try and convince anyone to my way of
                    thinking. Everyone has their own style and their own ideas about how
                    things should be done. My idea is to avoid module and use a class
                    with shared methods - you and Herfried like to use modules. That's
                    ok. It was an interesting discussion at least :)

                    --
                    Tom Shelton

                    Comment

                    • Herfried K. Wagner [MVP]

                      #70
                      Re: Classes vs. Modules

                      "Tom Shelton" <tom_shelton@co mcast.netschrie b:
                      I have read both your comments - and I have to respectfully disagree
                      with them. Especially the notion by Herfried that a module is a loose
                      grouping of functions. In my mind a module should - like a class -
                      have single purpose.
                      I don't disagree :-). The Visual Basic Runtime Library's function library
                      and its modules is IMO a good example on how using modules is a good idea.
                      It's pretty clear that using modules to group things that are not related to
                      each other is as useless as placing them in the same class.

                      --
                      M S Herfried K. Wagner
                      M V P <URL:http://dotnet.mvps.org/>
                      V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

                      Comment

                      • Cor Ligthert [MVP]

                        #71
                        Re: Classes vs. Modules

                        Tom,

                        I think you misinterpret what we want to say.

                        A shared class is not a class, it is our opinion a created couple of words
                        (not even one) to describe a memory part with no object behaviour. That
                        while there is for that one nice word, what describes that "Module".
                        Therefore don't make it difficult for newbie's who want to learn what is
                        OOP. Use a class for a to instance object. Use Module for a piece of code
                        permanent and shareable in the program.

                        Cor

                        "Tom Shelton" <tom_shelton@co mcast.netschree f in bericht
                        news:1171191959 .512004.260570@ m58g2000cwm.goo glegroups.com.. .
                        On Feb 11, 3:21 am, "Cor Ligthert [MVP]" <notmyfirstn... @planet.nl>
                        wrote:
                        >Tom,
                        >>
                        >Read the comments from Herfried and me, it is seldom that we agree so
                        >much,
                        >so there must be something.
                        >>
                        >Cor
                        >>
                        >
                        Cor,
                        >
                        I have read both your comments - and I have to respectfully disagree
                        with them. Especially the notion by Herfried that a module is a loose
                        grouping of functions. In my mind a module should - like a class -
                        have single purpose. All functionality in that module should be
                        related - like a class.
                        >
                        Anyway, I'm not here to try and convince anyone to my way of
                        thinking. Everyone has their own style and their own ideas about how
                        things should be done. My idea is to avoid module and use a class
                        with shared methods - you and Herfried like to use modules. That's
                        ok. It was an interesting discussion at least :)
                        >
                        --
                        Tom Shelton
                        >

                        Comment

                        • Spam Catcher

                          #72
                          Re: Classes vs. Modules

                          Tom Shelton <tom_shelton@co mcastXXXXXXX.ne twrote in
                          news:uOCdncM2zY nmf1PYnZ2dnUVZ_ tadnZ2d@comcast .com:
                          >For redundant functions it doesn't make sent to need to instaniate
                          >everytime just to use em :-)
                          >
                          You don't need to - just make the methods/properties shared. For
                          example
                          - System.Math. You don't have to create one to use it's
                          functionality.. .
                          Yes, I meant shared functions - I realized the ambiguity of my message
                          after I posted it.

                          Comment

                          • Tom Shelton

                            #73
                            Re: Classes vs. Modules

                            On Feb 11, 5:58 am, "Cor Ligthert [MVP]" <notmyfirstn... @planet.nl>
                            wrote:
                            Tom,
                            >
                            I think you misinterpret what we want to say.
                            >
                            A shared class is not a class, it is our opinion a created couple of words
                            (not even one) to describe a memory part with no object behaviour.
                            I'm not so sure about that... Even SmallTalk has the concept of class
                            methods vs instance methods (at least, I am led to believe that - I
                            don't know SmallTalk myself). The idea of class methods (shared
                            methods) has been around for sometime.

                            Are they a fully OO concept? Hmmm... I would have to give that some
                            thought.
                            That
                            while there is for that one nice word, what describes that "Module".
                            Therefore don't make it difficult for newbie's who want to learn what is
                            OOP.
                            I'm not trying to make it difficult on anyone. It's obvioulsy a
                            concept that a lot of people have different oppinions on. And who is
                            right? I am not convinced yet that a shared (static) class is not an
                            OOP construct.
                            Use a class for a to instance object. Use Module for a piece of code
                            permanent and shareable in the program.
                            I will think about this some more. Maybe I'll agree with you :)

                            --
                            Tom Shelton

                            Comment

                            • Tom Shelton

                              #74
                              Re: Classes vs. Modules

                              On Feb 11, 6:31 am, "Herfried K. Wagner [MVP]" <hirf-spam-me-
                              h...@gmx.atwrot e:
                              "Tom Shelton" <tom_shel...@co mcast.netschrie b:
                              >
                              I have read both your comments - and I have to respectfully disagree
                              with them. Especially the notion by Herfried that a module is a loose
                              grouping of functions. In my mind a module should - like a class -
                              have single purpose.
                              >
                              I don't disagree :-). The Visual Basic Runtime Library's function library
                              and its modules is IMO a good example on how using modules is a good idea.
                              It's pretty clear that using modules to group things that are not related to
                              each other is as useless as placing them in the same class.
                              Then we are in agreement for the most part :) I'm not so sure that I
                              would ever prefer a module over a class yet though....

                              --
                              Tom Shelton

                              Comment

                              • Scott M.

                                #75
                                Re: Classes vs. Modules

                                I see this one. Perhaps you replied to someone that I have on my kill list
                                so I didn't see that branch!


                                "RobinS" <RobinS@NoSpam. yah.nonewrote in message
                                news:4MmdnTXaD6 2zJFPYnZ2dnUVZ_ tKjnZ2d@comcast .com...
                                There's only been one post by me (Robin) *in* this entire thread. Do you
                                see this one?
                                >
                                Robin S.
                                ----------------------
                                "Scott M." <s-mar@nospam.nosp amwrote in message
                                news:OAHhyFZTHH A.4076@TK2MSFTN GP05.phx.gbl...
                                >Must have. I don't see anything from Robin in this entire thread.
                                >>
                                >>
                                >"Bruce W. Darby" <kracorat@atcom cast.netwrote in message
                                >news:e8GdnRTsg ZVgw1PYnZ2dnUVZ _sWdnZ2d@comcas t.com...
                                >>Not sure Scott. Are you seeing other posts by Robin? Or did you
                                >>inadvertent ly add him to your killfile?
                                >>>
                                >>"Scott M." <s-mar@nospam.nosp amwrote in message
                                >>news:OewPq6WT HHA.1364@TK2MSF TNGP06.phx.gbl. ..
                                >>>Hmmm, why don't I see Robin's message in this thread?
                                >>>>
                                >>>>
                                >>>"Bruce W. Darby" <kracorat@atcom cast.netwrote in message
                                >>>news:VPOdnfP nqumNpVPYnZ2dnU VZ_tunnZ2d@comc ast.com...
                                >>>>I'll answer that for him, Robin.... because he CAN'T!! I'm coming to
                                >>>>the conclusion that our neophyte troll doesn't know how to program. If
                                >>>>he can't drag it and drop it, he's lost. Now, he COULD prove me wrong,
                                >>>>but I doubt that he'll even attempt to. :)
                                >>>>>
                                >>>>Bruce
                                >>>>>
                                >>>>"RobinS" <RobinS@NoSpam. yah.nonewrote in message
                                >>>>news:xsidnT 6DOox6ilPYnZ2dn UVZ_vyunZ2d@com cast.com...
                                >>>>>Why don't you post some code samples that show the same thing running
                                >>>>>in VB6 and VB2005 and show the performance statistics?
                                >>>>>>
                                >>>>>Robin S.
                                >>>>>Ts'i mahnu uterna ot twan ot geifur hingts uto.
                                >>>>>-----------------------------------------------
                                >>>>>
                                >>>>>
                                >>>>
                                >>>>
                                >>>
                                >>>
                                >>
                                >>
                                >
                                >

                                Comment

                                Working...