Skip to main content
added 611 characters in body
Source Link
nadir
  • 773
  • 1
  • 4
  • 10

If "ThingsService" & "StuffService" have such coupling (i.e. they both call each other's methods), why you found the need to separate them to two distinct classes in the first place ?

I advise you to reconsider your design decisions, either create a single class or move out the shared functionality between the classes to a separate class and inherit from it.

Regarding your questions:
It's not a design pattern per se.
A factory can be a singleton.
This is a design smell, as the two classes & the phrasing of the question indicate a strong coupling between them.

Regarding details in comment:
Having a 15000 lines of class, and redesign it to multiple classes with a very strong coupling - is not a solution to dealing with its complexity, and it can only create maintenance headaches down the road.
Again, you should reconsider your design of this class - separating shared functionality to an encapsulated class, composition etc.
Regarding the memory question, you can employ lazy schemes in your class and allocate memory only when you need it. (and you can deallocate it when you don't need it anymore). (Instead of eagerly allocating it in the constructor)

If "ThingsService" & "StuffService" have such coupling (i.e. they both call each other's methods), why you found the need to separate them to two distinct classes in the first place ?

I advise you to reconsider your design decisions, either create a single class or move out the shared functionality between the classes to a separate class and inherit from it.

Regarding your questions:
It's not a design pattern per se.
A factory can be a singleton.
This is a design smell, as the two classes & the phrasing of the question indicate a strong coupling between them.

If "ThingsService" & "StuffService" have such coupling (i.e. they both call each other's methods), why you found the need to separate them to two distinct classes in the first place ?

I advise you to reconsider your design decisions, either create a single class or move out the shared functionality between the classes to a separate class and inherit from it.

Regarding your questions:
It's not a design pattern per se.
A factory can be a singleton.
This is a design smell, as the two classes & the phrasing of the question indicate a strong coupling between them.

Regarding details in comment:
Having a 15000 lines of class, and redesign it to multiple classes with a very strong coupling - is not a solution to dealing with its complexity, and it can only create maintenance headaches down the road.
Again, you should reconsider your design of this class - separating shared functionality to an encapsulated class, composition etc.
Regarding the memory question, you can employ lazy schemes in your class and allocate memory only when you need it. (and you can deallocate it when you don't need it anymore). (Instead of eagerly allocating it in the constructor)

added 239 characters in body
Source Link
nadir
  • 773
  • 1
  • 4
  • 10

If "ThingsService" & "StuffService" have such coupling (i.e. they both call each other's methods), why you found the need to separate them to two distinct classes in the first place ?

I advise you to reconsider your design decisions, either create a single class or move out the shared functionality between the classes to a separate class and inherit from it.

Regarding your questions:
It's not a design pattern per se.
A factory can be a singleton.
This is a design smell, as the two classes & the phrasing of the question indicate a strong coupling between them.

If "ThingsService" & "StuffService" have such coupling (i.e. they both call each other's methods), why you found the need to separate them to two distinct classes in the first place ?

I advise you to reconsider your design decisions, either create a single class or move out the shared functionality between the classes and inherit from it.

If "ThingsService" & "StuffService" have such coupling (i.e. they both call each other's methods), why you found the need to separate them to two distinct classes in the first place ?

I advise you to reconsider your design decisions, either create a single class or move out the shared functionality between the classes to a separate class and inherit from it.

Regarding your questions:
It's not a design pattern per se.
A factory can be a singleton.
This is a design smell, as the two classes & the phrasing of the question indicate a strong coupling between them.

Source Link
nadir
  • 773
  • 1
  • 4
  • 10

If "ThingsService" & "StuffService" have such coupling (i.e. they both call each other's methods), why you found the need to separate them to two distinct classes in the first place ?

I advise you to reconsider your design decisions, either create a single class or move out the shared functionality between the classes and inherit from it.