Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


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

A More Complete CFC

Listing 26.6 shows a slightly more complex variation on the FilmSearchCFC component created in Listing 26.1. 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 FilmDataCFC1 instead of FilmSearchCFC.

CFCs as Collections of Functions

In addition to the listFilms() method, Listing 26.6 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.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint