Action Sequence using zeroCode
   
|Conclusion 
 
3
 
Example
Consider a situation where you need to maintain bonus points accumulated by a customer on your site, based on purchase. You have to implement, say, logic that updates bonus points on a graduated scale for customer purchases. In addition, you need to send large customers a special thank-you email. The diagram below depicts the mechanism for defining such logic as a simple action sequence in the zDE.
# Action Name Type Dataport Comments
1 getCurrentCustomer get Database Retrieve the logged-in customer’s record from the Customer table
2 getTotalPurchases get Database Compute the customer’s total purchases from the Order_line_item table
3 computeDiscount get Expression Determine the discount offered, as a function of total purchase amount
4 updateCredits conditional    
4.1 if totalSpent > 1000      
4.1.1 sendEmail put Mail dataport If this customer is a big spender, send a personalized e-mail
4.2 else if totalSpent > 100      
4.2.1 updateBonusPoints   Database Update the bonus points entry for this customer
The Action name column shows names you can assign to each action. The data item “totalSpent” comes from the UDM that you tie this action sequence to; you could create a node that calculates the total spent right in this action sequence, instead, thereby making it completely independent of invocation.
Technology:
In implementing action sequences for a zeroCode-built site, the same principles of algorithmic excellence have been followed as in the rest of the zeroCode environment. Action sequences use the topologic sort order framework that the original zeroCode technology constructed, adding to it the more advanced techniques of dependency checking and conditional branching. Learning from programming language theory, action sequences encapsulate advanced processing capabilities that are inspired by artificial intelligence languages like LISP. For example, the LISP COND construct is similar to the conditional action unit that actions sequences can include.
In zeroCode parlance, an action hook is really any piece of code that can be invoked at one of these four hook events. An action hook is just a Java class that implements the UdmActionHook interface. Any such class can be included into a zeroCode application and designated to be invoked at a suitable point. Therefore, an action sequence can thus be made even from custom Java objects that programmers could write and include in a UDM design, taking the abilities of server-side logic even further than before.
Conclusion:
The Action Sequence mechanism is a tremendous enhancement to the patent-pending zeroCode environment, taking it far into the realm of rules-processing platforms that are ideal for large, complex business applications as easily as for departmental systems.
An immediate benefit of action sequences in existing applications would be to replace, say, stored procedures with action sequences. That would make the procedure more maintainable and platform-independent, although it may lose some of the throughput advantages of a compiled stored procedure.
As a step for the future, action sequences give software designers the ability to build scalable enterprise systems that are as easy to maintain as to build. With action sequences, designers can construct, for example, a site that includes only the business logic that an enterprise uses across itself. The sequences (rather, their UDMs) can then be invoked from other sites and other non-zeroCode-built applications to execute complex business logic. This makes the zeroCode platform the absolute platform-of-choice for extending existing applications and for building new applications.
 
 
3