Solved

Value List Handler Pattern

Posted on 2010-09-09
9
1,091 Views
Last Modified: 2013-11-24
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
Comment
Question by:cofactor
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 20

Expert Comment

by:ChristoferDutz
ID: 33635549
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
 

Author Comment

by:cofactor
ID: 33635752
>>>>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
 
LVL 20

Expert Comment

by:ChristoferDutz
ID: 33638899
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
How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

 

Author Comment

by:cofactor
ID: 33643528
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
 
LVL 20

Expert Comment

by:ChristoferDutz
ID: 33644303
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
 

Author Comment

by:cofactor
ID: 33668949
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
 
LVL 20

Expert Comment

by:ChristoferDutz
ID: 33669757
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
 

Author Comment

by:cofactor
ID: 33689531

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
 
LVL 20

Accepted Solution

by:
ChristoferDutz earned 150 total points
ID: 33689863
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
going to wrong jsp page 2 49
collection output issue 9 65
junit as external jar or library 7 39
activeMQ Queue Messages Enqueued and Messages Dequeued 1 38
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question