Chapter 13. Design patterns and testability
This chapter covers
Design patterns and testability have unfortunately been a low priority for many SharePoint developers. Their focus, instead, has been on understanding the platform and the tools, which until now has been quite a challenge. It’s not that SharePoint developers aren’t interested in building nicely designed and well-tested solutions; it’s that they lack knowledge of design patterns or are too cautious to get involved with using a pattern.
This chapter introduces design patterns in general and shows you how to design your Web Parts to improve
- Testability
- Separation of concerns
- Reusability
There’s one pattern that fits perfectly into the way Web Parts work and interact with the surrounding environment; it’s called the Model-View-Presenter (MVP) design pattern. This pattern allows developers and architects to separate the data model and domain from the business logic and presentation layers and provides a better way to reuse the application logic. You can also apply other design patterns to SharePoint projects. For instance, the Model-View-ViewModel (MVVM) pattern is often used when building rich Silverlight applications.