Defense programming and attack Programming

Source: Internet
Author: User

Today I suddenly thought of this topic.

Some readers may not quite understand what I mean.

Defense-based programming: What problems do customers ask.

Attack programming: proactively detects problems. Some of these problems are performance optimization problems, and some are bugs that customers fail to discover. Solve the problem as soon as possible.

Real Scenario: When a function was made, the developer tried it again and felt that the function had come out, and he felt relieved,

The test task of this function is assigned to the tester.

"Ding ding, Xiao Li, come here, how is your function ".

There are several possible situations:

Tested by: You have a problem with IE7. IE7 + is okay, so... This is a bug...

Developer: I am using ie9, ie7. is that okay?

Tester: In case the customer uses IE7 ....

Developer: Okay, it's a bug. submit it.

Trying to leave...

Tester: The program logic of your function is incorrect. Why can this function be used by all users. This function is intended for specific users.

Set permissions.

Developer: poor. I was lazy here. I didn't expect the tester to be so careful. It seems that it is better to control permissions.

Tester: there is another problem... Xx you are not reasonable here, and it is not reasonable there.

Developer: Well .. Well... Nun .... Uh huh, huh ,......

Finally, it is calculated that the bug change time is 3 ~ of the development time ~ 4 times.

Why are there so many bugs?

On the one hand, I did not fully think about programming myself. On the other hand, I thought it was irrelevant even if I found a bug.

Instead of modifying it, a bunch of bugs may occur during testing.

We made a program and thought there was no problem. After we finished the program (the first time), did we have the ability to pick out explicit or hidden problems, before testing, the tester killed all the problems in the bud. Maybe I am talking about some problems, which can help reduce the burden on the tester and the time for fixing bugs.

In a classic example of Defensive Programming in our company, I told you: Our company received a project of 10 million last year,

I will not talk about any specific project. All the features we have tested are incompatible with all browsers except IE, that is, only Ie can be used, the project unit is a low degree of informatization. I asked this question with the project manager. He said, if I changed the compatibility of IE, would they ask more questions? This sentence is actually correct, but I just want to ask the opposite question: If you know this question, why don't you consider it when you are working on a project? You have to wait until the project is finished, are you starting to face these problems?

Why don't I solve the problem before the problem is highlighted? What can be optimized? Do we have to wait until the customer mentions it? If he doesn't mention it, doesn't this problem happen?

What is a programmer's standard? One sentence: It depends on the degree to which he can optimize the current project.

Simply put, it is to discover and solve the problem (attack-based programming ).

Well, today, my complaint is sent here. I have only been in the business for one year. What's wrong is that I would like to ask you to point out more.

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.