Chapter 17. Deferred binding

 

This chapter covers

  • Understanding deferred binding and its properties
  • Managing code differences with deferred binding
  • Determining property values with a property provider

What do you do when you want to provide different code implementations depending on a particular condition?

For example, you need to access the browser DOM, and you know that Internet Explorer needs different code than the other browsers (like our computed-style example in the JSNI chapter). Or you’re implementing internationalization and have different text for different locales. Or you want logging in one situation but not in another—the list can go on and on.

You could send all possible combinations of implementations to the user’s browser: some code for Internet Explorer with Finnish language text, some for Firefox with Italian, a WebKit user (Safari/Chrome) who prefers the Canadian dialect of French text, and so on. You’d also need to send some additional code in your application to be able to select the right bits to use to handle each difference.

You already can see, we hope, the challenges you’d encounter trying to implement any of these examples—but despite the many more we could list, we want to highlight these two:

17.1. What is deferred binding?

17.2. Pulling it all together

17.3. Using GWT properties to drive deferred binding

17.4. Managing explosive permutation numbers

17.5. Determining a property value

17.6. Coping when deferred binding isn’t enough

17.7. Summary