Q: When developing an information system, which are the essential things (if they exists that is) i'm suppose to put in a class module?:(
Printable View
Q: When developing an information system, which are the essential things (if they exists that is) i'm suppose to put in a class module?:(
Why do you want to use class modules ?
I avoid the things like the plague personally ...
you normally have a team for this type of thing, or sit down and look at the possibilities for your project.
There isn't really a simple answer to this one. :( The idea of a class module is reusing your code. I.e. if you have a button on all your forms that when pressed shows a messagebox, you would put this in the class module :Then rather than typing out the above under each button, you only need to type the word "Msg" and this class modules sub above is called and the message is shown.Code:Public Sub Msg()
Msgbox "Hello World !"
End sub
This is the basic idea of the class module, and will depend on what code you think will benefit your project / you can reuse.
I would agree with Jamie on this side through, the use of these is maily the same as a normal module, and I'd stick to them :)
You're having that problem because you're trying to deal with an implementation issue while still in the design phase.
Don't worry about HOW you'll implement something until you know WHAT you'll be dealing with. About the only time that sort of thing arises at design time is when the designer is doing a cost/benefit analysis of a particular feature. In such a case, the designer relies on experience to gauge what is feasible and how dificult it may be to implement
a class module largely differs from a Module, and has many benefits. First off, u can instanciate a class module. It is an object that has properties and methods. It is one of the most powerfull features of VB. It is the essence of Object Oriented Programming. Class Modules can implement each other, and u can have subclasses that derive methods and properties from their parents. A Module on the other hand is just a plain code window. It is usefull for public variables and functions that may be accessed from more than one form only. To create professional object oriented projects, class modules are a must.
Admittedly, I didn't go into property let or createobject as I didn't want to get too complicated. Okay, yes you're right that they're different to standard modules, but the reusable code is why they are there.Code:class modules are a must
With your statement, I would say 100% that this is an option to be considered when designing the functionality and use of the program. If you have a 1 form calculator program, then the "are a must" bit doesn't always need to come into play and I have no idea what he's designing !
Thanx for misquotting me ;) I, personally dont c a 1 formed calculator being an object oriented program. But, depending on how fancy this calulator is, yes, it is not to far fetched to be using class modules. For example, you can have a class which extends the command button, and instanciate an array of this class and reference it to the buttons on the form. but yes, u r right, most likely a calculator will not need a class module.Quote:
Originally posted by spetnik
To create professional object oriented projects, class modules are a must.
Thanks for quoting my misquotement :D
Appologies for that one, yep, they're a must for OOP & I'm wrong to argue when I can't read the bloody post right :rolleyes:
Just what are you designing anyway Yoyo ?!?!?! :eek:
an information system.
duh .... er .... ;)
I'm trying to develop a system to handle the suscriptions of a News Paper. I've seen other projects like this b4 but written in Visual FoxPro and thise guys use classes but their are more powerfull 'cause if you desing a class based on a form (for instance) you can use it and create subclasses and use those subclasses, etc., but if you decide to make a change to the father class (let's say change the backcolor property), the rest of the classes depending from it will change too. I don't know if you got my point but i'd like to know if that's possible here in VB. :confused:
I think you're talking about inheritance ...
Polymorphism and Inheritence are possible with VB, although admittedly, polymorphism is much easier. U can write "Implements ClassName" as the 1st line in a class module. Inheritence, however, requires you to have a Private instance of an object, and then to create Property Get and Let procedures to complete the inheritence. Although this is a pain, this will hopefully be made easier in .NET