So what's an application made of? The PEAK approach describes application components in terms of their lifecycles and roles, as follows:
This breakdown of application components is called the Service-Element-Feature (SEF) Pattern. PEAK makes it easy to create components of each kind, but this pattern certainly isn't limited to PEAK. You'll find Services, Elements, and Features in almost any object-based application, regardless of language or platform. But, the pattern is often implemented in a rather haphazard fashion, and without the benefit of explicit ``wiring" between components.
When you design an application using the SEF Pattern, your top-level application object is itself a Service. You construct that service from lower-level services, such as database connections, object managers, and maybe even a top-level window object for a GUI application. If your application is to be web-based, or you're constructing a middle-tier subsystem, perhaps it will be composed of web services or the equivalent of J2EE session beans.
The top-level application object may provide various methods or ``value-added" services on top of its subcomponents' services, or it may just serve to start them up in an environment that defines their mutual collaborators. You may find later that what you thought was an ``application" component, is really just another service that you want to use as part of a larger application. Fortunately, it's easy to change a PEAK component's bindings and incorporate it into a larger system.
Defining the Elements of your application design is also fairly straightforward. Elements are the subject of what your application does. A business application might have Customer elements, a web server might handle Page elements, and a hard drive utility might manipulate Partition elements.
Features, on the other hand, are usually provided by frameworks, and incorporated into your application's Elements to create a specific kind of application. For example, a GUI framework might provide visual features that allow mapping Element properties to input fields in a window.
While PEAK does or will provide many Element and Feature base classes you can use to build your applications, these facilities are outside the scope of this tutorial, which focuses primarily on assembling an application's Service components. However, some of the techniques you'll learn here will be as applicable to Element and Feature objects as they are to Service components.
So, let's get started on actually using PEAK to build some components, shall we?