Skip to main content

Jorge Gamba

Jorge Gamba's Public Library

  • For extremely performance demanding APIs, an even faster pattern than the Tester-Doer described in the previous section should be used
  • to adjust the member name to make a well-defined test case a part of the member semantics
  • TryParse method which attempts to parse, but returns false if parsing is unsuccessful and returns the result of a successful parsing using an out parameter.

1 more annotation...

  • These methods first test the input before doing anything with it
  • Microsoft introduces the tester-doer pattern as a solution to exception performance
  • Tester-doer methods often are called within an if-statement.

7 more annotations...

  • Instead of first asking if “he” can do it, or wants to do it, you just tell “him” to. Instead, it should throw an Exception, if it can’t satisfy the expectations of the caller.
  • Tell, don’t ask states, that you should trust the code you write
  • But what, if you need to check, if a Stream is writable? Or what, if you’d expect the string to be invalid, and you want to respond to that without catching an exception?


    This is, where Try/Can is often implemented

8 more annotations...

1 - 20 of 19414 Next › Last »
20 items/page

Highlighter, Sticky notes, Tagging, Groups and Network: integrated suite dramatically boosting research productivity. Learn more »

Join Diigo