Hi guys, I am busy preparing for my part 1, but as I move along, I am also grabbing as much knowledge that I can for the part-2 and 3. This is quite helpful in doing a design work for my current project too.
My question is :- I am busy understanding the petstore architecture. I have been going thru the catalog module which is using Fast Lane Reader, View Helper, ValueList Handler patterns. I am a bit confused with the VLH pattern. According to perstore, the VLH pattern allows us to display information in chunks. But if you look at the code, the method that returns the Page (Value List) in Helper class is accessing the database each time you scroll next or prev. Isn't this consuming resources at the server side by accessing db ?.
Also they are using a cache tag, that caches every page that displays the information. Isn't this an efficient way that the VLH?. And if we cache the page with all the information, then why do we need to implement the VLH pattern?
There are different ways in which you can implement ValueListHandler design pattern:
1. Using SFSB, which gets everything in one go from the database and then provides by page by page data to the client.
2. Using SLSB or POJO class which gets the data from the database. This approach executes the same SQL at the database level in such a way that a subset is returned back to the SLSB or POJO class. (recommended in Bitter EJB book as the best approach)
3. Third option is to run the sql and store the page by page response in the database. Then provide page by page data back to the user. (have read something about this at ibm's developer site).
I have used approach #2 in my projects and it provides excellent performance.