I have a question about function-related cases, in which cases should I use the following?
zero function (string k, string l) {if (k! = Null & amp; l! = Null) {// k and l}} zero function (string k, string l ) Take some action on {//} Do some operations on K and L. I think I am receiving nullreference. For the case of use of // k and l // I have seen a type of work: a class / Private methods when you are sure to pass non-null objects} zero function (string k, string l) {if (k == Rik B) Throw the new logic NullException ( "k is null"); If (K == blank) throw the new argument NullException ("El is empty"); I used the string to display my point, that can be any object of those objects.
Please list the use cases for each function.
The final cases are most useful in APIs and frameworks where the consumer API has specified error messages in debugging Required. The second example is more common in the application code where application programmers can debug through the source, though often I like the third solution.
The first solution should never be used almost anytime. Only in situations where it extremely clarifies the caller that if the code is zero, then this type of technique should be used.
I suspect that you know exactly what you want (but do not know the word) DBC is a design technique / paradigm in which the developer sets a clear agreement with the callers in pursuance of specific rules. That's how input is handled and what is promised by each method. A well-formed contract clarifies the caller how the method behaves with any input.
Comments
Post a Comment