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.

What are non-visual classes? They are classes which the user can not see in the display.

Why be concerned about visual vs. non-visual classes when you write code?

  1. Properly written non-visual code is much easier to reuse.
  2. Non-visual code can be used by web applications. You can not reuse visual class code in web applications.
  3. 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?

  1. 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.
  2. Only visual class methods are permitted to interact with the user.