Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • I think you are using upstream developers in the wrong sense. Also, you said it violates single responsibility principle, but in reality many on demand initialization and value caching is implemented that way (with proper concurrency controls in place of course) Commented Mar 4, 2014 at 11:36
  • In your given example, what about checking for null before the subtraction operation, like this if(PropertyB == null) return 0; Commented Jun 14, 2018 at 20:45
  • 1
    Can you also elaborate on your last paragraph, specifically what do you mean by 'layer of abstraction'. Commented Jun 14, 2018 at 20:48
  • If we are doing some IO work, the layer of abstraction to catch an IO Exception would be where we're doing the work. At that point we have all the information we need to decide if we want to retry or throw up a message box to the user or create an object using a set of defaults. Commented Jun 26, 2018 at 0:17
  • 1
    "In your given example, what about checking for null before the subtraction operation, like this if(PropertyB == null) return 0;" Yuck. That would be telling the calling method that I have valid things to subtract to and from. Of course this is contextual but it would be bad practice to do my error checking here in most cases. Commented Jun 26, 2018 at 0:21