Skip to main content
added 275 characters in body
Source Link
John Wu
  • 26.9k
  • 10
  • 68
  • 92

I have twothree thoughts regarding this design.

  1. Does the caller really know or care if that particular service has a size limit? Is it supposed to know about that? Seems to be you may be violating separation of concerns. Especially if there are really 5 layers to go through.

  2. I'm a big fan of limiting flexibility when the flexibility exceeds system constraints. What is the point of passing this flag or callback as an input parameter, if it's the same every time? All you're doing is quizzing your developer to see if he knows the magic code to put between the parentheses-- the flexibility is not actually needed or used-- and if he fails the quiz, the system crashes.

  3. What happens when you add memory to the server? Do you want to go back and change a bunch of code? What if you only added it on certain servers?

For those reasons, I'd suggest either

Option #1. Make it a configurable size threshold that is set in configuration file for the layer closest to the data/size issue.

Option #4. Make it a constructor parameter of the service itself, not the method. Set it in your initialization routine, e.g. when you set up your Inversion of Control container or whatever it is you are using. And drive the initialization with configuration, so you can make it specific to a particular instance of the application.

I have two thoughts regarding this design.

  1. Does the caller really know or care if that particular service has a size limit? Is it supposed to know about that? Seems to be you may be violating separation of concerns. Especially if there are really 5 layers to go through.

  2. I'm a big fan of limiting flexibility when the flexibility exceeds system constraints. What is the point of passing this flag or callback as an input parameter, if it's the same every time? All you're doing is quizzing your developer to see if he knows the magic code to put between the parentheses-- the flexibility is not actually needed or used-- and if he fails the quiz, the system crashes.

For those reasons, I'd suggest either

Option #1. Make it a configurable size threshold that is set in configuration file.

Option #4. Make it a constructor parameter of the service itself, not the method. Set it in your initialization routine, e.g. when you set up your Inversion of Control container or whatever it is you are using.

I have three thoughts regarding this design.

  1. Does the caller really know or care if that particular service has a size limit? Is it supposed to know about that? Seems to be you may be violating separation of concerns. Especially if there are really 5 layers to go through.

  2. I'm a big fan of limiting flexibility when the flexibility exceeds system constraints. What is the point of passing this flag or callback as an input parameter, if it's the same every time? All you're doing is quizzing your developer to see if he knows the magic code to put between the parentheses-- the flexibility is not actually needed or used-- and if he fails the quiz, the system crashes.

  3. What happens when you add memory to the server? Do you want to go back and change a bunch of code? What if you only added it on certain servers?

For those reasons, I'd suggest either

Option #1. Make it a configurable size threshold that is set in configuration file for the layer closest to the data/size issue.

Option #4. Make it a constructor parameter of the service itself, not the method. Set it in your initialization routine, e.g. when you set up your Inversion of Control container or whatever it is you are using. And drive the initialization with configuration, so you can make it specific to a particular instance of the application.

Source Link
John Wu
  • 26.9k
  • 10
  • 68
  • 92

I have two thoughts regarding this design.

  1. Does the caller really know or care if that particular service has a size limit? Is it supposed to know about that? Seems to be you may be violating separation of concerns. Especially if there are really 5 layers to go through.

  2. I'm a big fan of limiting flexibility when the flexibility exceeds system constraints. What is the point of passing this flag or callback as an input parameter, if it's the same every time? All you're doing is quizzing your developer to see if he knows the magic code to put between the parentheses-- the flexibility is not actually needed or used-- and if he fails the quiz, the system crashes.

For those reasons, I'd suggest either

Option #1. Make it a configurable size threshold that is set in configuration file.

Option #4. Make it a constructor parameter of the service itself, not the method. Set it in your initialization routine, e.g. when you set up your Inversion of Control container or whatever it is you are using.