O'Reilly logo

Professional Cairngorm™ by Jeremy Wischusen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

8.5. Summary

In this chapter you looked at delegate classes. Delegates have the following characteristics:

  • Each delegate provides a local proxy for a remote service.

  • Each delegate serves as a contract between client and server development teams.

  • They may hide underlying implementation details, including:

    • Client-side service lookups

    • Server API method invocations

    • Formatting of method arguments

    • Data transformations

  • Delegates allow for mock services and dummy data to be used while server implementations are resolved.

  • They should be used only in the Control layer.

No classes or interfaces for delegates are provided in the Cairngorm framework; delegates are simply used as a convention.

The location of delegate classes will vary according to the example that you look at, but they are generally found in a business package. The standard naming convention is to prefix the word delegate with something descriptive of the types of services the delegate handles.

The constructor of a delegate allows for the specification of an IResponder class that will handle the results of any remote calls. Each additional method on the delegate represents a particular type of action that can be performed using the service.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required