liveapicreator-admin-cli
Version:
The NodeJS command line utility for 'CA Live API Creator' DevOps Administration from CA Technologies
16 lines • 5.15 kB
JSON
[
{
"ts": "2017-12-19T23:07:06+00:00",
"name": "Audit Orders",
"color": "#00fcee",
"summary": "If amount changes",
"description": "<p>This examples illustrates that your logic is a combination of Reactive Programming Rules, and JavaScript.</p>\n\n<p>Note your JavaScript can use LIbraries of Java/JavaScript code. Upload these to your project in Project properties.</p>\n\n<p> </p>\n"
},
{
"ts": "2017-12-19T23:07:06+00:00",
"name": "Check Credit",
"color": "#96f90d",
"summary": "Ensure the balance does not exceed the credit limit.",
"description": "<h2>Business Context</h2>\n\n<p>Story: <strong>Place Order.</strong> </p>\n\n<p>Task/Requirement: <strong>Check Credit.</strong> (or, your methodology / terminology).</p>\n\n<p> </p>\n\n<h2>Business view</h2>\n\n<p>When placing an order, <em>check credit</em> - elaborated as follows (the <cite>"cocktail napkin spec"</cite>)... </p>\n\n<ul>\n\t<li>the Balance must be less than or equal to the Credit Limit, where... (step-wise definition of terms)</li>\n\t<li>the Balance is the sum of the unpaid Order Amount Totals, where...</li>\n\t<li>the Amount Total is the sum of the LineItem Amounts, where...</li>\n\t<li>the Amount is the discounted Price * Quantity, where...</li>\n\t<li>the Price is obtained from the Product</li>\n</ul>\n\n<p>A good spec - clear, concise.</p>\n\n<p> </p>\n\n<hr />\n<h2>Conventional Design</h2>\n\n<p>In a conventional approach, you might design the following <strong>pseudocode</strong>:</p>\n\n<ol>\n\t<li>Compute the LineItem.amount\n\t<ol>\n\t\t<li>Read the Product to get the Price</li>\n\t\t<li>Multiply by qty_ordered to compute the amount</li>\n\t</ol>\n\t</li>\n\t<li>Update the PurchaseOrder.amount_total\n\t<ol>\n\t\t<li>Read the PurchaseOrder</li>\n\t\t<li>Increase the amount_total</li>\n\t\t<li>Update the PurchaseOrder (to cache)</li>\n\t</ol>\n\t</li>\n\t<li>Update the Customer.balance\n\t<ol>\n\t\t<li>Read the Customer,</li>\n\t\t<li>Increase the balance</li>\n\t\t<li>Update the Customer (to cache)</li>\n\t</ol>\n\t</li>\n\t<li>Check that balance <= credit_limit\n\t<ol>\n\t\t<li>Throw exception with error message for UI handling</li>\n\t\t<li>Rollback the transaction</li>\n\t</ol>\n\t</li>\n</ol>\n\n<p>But Place Order is <em><strong>just one Story</strong>.</em> We need analogous logic for <em>all the related</em> Stories (Detete Order, Pay Order, etc etc).</p>\n\n<p> </p>\n\n<hr />\n<h2>Reactive Rule Approach</h2>\n\n<p>And that's the power of declarative reactive logic. You simply state the rules below (nearly the same as the cocktail napkin).</p>\n\n<p> </p>\n\n<h2>Reactive Rule Execution: Watch, React and Chain</h2>\n\n<p>And (as in a spreadsheet), the rules are <em>automatically</em> applied to all incoming transactions:</p>\n\n<ol>\n\t<li>They <strong><em>watch</em></strong> for changes in data referenced by rules</li>\n\t<li>They <em><strong>react</strong></em> to changes in referenced data. Execution order is dictated by dependencies. </li>\n\t<li>They <em><strong>chain</strong></em> - including across tables. So changes to line items affect their order, which affect their customer</li>\n</ol>\n\n<p>Note it works across tables. Consider the customer balance - the sum of the unpaid order amounts.<br />\nIt works rather like a spreadsheet. Order changes are watched, and the balance is</p>\n\n<ul>\n\t<li>increased when order inserted</li>\n\t<li>decreased when order deleted... or paid</li>\n\t<li>adjusted when the order amount total is changed... or assigned to a new customer... or the line items are altered</li>\n</ul>\n\n<p>Observe persistence is automated (no need to read/write the customer, or deal with transactions). And it's optimized:</p>\n\n<ul>\n\t<li>adjustments are 1 row updates, not select sum queries</li>\n\t<li>sql is averted if the watched data is not changed</li>\n\t<li>caching is provided (inserting multiple line items results in just 1 adjustment to order and customer)</li>\n</ul>\n\n<p> </p>\n\n<hr />\n<h2>Bottom Line</h2>\n\n<p>That means the following Stories are <em>automatically</em> addressed with our 5 "cocktail napkin" rules:</p>\n\n<ul>\n\t<li>Delete Order - the balance is reduced</li>\n\t<li>Pay Order - the balance is reduced</li>\n\t<li>UnPay the Order - balance is increased</li>\n\t<li>Reassign Order to a new customer - new customer balance increased, old balance decreased (for unpaid Orders)</li>\n\t<li>Reassign a Line Item to a different Product - adjusts the order's amount total</li>\n\t<li>Add a Line Item</li>\n\t<li>Delete a Line Item</li>\n\t<li>Change Line Item Quantity</li>\n\t<li>Reassign Product to Line Item</li>\n\t<li>Do <em>multiple</em> of these, in combination ("no, 2 hammers, not 1 shovel")</li>\n</ul>\n\n<p>A conventional approach would require hundreds of lines of code, might easily miss corner cases, and be tedious to maintain.</p>\n\n<p> </p>\n"
}
]