• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Bulky Objects !

 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

When can I say a object to be heavy / bulky ?

I feel a particular type of objects in my application are bulky and it would be useful to make a object pool for those objects.But what would be the criteria of a heavy object ? Or ,When can I say a object to be bulky ?

I am saying those objects to be bulky as those are close to 2k lines of code.Is there is any formal defination of heavy objects apart from lines of source code , like number of variables , depth of inheritence etc.
 
Paul Clapham
Sheriff
Posts: 21000
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why not back up and consider your original question: What types of objects should you use a pool for?

In my opinion you should use a pool for a type of object when that type of object uses a lot of some kind of resource, so that creating large numbers of it would stress the system.

So in real life you have thread pools, because a thread consumes system resources and you don't want to create too many of them. Similarly with database connections.

I don't see any of those source code metrics you suggested as being of any use in answering this question.
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Paul , its a great deal of information.
So I think there is no need to implement a object pool for these object.These classes might be large in size but do not consume much of resources.

Thanks once again.
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
These classes might be large in size but do not consume much of resources.


Perhaps you can flyweight it then ?
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by John Meyers:


Perhaps you can flyweight it then ?


Thanks John.I have already evaluated flyweight , but will not be suitable for my application.

I just need to make an object pool provided I can find out as how much time does it take to instantiate the object of the class that is under consideration.Doing some timer testes to find out as how much time does it take to instantiate the object and how much time will I gain by using a object pool.

Any web pointers on Heavy objects would be appreciated.
Thanks,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic