They have the same shape in the project window and they have some other things in common too so what are the important differences between modules and classes? And how do I know which one to use?

SampleClasses are cubes
Modules are spheres
.
Don’t be surprised
If they confuse you
.

 

 

 

 

 

 

 

 

 

 

You can add Methods, Notes, and Properties to both Modules and Classes. The Module can also have “Constants”, which the Class cannot. The Class can have “Events, Menu Handlers, and New Events” which the Module cannot.

Classes, like Windows, can respond to Events.

A user can interact with a class. For example, in the topic “Custom Classes” we made a custom class that a user could click to open a URL.

Users cannot interact directly with a module. Modules store global data. Constants, Methods and Properties in a module can be accessed by any object anywhere in the project at any time.

Understanding the difference between Modules and Classes is a matter of understanding their respective functions.

The function of a Module is to store global data. The Methods and Properties of classes are local to the object that contains them, such as a window or a custom class.

The function of a Class is to provide a means for users to give input to or receive output from a program. All controls such as PushButtons, Listboxes, Editfields, etc. are classes.

A Class is added to a project when the programmer wants to create an object with which a user can interact, such as the clickable StaticText object discussed in the topic “Custom Classes“.

A Module is added to a project when the programmer wants to employ global properties, methods, or constants.