Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1164
  • Last Modified:

Value List Handler Pattern

Value List Handler pattern are an alternative to potentially inefficient EJB finders.

 Could you please explain this ?
Value List Handler pattern are used  to Improve network performance . How come it is an alternative to EJB finders ?
0
cofactor
Asked:
cofactor
  • 5
  • 4
1 Solution
 
ChristoferDutzCommented:
As far as I understood this:

Lets assume you have a search interface to query 10% of the fields of some objects persisted in a remote database. Sending a query to the remote server every time yould be time consuming and a waste of networking resources. You could now immagine that you implement a component that reads only the fields used in a query and keeps them in a local cache. Then the query could be performed in-memory on the server and only the results are fetched from the database.

This is the way I would interpret the pattern.
0
 
cofactorAuthor Commented:
>>>>Lets assume you have a search interface to query 10% of the fields of some objects persisted in a remote database.

10% of the fields ?   why would you do that ? . we would just search by ID or only primary key  column  .

>>>Sending a query to the remote server every time yould be time consuming and a waste of networking resources.

I guess, you mean its the same query fired every time.

>>>>You could now immagine that you implement a component that reads only the fields used in a query and keeps them in a local cache.

local cache ? does that  implemented  component  to use external cache like OSCache ?  

>>>Then the query could be performed in-memory on the server and only the results are fetched from the database.

Here is the trouble. why do you want to keep only the query in the cache ...keep results also in the cache.  ...then we could save the database hit for fetching results ...is not ?


please clarify if I'm missing something.

0
 
ChristoferDutzCommented:
Hey ... you just asked for what the pattern means ... not about the implemention details. And I have to object, it does make sense to query for some but not all fields ... the 10% were just an example. Immagine you have your Outlook Addressbook ... I doubt you qilll query for much more than firstname/lastname/email ... By the way searching for ID/Primary Key is not a search at all ... ist a simple read operation. There is no need for a pattern such as this to wrap simple reads.

As I mentioned, its used for searches in which you have to quickly find the ids of records matching certain criteria and by this drastically reducing the workload on the database and the network. I certainly agree this pattern is not allways helpfull, but thats the thing with patterns ... they don't allways match.

I use this pattern pretty much and have to admit that on one system for example, I was able to reduce the Database/Network Load to 1/50th of the initial load.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
cofactorAuthor Commented:
caching part is not clear . why do you want to keep  query in the cache but not the result ! ....I would prefer query and result both in the cache.

Could you please clarify this ?
0
 
ChristoferDutzCommented:
Well in my example about 10% of the data is needed ... so the cache only has 10% of the total Database size. If you have enough memory, certainly it's more performant to have everything cached, but in reality your data-amount can be enormous and your memory-availability is usually limited.
0
 
cofactorAuthor Commented:
in terms of code:

you  want to keep the query in the cache ?

select  *  from  dbtable  where  firstname=? and  lastname=? and email=?

you know I still don't get why this pattern is called  "Value List Handler"

see the wording  "Value"  , "List"  , "Handler"  .....how does the wording match with the  purpose ?
0
 
ChristoferDutzCommented:
In OOD a ValueObejct is an object that contains properties of a "full"-object. Sometimes it aggregates properties of multiple Objects. Just think of a value object as an object that contains data for you. It is usually used together with remoting applications because it is far more cheaper to send one value object containing everything the client will need to get, instead of having the client request all separate objects independently.

Ok ... to close the circle: The ValueList Handler handles a List of ValueObject that contain everything that he needs to perform his queries.
0
 
cofactorAuthor Commented:

http://java.sun.com/blueprints/corej2eepatterns/Patterns/ValueListHandler.html
http://www.precisejava.com/javaperf/j2ee/Patterns.htm#Patterns107 
This seems to me , instead of returning all the results at once . it returns results page by page whenever its requested by the client.
is not Pagination is similar to this ?
 
 
 
0
 
ChristoferDutzCommented:
Well I would say that pagination is one instance of the search. The problem with pagination comes with ordering of the elements. If your result is unordered, pagination would be simple. With ordering you have to know all results in order to return only the firs 10 (respecting the requested order). Most of the results are thrown away afterwards.

Now immagine your value object cache is filled with all the stuff that you need to perform the sorting/filtering and so on. Using this pattern you are able to determin which elements you acutally have to load without having to load all elements in the first place.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now