Change uncertainty to confirmation ~ Thank you for letting me get rid of the "negative"

Source: Internet
Author: User

Here, I would like to thank the "xor" operator. Really, thank you, ^ (xor). Without it, maybe my architecture is always inseparable from the negative formula, if you don't understand what I said, let's take a look at this article. In fact, this article does not solve the fundamental negation problem, and the question is just a learning of DefaultValue. This article, I think I have finally solved the "negative" and actually solved it!

This is my architecture code. The negative expression is to make programmers write less code.

  summary         summary summary         summary         

After your data context implements the interface, you don't need to assign a value to it. You only need to implement getter and setter, but the code looks pretty because of the meaning of the Code.

It is a type of "negative". We generally interpret it as: no submission, but in the program, we want it to be submitted and write code like this.

         ();

This means that, if it is not submitted (that is, submitted), the action is saved. This explanation is not easy for us to understand. We generally call it negative, why not use IsSubmit? Because the default value of the bool type is false. If you use issubmit, the default value is "no submit", and what I need is "Default submit ", I don't want to assign IsSubmit to true when every context is implemented, because

The programmer did not do it, and the program itself was not beautiful. So I used isnotSubmi-this is the reason for using it...

The emergence of Xor completely frees me from "negative"

We all know the meaning of exceptions. The similarities are false, and the differences are true, but they are not used in what they need. This is a common problem of Chinese people, that is, they only know this thing, but I don't know how to make good use of it.

View my code and use xor to change isnotsubmit to issubmit.

   summary         summary summary         summary         

Pay attention to the following judgment. It is the core and actually a small skill in program processing.

  (db.IsSubmit ();

We want IsSubmit and true to perform an exclusive or operation. Through the concept, if issubmit is false, the condition is true, and the default bool type is false. Therefore, our program is perfect, submitted by default, and my attribute is IsSubmit, not IsNotSubmit. Haha, finally get rid of the "negative!

Thanks again for xor. Thanks for your exception or!

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.