Intuitive Code Style: Cell, Reuse, and Indentation

Uncategorized 705 0

esProc provides the functionalities of cell, reuse, and indentation for an intuitive analysis. The intuitive analysis enables the developers to code in a way more natural to human thought. esProc redefine the programming by composing the scripts in the two-dimensional cells from a business perspective at the very start.

Intuitive, simple, and efficient, the intuitive analysis is a style in which the business terms are to be analyzed directly. Let’s see the concrete example below:

I Case and Comparison

There is an automobile part manufacturer requiring the computing results of below questions: How many new clients are obtained this year? Of which, how many clients are among the Top 500? How many clients are local? Suppose that the datasheet customer comprises these fields: customerName, customerTime, isTop500, and isLocal.
In this problem, these questions are interrelated and raised progressively. Each question is based on the further-exploring into the previous one. Using the result of the previous question to solve the current question is the most natural and convenient way. This is a typical person-brain-like questing style, and usually taken by the business officials or in the high-level business meetings.

SQL Solution
With SQL, three SQL statements are required to solve this type of problem:

SELECT COUNT(*) FROM customer WHERE to_char (customerTime , ‘yyyy’) = to_char (sysdate,’yyyy’) — new clients
SELECT COUNT(*) FROM customer WHERE to_char (customerTime,’yyyy’) = to_char(sysdate,’yyyy’) and isTop500=true — which are top 500
SELECT COUNT(*) FROM customer WHERE to_char (customerTime,’yyyy’) = to_char(sysdate,’yyyy’) and isTop500=true and isLocal=true. — which are local

Obviously, SQL computation splits the problem to three independent questions. The computation of each question has to repeat the previous computation. To put it concretely, if using SQL, then you have to convert the natural thinking pattern of question “How many clients are local?” to the computer query language like ”to compute the number of new clients of this year that are among Top 500 and are local”.

Answer with the Intuitive Analysis of esProc
esproc_codestyle_2

In A1, all records to the request of the question 1 will be retrieved. In B2, the number of those records is computed. In A2, the further filtering is performed on the basis of question 1. In A3, the filtering is going on.
When computing ”which are local”, the computation in A3 cell only need to focus on the question of itself, that is, to filter the “local (isLocal)” from “of which (A2)” is enough. The esProc user need not to care about the irrelative questions of “which are new clients”, and “which is Top 500”.

Comparison
In the above example, we can learn that esProc can follow the natural human thought pattern, that is, to compute from a business perspective. Every step can use its previous computation and the repetitive computation is avoided.
By comparison, use SQL to compute will make a simple problem complicated, a direct problem become indirect, and an efficient computation become inefficient.

Please find that how esProc functionalities facilitate the intuitive analysis blow.

II Convenient Functionalities
Name Variables after Cell Name in a Natural Way
esproc_codestyle_3

The esProc cell is similar to Excel®. Each cell is uniquely named after the column name in combination with the row number. The computation of a cell can be referenced by calling the name of this cell in other cells. The naming method is not only natural, neat, and intuitive, but also effort-saving comparing with defining the mess temporary variables in Java or stored procedures. However, you can also use the traditional method to define those variables having clear meaning. The two defining methods are mutually complementary.

For example, the expression A1.select(isTop500) in cell A2. The result is a group of records. For the total number of this group of records required in B2, you can just use A2.len() to make a reference.

Reuse Previous Computation
esproc_codestyle_4

In esProc, the computation can be reused. The result of a certain cell can be further processed and referenced for several times and that is difficult with SQL.

By reusing, the direct result is a clear and natural flow of computation. The objective will be refined step by step following the business logic, instead of a lengthy SQL statement. The reuse can also avoid the query on huge data volume, and the computation efficiency can be improved to a certain degree.

Natural Cell Execution Order
esproc_codestyle_5

Similar to Excel, esProc follows the natural computation rule of executing first left then right and first top then down.

Just as the computer screen becoming wider and wider implies, the human with eyes locating on the left and right section of the face is more sensitive to the width than the height. While Java or stored procedures is to compute in a single dimension of computer style, only top-down order is allowed. Based on the ergonomics perceptive of how human eyes observing things, the two dimensional composing style is adopted in esProc. By taking this advantage, you can not only perform more computation on the space-limited screen, but also streamline the flow in a way more natural to the human thought.

Natural Formatting by Cells
esproc_codestyle_6

esProc is formatted naturally by cells. You are not required to indent, align, and conduct other layout work. In this way, you will waste no time on composing scripts of high readability. The time saved can be used to focus on the analysis and thinking and thus it further improves the computing efficiency.

Computation Scope Defined by Natural Indention
esproc_codestyle_7

A clear working scope is required by the circular, judge, and sub-function statements. For example, in Java, “{“and “}” are used to define the starting or ending point of a function body. esProc user can be benefited from an intuitive style of cells, and the delimiter is not necessary for them to define the working scope because the natural indention of cells serve the purpose right.

FAVOR (0)
Leave a Reply
Cancel
Icon

Hi,You need to fill in the Username and Email!

  • Username (*)
  • Email (*)
  • Website