| Applying science to business management |
  
Hierarchical Tree Editor
An integral part of the DScript language is the Hierarchical
Tree Editor. The editor provides visual feedback about the
application you are building, making it possible to build complex
systems with very simple formulas. For example, imagine you have
the following DScript code:
Profit:=Sales-Costs
Sales:=100
Costs:=60
The Hierarchical Tree Editor will display this code as
follows,
or you can choose to display complete formulas in the tree,
or you can even choose a different tree style altogether:
The tree structure tells you that there are three nodes in
this application and the node named Profit is dependent on
Sales and Costs.
If you were working in a spreadsheet environment, a formula
like
Profit:=Sales-Costs
would be entered like this:
A3=A1-A2
The basic format is the same in DScript as it is in a
spreadsheet; DScript just uses node names, like Profit,
rather than cell references, like A1.
If you are a programmer, you might be more familiar with
definitions that look something like this:
function Profit() {
var sales=100;
var costs=60;
return sales-costs;
}
This style is also legal using DScript. In the Hierarchical
Tree Editor, this code is displayed as a single node, which
provides less visual feedback about the structure of your
application. However, this style gives you greater programming
flexibility.
Node definitions that contain a single statement are called simple
definitions. Definitions that contain a list of statements
are called compound definitions.
If you are familiar with building spreadsheets, it is useful
to think of tree nodes as being like spreadsheet cells. A tree
node has a formula and a calculated value just like a spreadsheet
cell. However, unlike cells, nodes are automatically drawn in a
tree format that tells you how the nodes are related to one
another.
If you have programming experience, it is useful to think of
nodes as program subroutines. All programs are hierarchically
structured. There is usually a main routine that is called when
the program starts and this routine calls subroutines. In turn,
each subroutine calls other subroutines. If you display the
dependent relationships between subroutines, you get a tree.
DScript blurs the distinction between the spreadsheet (simple)
and traditional programming (compound) styles. If you are
comfortable with spreadsheets but are new to programming, you are
likely to use simple nodes with an occasional compound
definition. If you are an experienced programmer you will
probably use the compound style often, but you will find that
there are advantages to breaking complex subroutines into a
network of simple functions. Once you become proficient with
DScript, you will probably find yourself right in the
middle--using both styles equally.
|