CHAPTER 6 DECOUPLED NAVIGATION PATTERN 175 Even (Web design software)

CHAPTER 6 DECOUPLED NAVIGATION PATTERN 175 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 func tion 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:

Leave a Reply