• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

A More Complete CFC

Listing 23.22 shows a slightly more complex variation on the FilmSearchCFC component created in Listing 23.17. The idea behind this CFC is to provide not only a search facility, but also a way to get and display detailed information about films. To reflect this expanded role, I'll call this version FilmDataCFC instead of FilmSearchCFC.

CFCs as Collections of Functions

In addition to the listFilms() method, Listing 23.22 also includes a new method, getFilmData(), which takes a film's ID number as input and returns a structure containing the film's title, summary, and actors. You can think of this CFC as a collection of conceptually related functions, since both methods are about data retrieval pertaining to records in the Films database table. In a big-picture way, this is what many CFCs are all about: collecting related functionality into a single bundle.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint