Hi,

Although I have done a reasonable amount of coding I have very little training (self taught) so apologies if this is a stupid question.

I have written a basic Defect Management app which allows developers to create a release and assign defects to it. The release object has the usual id, name etc and an object called DefectCollection with is a collection of Defect objects. When I load a Release (using it's load method) it calls the PopulateFromRelease method of the DefectCollection. This all works.

However, I now have a ReleaseCollection object which I can populate from a method such as 'LoadAllReleases' which also works, the problem is that for every release I load it loads all the defects for that release into new objects and thus I end up with thousands of defect objects many of them repeated.

The solutions I have so far are:

1, Leave it as it is it works but is inefficient
2, Create a 'master' defectcollection, preload it with all the defects and reference them
3, Write an defect collection that loads defects as required and allows multiple release objects to reference them
4, Write the defectCollection as a lazy collection populated only when it is referenced

This is only 1 occurrence of the same issue I have so any guidance on best practice would be very much appreciated.

Thanks in advance

Recommended Answers

All 3 Replies

Hello,
I just want to share some thoughts to consider on your problem.

About suggested ways to go:

1. Leave it as it is it works but is inefficient

I think this solution has it rights to exist for the case when your collection has small size. But it isn't true for your case, so we're moving on. It would provide faster access to your data.

2. Create a 'master' defectcollection, preload it with all the defects and reference them

Well, same as for previous case - you can freely use it, when don't have too many data.

3. Write an defect collection that loads defects as required and allows multiple release objects to reference them

I think that is a step into right direction .. using less memory and still keeping it fast.

4. Write the defectCollection as a lazy collection populated only when it is referenced

I think it's the best of suggested solutions. Since your application isn't real-time system - you freely can make your user wait few more seconds (or even milliseconds) to load requested data. Moreover, if I were you - I categorized the defects on groups .. even made some structure of them to lessen the amount of information needed to load each time (also it can help to navigate between those defects). And place all this into e.g. lazy loading tree. (It can be whatever you want .. one more example would be a paged table, which loads only 1 page of it's content after load, and then get's other pages when user tries to go to the next page).

Hope this would help you.

P.S. The question isn't stupid at all. :)

commented: Good suggestion. Helpful. +9

Antenka,

Many thanks for your thoughts. The more I think about it option 4 is the way to go. It provides felxibility and simplicity while still achieving all my requirements.

Thanks again.

Paul

You're welcome!
Good luck with your project :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.