Web server version - CHAPTER 10 INFINITE DATA PATTERN else if(

CHAPTER 10 INFINITE DATA PATTERN else if( reference == “2″ && valIdentifier == transactionIdentifier2Counter) { return true; } else { return false; } } In the implementation of IsActiveTransactionIdentifier, the parameter transactionIdentifier is from the result, where an example would be 1_101. The transaction identifier parameter is encoded and needs to be separated into two pieces; the first piece is the destination span element, and the second piece is the transaction identifier (transactionIdentifier1Counteror transactionIdentifier2Counter). The two pieces are verified, and if the destination span element references an active transaction identifier, a true is returned; otherwise, a false is returned. Returning true allows a result to be processed. If the result is processed, the destination of the result needs to be extracted by using the function GetResultField, which is implemented as follows: function GetResultField( transactionIdentifier) { var reference = transactionIdentifier.charAt( 0); if( reference == “1″) { return “result1″; } else if( reference == “2″) { return “result2″; } throw new Error(”Invalid transaction identifier value”); } In the implementation of GetResultField, the code used to extract the field reference is identical to the code used in the function IsActiveTransactionIdentifier, and this is done for illustration purposes only. The decision block tests to see if the variable reference has the value 1or 2, and if so returns the appropriate HTML identifier. If the variable reference is neither 1or 2, an exception is thrown to indicate an incorrectly formatted transactionIdentifier parameter. Earlier it was mentioned that on the client side there is no reusable code because the implementation of the pattern is specific to the problem being solved. This is not entirely correct, because some pieces of the HTML client code could have been combined into a small library. The small library could be have been used in this context, but probably could not be reused in another context. An example would have been the functions IsActiveTransactionIdentifier and GetResultField. Be wary of adding small libraries of reusable code. Often there is no real advantage to using the functions because doing so does not save you much coding time or logic. It does not mean that all client-side Infinite Data implementations will be hard-coded as in the example prime number application. Some things could be abstracted, but it very much depends on the specifics of the applications that you are creating. What could be useful is the creation of helper routines. Helper routines are encapsulated pieces of code that make it quicker to implement certain functionalities. Going back to the illustrative example of functions, they could be abstracted to a set of helper functions used to create and decipher the transaction identifier. The helper
We recommend cheap and reliable webhost to host and run your web applications: Coldfusion Web Hosting services.

Leave a Reply