Classes vs. Modules

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • aaron.kempf@gmail.com

    #91
    Re: Classes vs. Modules

    Tom

    I am so sorry that you had a fag computer science professor

    it doesn't mean that classes make your code run faster
    it doesn't simplify

    and it doesn't support reuse

    Comment

    • aaron.kempf@gmail.com

      #92
      Re: Classes vs. Modules

      tom

      the basic variable naming convention was from the friggin 80s dude; I
      mean.. nobody used that recently; except one kid I knew in insurance;
      he still used that

      and it wasn't a matter that string variables _MUST_ end with a $
      symbol

      I just found this great book about basic; it is literally from 1982..
      it reminds me of the good ole days

      it's got the best illustrations in it


      Comment

      • aaron.kempf@gmail.com

        #93
        Re: Classes vs. Modules

        because robin is a flamer

        she doesn't stay on topic


        Comment

        • aaron.kempf@gmail.com

          #94
          Re: Classes vs. Modules

          Scott;

          re: 1.5mb runtime; keep on preaching the good word, bro

          maybe someday the framework will get under 10mb

          -Aaron

          Comment

          • aaron.kempf@gmail.com

            #95
            Re: Classes vs. Modules

            no dude

            an extra minute here and there adds up

            that is why I can out-develop you with my hands tied behind my back

            -Aaron

            Comment

            • aaron.kempf@gmail.com

              #96
              Re: Classes vs. Modules

              tom

              if you're a c# fag then get the fuck out of my newsgroup

              C# is to fight java; which I claim was 'never a threat'

              -Aaron

              Comment

              • aaron.kempf@gmail.com

                #97
                Re: Classes vs. Modules

                fully agree spam catcher

                I mean-- it's really obvious to me that modules should be used
                whenever possible so you don't need 12 different copies of the same
                method

                (since vb 2005 and c# don't support polymorphism)



                On Feb 11, 12:43 am, Spam Catcher <spamhoney...@r ogers.comwrote:
                "Zytan" <zytanlith...@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

                • Michael D. Ober

                  #98
                  Re: Classes vs. Modules

                  That's news to me. I use polymorphism in both VB 2005 and C# 2005. Maybe
                  what you really mean is that both languages require (optional in VB 2005)
                  strongly typed parameter passing and VB 6 and earlier let you write sloppy
                  code that you had to runtime check every single parameter.

                  Mike Ober.

                  <aaron.kempf@gm ail.comwrote in message
                  news:1171302098 .611440.30110@p 10g2000cwp.goog legroups.com...
                  fully agree spam catcher
                  >
                  I mean-- it's really obvious to me that modules should be used
                  whenever possible so you don't need 12 different copies of the same
                  method
                  >
                  (since vb 2005 and c# don't support polymorphism)
                  >
                  >
                  >
                  On Feb 11, 12:43 am, Spam Catcher <spamhoney...@r ogers.comwrote:
                  >"Zytan" <zytanlith...@y ahoo.comwrote in news:1171055866 .052844.204220
                  >@h3g2000cwc.go oglegroups.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

                  • BK

                    #99
                    Re: Classes vs. Modules

                    On Feb 12, 12:41 pm, "aaron.ke...@gm ail.com" <aaron.ke...@gm ail.com>
                    wrote:
                    fully agree spam catcher
                    >
                    I mean-- it's really obvious to me that modules should be used
                    whenever possible so you don't need 12 different copies of the same
                    method
                    >
                    (since vb 2005 and c# don't support polymorphism)
                    >
                    Sure they do, in VB look up Overload for starters.

                    Comment

                    • Herfried K. Wagner [MVP]

                      #100
                      Re: Classes vs. Modules

                      "Zytan" <zytanlithium@y ahoo.comschrieb :
                      Branco, yes, this helps a lot. Thanks for your very informative
                      post. I had thought about making modules in namespaces, but I am not
                      comfortable with it due to lack of experience. But, I can see how
                      this helps. I guess the lack of need to use the module name itself
                      throws me off, even in this case. Yes, the namespace is required
                      (unless you use Imports), but the module name can always be missing.
                      I suppose most people use Imports for many things, though, and they
                      are used to this.
                      Personally I import all namespaces containing types I am using. I hate
                      namespace-qualified types inside the implementation because they blow up
                      code resulting in very long lines. In general I qualify types (classes,
                      structures, ...) and functions (in modules) only if there would be a name
                      clash otherwise.

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

                      Comment

                      • Scott M.

                        #101
                        Re: Classes vs. Modules

                        I rarely put anyone on my filter list, so if he's on it, he must be a real
                        winner!


                        "RobinS" <RobinS@NoSpam. yah.nonewrote in message
                        news:YeqdnZeeE-n6eVLYnZ2dnUVZ_ vipnZ2d@comcast .com...
                        And I bet you miss that, don't you? ;-)
                        >
                        Robin S.
                        -----------------------------
                        "Scott M." <s-mar@nospam.nosp amwrote in message
                        news:ebNj1HkTHH A.4404@TK2MSFTN GP03.phx.gbl...
                        >Ah, that must be it since I don't see any messages from Aaron either.
                        >>
                        >>
                        >"RobinS" <RobinS@NoSpam. yah.nonewrote in message
                        >news:TM-dnbWlhdLh71LYnZ 2dnUVZ_qunnZ2d@ comcast.com...
                        >>Yes, it was a response to Aaron Kempf. Otherwise, I didn't feel you guys
                        >>needed any help discussing this issue; you were doing great without my
                        >>input. ;-)
                        >>>
                        >>Robin S.
                        >>---------------------------
                        >>"Scott M." <s-mar@nospam.nosp amwrote in message
                        >>news:uWeXABhT HHA.1228@TK2MSF TNGP06.phx.gbl. ..
                        >>>>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:4MmdnTX aD62zJFPYnZ2dnU VZ_tKjnZ2d@comc ast.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:OAHhyF ZTHHA.4076@TK2M SFTNGP05.phx.gb l...
                        >>>>>Must have. I don't see anything from Robin in this entire thread.
                        >>>>>>
                        >>>>>>
                        >>>>>"Bruce W. Darby" <kracorat@atcom cast.netwrote in message
                        >>>>>news:e8Gdn RTsgZVgw1PYnZ2d nUVZ_sWdnZ2d@co mcast.com...
                        >>>>>>Not sure Scott. Are you seeing other posts by Robin? Or did you
                        >>>>>>inadverte ntly add him to your killfile?
                        >>>>>>>
                        >>>>>>"Scott M." <s-mar@nospam.nosp amwrote in message
                        >>>>>>news:OewP q6WTHHA.1364@TK 2MSFTNGP06.phx. gbl...
                        >>>>>>>Hmmm, why don't I see Robin's message in this thread?
                        >>>>>>>>
                        >>>>>>>>
                        >>>>>>>"Bruce W. Darby" <kracorat@atcom cast.netwrote in message
                        >>>>>>>news:VPO dnfPnqumNpVPYnZ 2dnUVZ_tunnZ2d@ comcast.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:xs idnT6DOox6ilPYn Z2dnUVZ_vyunZ2d @comcast.com...
                        >>>>>>>>>Why don't you post some code samples that show the same thing
                        >>>>>>>>>runnin g in VB6 and VB2005 and show the performance statistics?
                        >>>>>>>>>>
                        >>>>>>>>>Robi n S.
                        >>>>>>>>>Ts'i mahnu uterna ot twan ot geifur hingts uto.
                        >>>>>>>>>-----------------------------------------------
                        >>>>>>>>>
                        >>>>>>>>>
                        >>>>>>>>
                        >>>>>>>>
                        >>>>>>>
                        >>>>>>>
                        >>>>>>
                        >>>>>>
                        >>>>>
                        >>>>>
                        >>>>
                        >>>>
                        >>>
                        >>>
                        >>
                        >>
                        >
                        >

                        Comment

                        • Martin H.

                          #102
                          Re: Classes vs. Modules

                          Hello Aaron,
                          lloyd
                          >
                          I just said that 80% of vb6 programmers 'never used a class'
                          >
                          why did we need to get enlightened?
                          >
                          does moving to classes make our code faster?
                          It might even slow down your program a bit (for the tiny moment the
                          class needs to be instantiated). However, classes have the advantage
                          that you can encapsulate your code so that only for those objects you
                          need it for you can use it.

                          The following examples are just easy ones to give you the idea.

                          Example 1:
                          Let's say you have a class tree and a class house:

                          Public Class Tree
                          Public Sub Water()
                          ....
                          End Sub
                          Public Sub Soil()
                          ....
                          End Sub
                          Public Sub Sunshine()
                          ....
                          End Sub
                          End Class

                          Public Class House
                          Public Sub Wall()
                          ....
                          End Sub
                          Public Sub Roof()
                          ....
                          End Sub
                          Public Sub Window()
                          ....
                          End Sub
                          Public Sub Door()
                          ....
                          End Sub
                          End Class

                          As you see, these two classes have nothing in common. So, when using
                          these classes you don't need to worry that perhaps you have global
                          variable (BAD...) somewhere which is changed by one of the routines as
                          you would keep your variables only locally within a class.


                          Example 2:
                          Now, let's say you want to write a program about vehicles.

                          Public Class Vehicle
                          Private vWheels As Integer = 0
                          Public Property Wheels() As Integer
                          Get
                          Return vWheels
                          End Get
                          Set (ByVal Value As Integer)
                          If Value<0 Then
                          Err.Raise(450)
                          Else
                          vWheels = Value
                          End If
                          End Set
                          End Property
                          End Class

                          Public Class VehicleWithEngi ne
                          Inherits Vehicle
                          Private vHorsePower As Integer = 1
                          Private vCylinders As Integer = 1
                          Public Property HorsePower () As Integer
                          Get
                          Return vHorsePower
                          End Get
                          Set (ByVal Value As Integer)
                          If Value<1 Then
                          Err.Raise(450)
                          Else
                          vHorsePower=Val ue
                          End If
                          End Set
                          End Property

                          Public Property Cylinders As Integers
                          Get
                          Return vCylinders
                          End Get
                          Set (ByVal Value As Integer)
                          If Value <1 Then
                          Err.Raise(450)
                          Else
                          vCylinders=Valu e
                          EndIf
                          End Set
                          End Property
                          End Class

                          Public Class Car
                          Inherits VehicleWithEngi ne
                          Private vDoors As Integer
                          Public Property Doors () As Integer
                          Get
                          Return vDoors
                          End Get
                          Set (ByVal Value As Integer)
                          If Value<1 Then
                          Err.Raise(450)
                          Else
                          vDoors = Value
                          End If
                          End Set
                          End Property
                          End Class

                          The advantage here is, that you can reuse your code. You just write your
                          code (and error handling) once and you can use it over and over again,
                          because car has the complete functionality of Vehicle and VehicleWithEngi ne.

                          Let's say, you finished your "Car" class. Now, you need a "Truck" class.
                          Just inherit it from Car (as a truck is just a big, specialized car) and
                          add the missing things (e.g. loading ramp).

                          I don't say that classes are the best invention in the world, but they
                          can help you to keep your source code "tidy".

                          Best regards,

                          Martin

                          Comment

                          • Zytan

                            #103
                            Re: Classes vs. Modules

                            that would sure be interesting to me
                            >
                            so I can make a class named 'aaron' and I can put functions in it..
                            and I can reuse those functions without instantiating a class?
                            >
                            I just don't like all of the dependencies between that style of
                            writing; it makes me sick to think about it
                            Dependencies are bad for sure. But, I am not sure what writing style
                            you are referring to that has dependencies? Using Modules? Using
                            Classes? The only 'dependency' I can see is that Classes are forced
                            to have everything Shared to act as a Module, but this is reinforced
                            if ever you attempt to use a function, so it's ok.

                            Zytan

                            Comment

                            • Zytan

                              #104
                              Re: Classes vs. Modules

                              clutter the global namespace?

                              Yes. That's what it does.

                              does this make the app slower?
                              No. Besides, who's talking about speed? Even if speed mattered,
                              neither requires construction, so they are the same speed.

                              does it make carol in accounting enter data _FASTER_ ??
                              We're talking about programming, not UI. Keep on topic.

                              Zytan

                              Comment

                              • Zytan

                                #105
                                Re: Classes vs. Modules

                                I think that simply importing a namespace into the file is evil (or
                                something close to it). My (personal, mind you) rule of thumb is, if I
                                must use Imports, then I must create an alias to it:
                                >
                                Imports SysThread = System.Threadin g
                                Imports SysRegex = System.Text.Reg ularExpression
                                >
                                As opposed to:
                                >
                                Imports System.Threadin g
                                Imports System.Text.Reg ularExpression
                                Wow! I didn't know you could do that!
                                Don't know if this relates to what you're talking about, and my
                                apologies if it drifts to OT.
                                No apologies needed! This is exactly what I am talking about! I
                                totally agree that importing namespaces is evil. I want to learn the
                                language properly, so it is important for me to know where things
                                are. I've been writing everything out explicitly. But, in doing so,
                                I can see why people get tired of it (although IntelliSense helps a
                                ton). But... your suggestion above is a very good answer to this, as
                                it saves typing, but requires the shorthand so that you remember where
                                the darn thing actually exists.

                                Great idea. And great concept that they implemented. thanks!

                                Zytan

                                Comment

                                Working...