Programming Structures and Syntax
last updated on: 03/23/17
| tags: OOP, structures, syntax
### Creating properties and active properties
You can create properties explicitly by extending the type constructor prototype. Alternatively, you can use the built-in functionality and create properties using the **ImplementProperty** or **ImplementActiveProperty** methods.
The **ImplementProperty** and **ImplementActiveProperty** methods are used to create pseudo-properties on any class or interface. When one of these methods is used, a *getter* and *setter* functions are attached to the constructor prototype. For example, the following code:
```javascript
function SomeClass(){}
SomeClass.ImplementProperty("nameOfProperty", objectInitializer);
```
will add the following to the prototype of **SomeClass**:
* A getter function `SomeClass.prototype.set_nameOfProperty(value)`;
* A setter function `SomeClass.prototype.get_nameOfProperty()`;
* The actual property `SomeClass.prototype.$nameOfProperty`;
In addition, when **ImplementActiveProperty** is used, an event with the name **nameOfProperty_changed** is registered for the specific type. Every time the property value changes, the event will be triggered. The user can attach additional functionality as a handler to the event.
<!-- Implementing events -->
<!-- ## Some of the more important classes -->
<!-- !!!!!!!!!! figure with the BaseObject DataHolder and Base classes -->
<!-- The BaseObject class -->
<!-- Communication and the BaseObject class -->
<!-- every object, no matter if it has a grahical representation, or not, can execute request to a outside data source-->
<!-- comment on -->
<!-- BaseObject.ajaxGetXml BaseObject.ajaxPostXml BaseObject.ajaxGetJson BaseObject.ajaxPostJson -->
<!-- The DataHolder class -->
<!-- The Base class -->
<!-- Base.prototype.bindings = new Array(); Base.prototype.handlers = new Array(); Base.prototype.lookups Base.prototype.set_data & get_data Base.prototype.childObject() Base.prototype.findParent() Base.prototype.findService()-->
<!-- The ViewBase class -->
<!-- !!!!!!!!!!! figure with derived views, from ViewBase -->
<!-- The BaseWindow class -->
<!-- !!!!!!!!!!! figure with derived windows, from Basewindow -->