Unable to start debugging on the web server - CHAPTER 6 DECOUPLED NAVIGATION PATTERN Even though
CHAPTER 6 DECOUPLED NAVIGATION PATTERN Even though InjectTextbox and InjectHTML are similar, calling InjectTextbox requires a change in the logic of the OnClick function. The OnClick function has to make an additional decision of whether or not a conversion has to occur. You might say, Well, duh, the OnClick function has to change if the called function changes. But the reply is, Why must the OnClick function change? The purpose of the OnClick function is to gather the data necessary to call either the InjectHTMLor InjectTexbox function. The purpose of the OnClick function is not to make decisions, because decisions can change if a user interface does not, and vice versa. The data gathering and decisions made about the data need to be decoupled. In an ideal world where everything is decoupled, you would write the following source code: The modified source code has added the function Call, which has three parameters that are three function references. The first function reference, OnClick, is the Action functionality responsible for gathering the data into a state. The second function reference is either null or CallXMLHttpRequest and represents the Common Data functionality that is responsible for processing the state. And finally, the third function references, InjectHTMLand InjectTextbox, are responsible for displaying the state. The resulting calling sequence illustrates that the first button click event gathers the data, does not process the data, and displays the data. The second button click event gathers the data, calls a remotely located server, and displays the data. The OnClick functions used in either button click event are identical, meaning that the OnClick event is not dependent on whether the processing of the common data is local or remote. So now the functions are decoupled, as is the calling sequence. The exact details of this decoupling and the calling of the functions is the topic of the following sections. Implementing a Decoupled Library The core of the Common Data functionality is a decoupled library, which is responsible for managing and processing the state. The decoupled library is called DecoupledNavigation and is defined as follows: function DecoupledNavigation() { } DecoupledNavigation.prototype.call = DecoupledNavigation_call; DecoupledNavigation.prototype.initializeRemote = DecoupledNavigation_InitializeRemote; The definition of DecoupledNavigation has no properties and two methods. There are no properties because the common state object instance is defined in the implementation of the DecoupledNavigation methods. The method DecoupledNavigation_call is used to make a Decoupled Navigation pattern call as illustrated in the example Call( OnClick…). The method DecoupledNavigation_initializeRemote is used when the Common Data functionality wants to make a call to a remote server. The function DecoupledNavigation_call, exposed as DecoupledNavigation.call, wires together the Action, Common Data, and Presentation functionalities as illustrated by the following implementation:
In case you need affordable webhost to host your website, our recommendation is ecommerce web host services.