esProc enables users to code based on natural thinking, without having to change their trains of thought in converting the complex business logic into actual code. To complete the same computation, esProc is several times more neat and concise than Java and SQL.
For example, to find the maximum number of consecutive trading days during which a stock has been rising, the typical SQL statement would be:
With the agile syntax, the corresponding esProc code can be as simple as below:
Unlike the normal text code, the esProc code is written in a cellset (i.e. grid), as shown below:
esProc has an Excel-like, grid-style user interface, at which code is executed from left to right and from top to bottom. The name of each cell is made up of the combination of its column and row numbers, which is unique and natural. esProc users can reference a cell directly without defining a variable.
On the grid-style interface, code has a natural format with automatic alignment and indentation, saving the effort of typesetting. The grid-style coding not only creates neat and clean code, but also offers an intuitive way to observe each computing step.
With inbuilt stepwise model, the grid-style design allows users, as they write, to observe and think from the business perspective with natural thinking to deal with a problem in a step-by-step manner. A complex problem will then be divided into several steps and each step can reference the previous computing result, making it easy to detect and debug errors. A SQL solution, however, is far more complex as SQL doesn’t support the stepwise computing model. Java/VB and other high-level languages support the model, but they haven’t adequate support for handling structured data, and therefore cannot be considered as the languages for database computing. esProc combines merits of the both, yet has much simpler syntax.
Rich In-built Library Functions
esProc offers a broad selection of library functions to support the group/loop/sort/filter operations, set operations, and ordered sets.
Group and loop:
In the above figure, A4 is a loop statement, and B4-B10 is the loop body.
esProc supports the basic grouping, alignment grouping, and enumeration grouping. Unlike SQL, the grouped data in esProc is stored as sets. Each member of a set is of the generic type corresponding to a set of data. Grouping and aggregation can be conducted separately in different steps. Thus the grouping result can be reused.
Sorting and filtering are typical algorithms in handling structured data. esProc specifically provides easy-to-use loop functions for them. The loop functions can minimize the use of loop statements, reducing programming difficulty and improving development efficiency.
esProc supports set operations including concatenation, union, intersection, difference, multiplication, alignment operation, alignment comparison, comparison of sets, as well as algorithms for retrieving members forwardly or backwardly, getting a subset, member copying, arranging members reversely or in a transposed matrix, etc.
The “ordered” here means that data is stored in a certain order. Each record or each member of a set has its absolute or relative sequence number for being accessed or handled through order-related operations, such as locating, ranking, and sorting.
esProc supports ordered sets. So users can access set members and perform order-related calculations easily. The ordered-related calculations are a notoriously tough SQL problem. One example is to access data according to relative positions, which means getting the records (groups) immediately before or after the current record (group). By taking advantage of the ordered set mechanism of esProc, users can solve the problem easily.
Easy Development and Debugging
The stepwise computing model of esProc makes it convenient to monitor intermediate results and to debug the code. The development efficiency is therefore enhanced greatly.
esProc supports a complete set of debug functionalities, including Set break point, Run to the break point, Run to cursor and Step-by-step execution. By contrast, SQL does not directly support the step-by-step execution, so it’s hard to monitor the intermediate results, simplify the computation, and debug the code in SQL.