Tips_tutorials   >   Studio103   >   Visual vs. Non-Visual Classes
Visual vs. Non-Visual Classes
It took me a few years of writing code in Omnis Studio and reading numerous books on object-oriented programming before I grasped the concept of visual vs. non-visual classes and understood how that applied to the code I was writing in Omnis Studio.
What are visual classes? They are classes which the user can see in the display.
- Window classes.
- Menu classes.
- Toolbar classes.
- Report classes.
What are non-visual classes? They are classes which the user can not see in the display.
- Table classes.
- Schema classes.
- Query classes.
- Object classes. (In special cases an object class can be classified as a visual class.)
- Task classes. (The $construct and $destruct methods of the Startup_Task can be classified as visual methods)
Why be concerned about visual vs. non-visual classes when you write code?
- Properly written non-visual code is much easier to reuse.
- Non-visual code can be used by web applications. You can not reuse visual class code in web applications.
- By paying attention to visual vs. non-visual classes when writing code you can write better code, reduce the lines of code, and do a better job of handling and reporting errors. Good error reporting becomes very important when trying to fix runtime errors.
How does this apply to the code you write?
- Non-visual class method code never prompts the user. Whether it is a prompt for input, an OK message, or an error message, the non-visual class code is forbidden to prompt or directly interact with the user in any way.
- Only visual class methods are permitted to interact with the user.