‘Finally procedural and OO programming can coexist together; the best of both worlds!’ I said to myself. This was my first impression I had when I started a 2 week course in G2 development environment and G2 programming. The course was very informative to a new and powerful development environment which can be utilized anywhere you have ‘a flow’. This is not meant to be a tutorial (maybe next post will be).This is meant to provide a very rough introduction to the G2 environment and the G2 programming language.
G2 is a real-time software environment for quickly building customized expert solutions to challenges which is applied whenever large-scale reasoning is needed (no need to compile and build; G2 will do that on the fly). So G2 is the brain within the general solution. G2 is not meant to be a database or a general purpose programming language but rather a specific purpose programming language with the purpose being managing modeling and monitoring.
One of the main features of G2 is its sensitivity to time. It can detect changes to within 20 ms. G2 includes features such as parameter expiration times (and parameter data seeking techniques) and data historians. Other time-supporting features include rules (which are either data or event driven) and scanning. Rules are approximately equivalent to event-listeners in Java.
One of the main observations regarding G2 development environment and G2 programming language is that it is very graphical by default compared to other programming languages I worked with such as Java. You can create icons and action buttons easily (both graphically and programmatically). The editor is very a friendly one with auto-complete features.
It has many predefined objects (such as appliances), connections and relations. The main work happens in a ‘workspace’ which is a subclass of class Item. Workspaces in G2 are equivalent to the pages of the book. Modules are equivalent to chapters in the book.
G2 supports traditional OO principles such as objects (called items), inheritance, multiple inheritance, methods and class hierarchies with benefits such as polymorphism, encapsulation, data hiding. The files are saved as knowledge base files (*.kb).
Modules are much more extensible and reusable than packages. The difference between packages and modules (as concepts) is that modules are working functional entities (or collection of entities) which may contain multiple packages; they can tested and extended without having to go out of your way to write a test program. They are standalone entities. Packages on the other hand are not functional entities. They cannot be tested solemnly without writing a test program (which in most cases is not part of the package concept). They are not standalone entities. In a very abstract sense, the difference is equivalent to that between an object and a class.
This modularization makes G2 development environment and G2 programming language a perfect field for extreme programming.
So G2 combines procedures (including system procedures), rules, classes and associations: connections and relations. Each for a specific use. One important feature of G2 is the inspect method which is a general tool for reporting summaries of objects, replacing texts, finding keywords and viewing hierarchies.
G2 is easily networked to external systems with numerous connectivity options (focus on managing external communications).
Application layers are recommended in G2 by separating the core from the API for both server (G2 server) and client (in this case: Telewindows). G2 is created by Gensym. Other programs running on a G2 environment can be found here.