Agile Software Development-an example: Copy Program

Source: Internet
Author: User


And the code display application contains three modules, or subprograms. The copy module calls the other two modules. Copy gets characters from the read keyboard and passes the characters to the write printer module.

.... Demand is changing:

We hope that copy can read information from the tape reader: If the variable value is false, it reads information from the keyboard as before. However, many other programs are currently using the copy program. You cannot change the interface of the Copy Program. Changing the interface will result in a long time of re-compilation and re-testing.

Patch:

Of course, you will think of the method of using a global variable. The result is as follows:



If you want to set the ptflag to true for the copy from the tape, and then call copy, it will correctly read the information from the tape. Once the copy call returns, the caller must reset the ptflag.

....

Need to change again:

The customer hopes that the copy program can be output to the paper belt void machine.

If such patching continues, the software will become difficult to maintain.

This design change is similar to the previous one. But another global variable and? Operator.


-----------------------------------------------------------------------------

The above example does not mean that the customer needs to be changed. In reality, the customer's needs must be changed.

The above example shows how fast the design degradation speed of the program is in the face of changes. The original design of the Copy Program is simple and elegant. However, after only two changes, it has shown symptoms of rigidity, vulnerability, unnecessary complexity, and unnecessary repetition.

Remember, the most unstable in most software projects is the requirement. It must be in a continuously changing state. This is a fact we must accept as developers!

A good solution:

In this example, when we encounter the first requirement change, we need to modify the design and make the modified design flexible for the changes in that category of requirements.


To meet new requirements, the team seize this opportunity to change the design so that the design will be flexible for future similar changes, rather than trying to patch the design.


Agile Software Development-an example: Copy Program

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.