Chapter 4. Understanding models
In this chapter:
- Introducing models
- Using property models to save code
- Using detachable models to keep your data fresh
- Nesting models to make the most of property and detachable models
With all those cheese stores sprouting on the web, soon we’ll be able to buy lots of cheese online. And our business plan wouldn’t be complete without a way to use that cheese. Cheese features as a main ingredient in many recipes, especially Italian recipes. Lasagna is not only a great Italian dish featuring heaps of cheese, it’s also suitable as a metaphor for software: a lasagna gets better as you add more layers— but only to a point. (Spaghetti is also a great Italian dish that’s improved by the addition of cheese, but somehow we’re reluctant to use it as a metaphor for building great software.)
In the previous chapters, we’ve given you a grand overview of the Wicket framework. We introduced it and used it to build a simple online cheese store. Basically, we’ve shown you what a lasagna is, so you can get a taste for it quickly.
But knowing what a lasagna is and how it tastes isn’t enough to create your own lasagna. You need to know which ingredients are required and when and how to apply them. The next few chapters will tell you about the ingredients for cooking your own Wicket application. By the time we’re finished, you’ll be able to roll your own lasagna noodles and cook your own tomato sauce instead of buying them from the local supermarket.