wood burning stoves 2.0*
The moose likes Java in General and the fly likes Bulky Objects ! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Bulky Objects !" Watch "Bulky Objects !" New topic
Author

Bulky Objects !

Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
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.


Rahul Bhattacharjee
LinkedIn - Blog
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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

Joined: Nov 29, 2005
Posts: 2308
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

Joined: Feb 24, 2006
Posts: 6661
    
    5

These classes might be large in size but do not consume much of resources.


Perhaps you can flyweight it then ?


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
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,
 
wood burning stoves
 
subject: Bulky Objects !