Skip to main content
added 2 characters in body
Source Link
Stephen Paul
  • 39.4k
  • 18
  • 99
  • 76

I also encountered this by injecting service A into service B and vice versa.

I think it's a good thing that this fails fast as it should probably be avoided anyway. If you want your services to be more modular /and re-usable, it's best to avoid circular references as much as possible. This post highlights the pitfalls surrounding that.

Therefore, I have the following recommendations:

  • If you feel the classes are interacting too often (I'm talking about feature envy), you might want to consider merging the 2 services into 1 class.
  • If the above doesn't work for you, consider using a 3rd service, (an EventService) which both services can inject in order to exchange messages.

I also encountered this by injecting service A into service B and vice versa.

I think it's a good thing that this fails fast as it should probably be avoided anyway. If you want your services to be more modular / re-usable, it's best to avoid circular references as much as possible. This post highlights the pitfalls surrounding that.

Therefore, I have the following recommendations:

  • If you feel the classes are interacting too often (I'm talking about feature envy), you might want to consider merging the 2 services into 1 class.
  • If the above doesn't work for you, consider using a 3rd service, (an EventService) which both services can inject in order to exchange messages.

I also encountered this by injecting service A into service B and vice versa.

I think it's a good thing that this fails fast as it should probably be avoided anyway. If you want your services to be more modular and re-usable, it's best to avoid circular references as much as possible. This post highlights the pitfalls surrounding that.

Therefore, I have the following recommendations:

  • If you feel the classes are interacting too often (I'm talking about feature envy), you might want to consider merging the 2 services into 1 class.
  • If the above doesn't work for you, consider using a 3rd service, (an EventService) which both services can inject in order to exchange messages.
added 4 characters in body
Source Link
Stephen Paul
  • 39.4k
  • 18
  • 99
  • 76

I also encountered this by injecting service A into service B and vice versa.

Personally, I am gladthink it's a good thing that this fails fast as it should probably be avoided anyway. If you want your services to be more modular / re-usable, it's best to avoid circular references as much as possible. This post highlights the pitfalls surrounding that.

Therefore, I have the following recommendations:

  • If you feel the classes are interacting too often (I'm talking about feature envy), you might want to consider merging the 2 services into 1 class.
  • If the above doesn't work for you, consider using a 3rd service, (an EventService) which both services can inject in order to exchange messages.

I also encountered this by injecting service A into service B and vice versa.

Personally, I am glad that this fails fast as it should probably be avoided anyway. If you want your services to be more modular / re-usable, it's best to avoid circular references as much as possible. This post highlights the pitfalls surrounding that.

Therefore, I have the following recommendations:

  • If you feel the classes are interacting too often (I'm talking about feature envy), you might want to consider merging the 2 services into 1 class.
  • If the above doesn't work for you, consider using a 3rd service, (an EventService) which both services can inject in order to exchange messages.

I also encountered this by injecting service A into service B and vice versa.

I think it's a good thing that this fails fast as it should probably be avoided anyway. If you want your services to be more modular / re-usable, it's best to avoid circular references as much as possible. This post highlights the pitfalls surrounding that.

Therefore, I have the following recommendations:

  • If you feel the classes are interacting too often (I'm talking about feature envy), you might want to consider merging the 2 services into 1 class.
  • If the above doesn't work for you, consider using a 3rd service, (an EventService) which both services can inject in order to exchange messages.
added 38 characters in body
Source Link
Stephen Paul
  • 39.4k
  • 18
  • 99
  • 76

I also encountered this by injecting service A into service B and vice versa.

Personally, I am glad that this fails fast as it should probably be avoided anyway. If you want your services to be more modular / re-usable, it's best to avoid circular references as much as possible. This post highlights the pitfalls surrounding that.

Therefore, I have the following recommendations:

  • If you feel the classes are interacting too often (I'm talking about feature envy), you might want to consider merging the 2 services into 1 class.
  • If the above doesn't work for you, consider using a 3rd service, (an EventService) which both services can inject in order to exchange messages.

I also encountered this by injecting service A into service B and vice versa.

Personally, I am glad that this fails fast as it should probably be avoided anyway. If you want your services to be more modular / re-usable, it's best to avoid circular references as much as possible. This post highlights the pitfalls surrounding that.

Therefore:

  • If you feel the classes are interacting too often (I'm talking about feature envy), you might want to consider merging the 2 services into 1 class.
  • If the above doesn't work for you, consider using a 3rd service, (an EventService) which both services can inject in order to exchange messages.

I also encountered this by injecting service A into service B and vice versa.

Personally, I am glad that this fails fast as it should probably be avoided anyway. If you want your services to be more modular / re-usable, it's best to avoid circular references as much as possible. This post highlights the pitfalls surrounding that.

Therefore, I have the following recommendations:

  • If you feel the classes are interacting too often (I'm talking about feature envy), you might want to consider merging the 2 services into 1 class.
  • If the above doesn't work for you, consider using a 3rd service, (an EventService) which both services can inject in order to exchange messages.
added 1 character in body
Source Link
Stephen Paul
  • 39.4k
  • 18
  • 99
  • 76
Loading
added 2 characters in body
Source Link
Stephen Paul
  • 39.4k
  • 18
  • 99
  • 76
Loading
replaced http://softwareengineering.stackexchange.com/ with https://softwareengineering.stackexchange.com/
Source Link
URL Rewriter Bot
URL Rewriter Bot
Loading
edited body
Source Link
Stephen Paul
  • 39.4k
  • 18
  • 99
  • 76
Loading
added 146 characters in body
Source Link
Stephen Paul
  • 39.4k
  • 18
  • 99
  • 76
Loading
deleted 120 characters in body
Source Link
Stephen Paul
  • 39.4k
  • 18
  • 99
  • 76
Loading
deleted 60 characters in body
Source Link
Stephen Paul
  • 39.4k
  • 18
  • 99
  • 76
Loading
added 323 characters in body
Source Link
Stephen Paul
  • 39.4k
  • 18
  • 99
  • 76
Loading
Source Link
Stephen Paul
  • 39.4k
  • 18
  • 99
  • 76
Loading