Class Design Question for 3-tier web app

C

Chumma Dede

Hi,

We are building a 3-tier web-app and are currently in planning phase.
At the business layer, I have a class which has a 2-d array which can
potentially hold thousands of rows. The thing is on the UI, I would
like to implement some kind of paging to display only N rows at a time
from this 2-d array.

I only want to retrieve records for the current page from the database.
This way the object does not overload memory with all rows that are not
currently shown on the UI.

How should I handle this in the class design? Should I have a property
in the class which will hold the current page number? This class
represents a business object, so I am not keen on that solution.

Any suggestions on how to handle this while designing classes? We are
currently in the Planning phase, and this will be a great help.

Thanks,
JGP
 
J

john_teague

Well, the only way I can see the speeding things up is if you an async
call back to get the next set of results.

ArrayList CurrentResults;
ArrayList NextResults;

when you view CurrentResults, you need need to keep NextResults synched
as well, so you would always be making a trip to the datastore on the
same thread.

An async callback might speed things up a little bit, but not sure it
would be worth it. It really depends on the number of records your
dealing with, the web server and database server capabilities to
determine which approach.

The common argument at my place to work is that our database is stored
on a very powerful server, so do as much as you can there. However, I
think that only holds true for extreme number of records (and if you
have that many records, maybe that should be filtered first). If I'm
dealing with <= 1000 records, I would prefer to cache the entire
collection on the webserver and pull back exactly what I want from the
cached collection.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top