Hi all, I'm sure you guys have seen the search engine of google or yahoo. Everytime you hit search, they would retrieve 1 web page of your results and the list of numbers of pages of your results. Like "page 1 of 8". Does anyone know what kinda Design Pattern is used to develop this concept? Do think this "trick" done via DB's stored procedure or via application layer? ------------------ Thank you. - Simon See firstname.lastname@example.org -after office hours- necro-mani-cide
The idea is known as "windowing." Maybe there's a pattern with a different name. Basically, you only see a small portion of the data at any given time, i.e. looking through a window at the data. There are different implementations. You could retrieve all the info at once, but only display some of it at any given time. You could find the total hits, but for performance reasons, only cache some of it (say the first 1,000 out of 85,000 hits), and requery as necessary. You could also have an "unbounded window" in which you don't know the total, but just keeping getting X more hits at a time, until your run out. Depending on how you are doing it, the "trick" may reside at different layers.
Mark Herschberg, author of The Career Toolkit
Try looking at strategy type design patterns like Strategy and Template as explained in Design Patterns by Gamma et al.(GoF) These will help with delegation of responsibilities or can extend existing algorithms for searching. ------------------