I recently had to troubleshoot a performance problem with a slow grid load. Upon investigation, it looked like someone had used a List<Product> to populate the grid. The problem was that the Product object had a lot of properties, many of them not.lazyloads(), most of them not even needed for the grid.
So to resolve the issue I created a new Object called ProductLite, that had only lazy loads, most of the key info on joins and the performance was now great. Rather than doing 10,000 db hits, it went to 1.
My question to the SO community, how do you model your objects? I was thinking that all objects should have a “details” and “info” versions, since sometimes and intensive object load is needed. Ie. ProductDetails would contain all the info and not be used in lists, whereas ProductInfo would carry simply the high level info for use in lists, quick lookups etc.
Is there a standard that has been adopted as a best-practice for modeling objects?
The problem here is that you are confusing Domain Model objects with DTOs/Presentation Model objects.
I’m usually reluctant to consider any guideline a “best practice”, but here are a few general tips:
batch-sizesettings for entities and collections (rule of thumb: use your page size)