You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi Songul, we already know both singleton and factory design patterns use to create objects. However, I can't decide which one to choose when creating an object. What issues do you think I should consider? How should I decide?
The text was updated successfully, but these errors were encountered:
If you need one instance , you should singleton . This pattern includes single class . Multiple classes must be use one instance , you should use singleton design pattern .
You have more concrete class .We have a lot of classes and you want to create a similar object. I think You have 2 way to reach classes . One of them you should "new " concrete class one by one or you must create factory class. Factory class include object of concrete class . If you use factory class, you can created different more object and same time you have connected loosly coupled with other class. We know that We dont want to strong bond with other class.
@SongulSYTRK
As you mentioned above, only one instance satisfies the needs. Based on that, I can say that singleton is pretty cool for ram management because we don't have to repeatedly create new objects with the "new" keyword to take up ram space.
Hi Songul, we already know both singleton and factory design patterns use to create objects. However, I can't decide which one to choose when creating an object. What issues do you think I should consider? How should I decide?
The text was updated successfully, but these errors were encountered: