473,382 Members | 1,302 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Module vs Class Module

Are there any performance or memory-usage benefits of placing public
functions and subroutines in a Class Module rather than a standard
module?
Nov 20 '05 #1
4 13879
All a module is is a sealed class with all shared properties/methods etc.
I'm not sure if you are referring to 'Class Module' as in the old VBA sense
or as a Class. There is not Class Module in the VBA sense equvialent in
..NET
"Brad Parks" <br***********@yahoo.com> wrote in message
news:bf**************************@posting.google.c om...
Are there any performance or memory-usage benefits of placing public
functions and subroutines in a Class Module rather than a standard
module?

Nov 20 '05 #2
"Brad Parks" <br***********@yahoo.com> schrieb
Are there any performance or memory-usage benefits of placing
public functions and subroutines in a Class Module rather than a
standard module?


No. A Module *is* a special class:
- all members are automatically declared Shared
- no instance can be created
- it is imported automatically at project level
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #3
Brad,

* br***********@yahoo.com (Brad Parks) scripsit:
Are there any performance or memory-usage benefits of placing public
functions and subroutines in a Class Module rather than a standard
module?


If you are referring to VB Classic (Version 1-6), please turn to one of
the microsoft.public.vb.* groups.

For VB.NET: Modules get compiled to friend classes which are imported
automatically. There are no performance and memory-using benefits when
using a class with shared methods instead.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4
Brad,
If by "Class Module" you are referring to a class that only has Shared
members, then as the others have stated there is no performance or
memory-usage benefits.

However! the biggest benefit I see to using classes with Shared members over
Modules is encapsulation, you are "required" to qualify the name of the
class when you use one of the shared members, ensuring that you know were
that member is coming form.

BTW: You can relax this "requirement" by importing the class itself, which
then allows it to work like a Module for that source file.

For example:
Imports System.Math

Hope this helps
Jay

"Brad Parks" <br***********@yahoo.com> wrote in message
news:bf**************************@posting.google.c om...
Are there any performance or memory-usage benefits of placing public
functions and subroutines in a Class Module rather than a standard
module?

Nov 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Bo Peng | last post by:
Dear list, I am writing a Python extension module that needs a way to expose pieces of a big C array to python. Currently, I am using NumPy like the following: PyObject* res =...
5
by: dody suria wijaya | last post by:
I found this problem when trying to split a module into two. Here's an example: ============== #Module a (a.py): from b import * class Main: pass ============== ==============
4
by: Edvard Majakari | last post by:
Greetings, fellow Pythonistas! I'm about to create three modules. As an avid TDD fan I'd like to create typical 'use-cases' for each of these modules. One of them is rather large, and I wondered...
2
by: Reid Priedhorsky | last post by:
Dear group, I'd have a class defined in one module, which descends from another class defined in a different module. I'd like the superclass to be able to access objects defined in the first...
25
by: Xah Lee | last post by:
Python Doc Problem Example: gzip Xah Lee, 20050831 Today i need to use Python to compress/decompress gzip files. Since i've read the official Python tutorial 8 months ago, have spent 30...
10
by: Bonzol | last post by:
vb.net Hey there, could someone just tell me what the differnce is between classes and modules and when each one would be used compared to the other? Any help would be great Thanx in...
9
by: Rudy | last post by:
Hello All! I'm a little confused on Public Class or Modules. Say I have a this on form "A" Public Sub Subtract() Dim Invoice As Decimal Dim Wage As Decimal Static PO As Decimal Invoice =...
32
by: Matias Jansson | last post by:
I come from a background of Java and C# where it is common practise to have one class per file in the file/project structure. As I have understood it, it is more common practice to have many...
6
by: JonathanOrlev | last post by:
Hello everyone, I have a newbe question: In Access (2003) VBA, what is the difference between a Module and a Class Module in the VBA development environment? If I remember correctly, new...
13
by: André | last post by:
Hi, i'm developping asp.net applications and therefore i use VB.net. I have some questions about best practises. According what i read about class and module and if i understand it right, a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.