473,795 Members | 3,002 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Modules versus classes with shared methods?

Is there any disadvantage to using a class with shared methods as
opposed to a module? I suppose the end result is the same, but I'm
curious about any other issues.

Regards,

Chris
Nov 20 '05 #1
4 4369
The only difference I have seen is, I find it easier to work with classes,
and unless you want to call

MyClass.MyShare dMethod

instead of amodules where you just call

MySharedMethod

Which you can do with a class with

imports MyClass

at the top... I see no real difference though... At elast for what I need.

"Chris Ashley" <ch**********@b lueyonder.co.uk > wrote in message
news:bl******** ****@ID-96489.news.uni-berlin.de...
Is there any disadvantage to using a class with shared methods as
opposed to a module? I suppose the end result is the same, but I'm
curious about any other issues.

Regards,

Chris

Nov 20 '05 #2
"Chris Ashley" <ch**********@b lueyonder.co.uk > schrieb
Is there any disadvantage to using a class with shared methods as
opposed to a module? I suppose the end result is the same, but I'm
curious about any other issues.


Two things you don't have to do with Modules:
- Write "Shared" in front of every member
- Import the class at project level

The result is the same.
--
Armin

Nov 20 '05 #3
Classes allow you to have Private and Protected variables as well as the
ability to use inheritance. Modules don't really.

I only use modules for what I like to call utility functions.. functions
that are totally object independent that do useful routines and don't really
handle important information..

If you are modelling objects then use classes in my opinion...that' s what
they are there for ;)

All the best,

Jon

"Chris Ashley" <ch**********@b lueyonder.co.uk > wrote in message
news:bl******** ****@ID-96489.news.uni-berlin.de...
Is there any disadvantage to using a class with shared methods as
opposed to a module? I suppose the end result is the same, but I'm
curious about any other issues.

Regards,

Chris

Nov 20 '05 #4
On 2003-09-26, Chris Ashley <ch**********@b lueyonder.co.uk > wrote:
Is there any disadvantage to using a class with shared methods as
opposed to a module? I suppose the end result is the same, but I'm
curious about any other issues.

Regards,

Chris


In fact, at the IL level there is no difference. A module is converted
by the VB.NET compiler into a sealed class with all shared methods. The
difference is mostly about style. Personally, I would use a class with
shared methods rather then a module - but that's me.

Tom Shelton
Nov 20 '05 #5

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

Similar topics

7
2073
by: Jorgen Grahn | last post by:
I have a set of tests in different modules: test_foo.py, test_bar.py and so on. All of these use the simplest possible internal layout: a number of classes containing test*() methods, and the good old lines at the end: if __name__ == "__main__": unittest.main() This is great, because each of the modules are runnable, and I can select classes or tests to run on the commandline if I want to. However, running all the tests from e.g. a...
4
2164
by: Chuck Ritzke | last post by:
I keep asking myself this question as I write class modules. What's the best/smartest/most efficient way to send a large object back and forth to a class module? For example, say I have a data access module that creates a large disconnected dataset from a database. I want to pass that dataset back to the calling program. And then perhaps I want to send that dataset to another class module. At first it seems that the "object oriented"...
5
11615
by: Erik Cruz | last post by:
Hello! I have read some threads discussing the fact that a module is in reality a shared class. If I try to create a Public Shared Class in vb.net I receive a compile error. Why? If I can't explicitly create a shared class, how does vb.net creates it? TIA, Erik Cruz
49
1868
by: Emmett | last post by:
I am working with a .NET development team and I am looking for reasons, that I can present to management, as to why we should develop our software using C# rather than VB.NET.
173
5736
by: Zytan | last post by:
I've read the docs on this, but one thing was left unclear. It seems as though a Module does not have to be fully qualified. Is this the case? I have source that apparently shows this. Are modules left-over from VB6, and not much used anymore? It seems that it is better to require Imports or use fully qualified names for functions in other classes/modules, but a Module doesn't require this, cluttering the global namespace. It seems...
0
9672
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10215
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10165
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10001
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9043
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7541
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6783
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5437
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3727
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.