26.3. Summary

In this chapter you examined some of the ideas that are out there in regards to "best practices" for using Cairngorm.

You may have noticed that some of the "best practices" put forth by Eric Garza and Peter Martin are in direct opposition to those put forth by Jesse Warden (hence the quote marks around the term).

For example, Warden's third tip is "only commands set data on the model," while Eric Garza and Peter Martin state "commands should not reference models directly." If commands are not referencing the model, it is going to be quite difficult for them to update it as Warden suggests they should be doing.

My point here is not to imply that any of these people are being dishonest in any way or that they do not know what they are talking about. My point is that when anyone puts forth an idea about "best practices" what is generally being said is, "This is what has worked for me."

As can be seen from the revisions you made to the sample application to combine event and delegate classes, and from some of the code samples used by Garza and Martin, there are different ways of using Cairngorm. Whether a given best practice is going to work for you may depend heavily on how you are using the framework to begin with.

Both Warden and Garza/Martin make some good points that should be taken into consideration. You are going to have to evaluate these ideas and any others on "best practices" that you may find and decide which ones make sense for your project.

If you are using ...

Get Professional Cairngorm™ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.