Chapter 8. Developing reusable components
In this chapter:
In chapter 7, we looked at group components strategies. You learned that panels are particularly well suited for creating components that can be reused in a variety of contexts, without the need to know anything about their internal structure.
In this chapter, we’ll look at creating reusable components. The more generic and context-independent components are, the easier it is to reuse them. We’ll first look at examples of generic components. We’ll start with a locale component, which is simple; later, we’ll add features to illustrate how you can create compound components. After that, we’ll discuss how to develop a date-time panel, to illustrate how you can create compound components that participate in form processing.
In the second half of this chapter, we’ll examine a domain-specific component: a discount list for the cheese store example. It will illustrate that components can have their own independent navigation. The discount list will also use some of the components developed earlier in this chapter, and it will be the component we’ll build upon in the chapters that follow.
Before we get back into coding, let’s look at why you should take the time to create reusable components.