简体   繁体   中英

Get all the information from the server or do it in stages?

I want to get the name and picture of a Cub Scout, the Cub Scout details, the awards and details for each award and display these details in a view. Is it best to get each set of details from the server side, pass it back to the client side and display it or get all the information at once?

I would opt for option 2. However, I thought I had better check.

Regards,

Glyn

Unless your query is returning some huge dataset, then multiple queries probably aren't necessary. If load times are too slow when you implement your queries, consider paging your results.

When showing a view with all records from db, it is usually a good practice to show minimum data for each row with a link to more details for each row for better user experience and less load time from query.

Now when user click on more details, other detail data of that particular row should be fetched.

I agree that if the size of the information is not that big, probably is a good idea to get it all at once. All depends on your UX and you backend design.

Are you expecting to show the info according to user interactions?, Are you going to reuse part of that information somewhere else in your app?. Are you caching query results?

Is you do.. then you might consider to have a few methods to get the information. Regarding your page controller, unless you are not using ajax, you may create a facade (this pattern ) to integrate all those partial methods.

Let me know if you have any questions..

Thansk!, @leo.

Get the benefits of Asynchronous call load as less data as possible on on-load and make Asynchronous calls when data needed.

Two main reasons to go for Asynchronous :

Reduce the traffic travels between the client and the server.

Response time is faster so increases performance and speed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM