11.07.2015 Views

VBScript Reference Manual for InduSoft Web Studio - ICP DAS

VBScript Reference Manual for InduSoft Web Studio - ICP DAS

VBScript Reference Manual for InduSoft Web Studio - ICP DAS

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>InduSoft</strong> <strong>Web</strong> <strong>Studio</strong><strong>VBScript</strong> <strong>Reference</strong> <strong>Manual</strong>Objects and ClassesTraditional programming is made up of a collection of subroutines and functions that are typicallyprocessed in a sequential or looping manner. In contrast, object oriented programming is a differentprogramming methodology where a program is viewed as being composed of a collection of individualobjects. These objects process data and can interact with other objects directly without having to beexplicitly programmed to do so. The advantages claimed by object-oriented program include codereusability, rapid deployment of large-scale complex tasks, and ease of use/debugging. Today, objectorientedprogramming is widely used and is supported with both programming languages (e.g. VB.NET,C++, Visual C++) and operating systems (e.g. Microsoft’s .NET architecture). Object-orientedprogramming has also become popular within scripting languages, such as <strong>VBScript</strong>. Beginning with<strong>VBScript</strong> 5.0, developers have been able to use user-defined Classes.The key concepts with object-oriented programming include:• ClassThe class is the highest level that defines a unit (set) of data and its behavior. Classes <strong>for</strong>m thebasis <strong>for</strong> modularity and structure in an object-oriented program. The class should sufficientlydescribe the set of data, and the code <strong>for</strong> a class should be contained within it and be selfsufficient(except <strong>for</strong> operating system support). While the terms classes and objects often getused interchangeably, classes describe the structure of objects. One way to think of a class isthat it is a container <strong>for</strong> code. It can also be viewed as a template <strong>for</strong> an object. When a class isdeclared (instantiated) by the Set statement, it then becomes an object and memory is allocated<strong>for</strong> it.• ObjectAn object is an in-memory instance of a class. In computer science terms, it is a run-timemanifestation (instantiation) of a particular exemplar of a class. Each object has its own data,but the code within a class can be shared (<strong>for</strong> efficiency). Programs generally have multipleobjects. Multiple copies (objects) of a given class can be created. Objects are temporary, i.e.they can be created and removed at will, depending on the programming needs.• EncapsulationEncapsulation wraps the data and functions into a single unit, ensuring that the object can bechanged only through established interfaces. Encapsulation is sometimes referred to asin<strong>for</strong>mation hiding. Some of these common interfaces are:o FieldsFields are simply public variables stored within the object, as defined by the class. Thesevariables store items of in<strong>for</strong>mation about an object.oooPropertiesProperties, like fields, also store items of in<strong>for</strong>mation on an object. But Properties useProperty procedures to control how values are set or returned. <strong>VBScript</strong> has two primaryProperty procedures; Let and Get. The Get property procedure retrieves a Propertyvalue, while the Let Property procedure assigns a value to the property value. A thirdProperty procedure Set is used with an Object inside of the Class block.MethodsMethods are a collection of subroutines (Sub) and function procedures (Function)declared within a class.EventsAn event is a message sent by an object announcing that something important hashappened.<strong>InduSoft</strong>, Ltd. 21

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!