Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do I need to use a BaseClass for this scenario?

Basically I have a class called Asset which holds all the information for an Asset in my system. This can get quite big (Assets have Thumbnails, Filenames, Metadata, Ratings, Comments, etc).

On my results page, I list all the Assets that match a particular criteria which then can be filtered using jQuery.

I was finding performance issues in IE8 so the first thing I did was look at the Asset class and see what was not needed for displaying an Asset on the page. (Later I visited my jQuery and found that it was what was causing the performance issues).

So, when I stripped my class right down to basics, I made that the BaseAsset and derived Asset from that.

My question is, did I need to do that? was there any need?

I shall provide examples if necessary, but I am refraining at the moment, because the post could become quite big :)

like image 650
r3plica Avatar asked Oct 22 '22 20:10

r3plica


1 Answers

I don't think you need a base class per say, I think what you need is to send what you need. It seems that the problem simply was the fact that you didn't need all of the data all of the time.

I know it's tedious, but only send what you need, when you need it, and you won't have any problems. When you need more data, then either load it asynchronously with an AJAX call, or even make another page that the user navigates to.

like image 133
Mike Perrenoud Avatar answered Oct 27 '22 09:10

Mike Perrenoud