0

For Stateless object Which one we should use, whether to create Singleton class for it or create Object pool for it. Where does the difference come between object pooling and singleton class? what are the condition when we can choose them over each other?

Think around Stateless object only.

1 Answers1

0

When we light weight objects which do not have internal state there we can us object pool. This is same as fly weight pattern from (GOF). If object is heavy and costly in terms of resource then we go for singleton.

Bhushan
  • 567
  • 2
  • 5
  • 14
  • 1
    If object is heavy and costly to create then we should go with pooling i think because we don't want to create heavy object when application is running – dharmendra singh Jun 03 '15 at 13:00