The third week of the completion of the job

First, the theoretical study

1, learning lessons Mu Chapter 3

  Unit testing is a software testing method, the test source code elements each of a plurality of units or modules set by this test method, the test program to use the program, to ensure their availability. With increasing degree of development of software, the cost of the original bug fixes will be higher. Unit testing on the early development of the software, can effectively reduce the cost of software development, and to reduce the number of bug in the software used in the process. The whole testing process is done through test cases, expected results, the value of the prefix and suffix value

  TESTING method is generally divided into unit testing and white box method. Wherein the black box testing called functional test, in the case without considering the internal logic structure and internal properties of procedures, functions, input and output values ​​is checked by the program meets expectations. Structure, also known as white box test and in the case of using the logical structure allows the internal program and related information, designed to test the value of the logical path of all programs tested. In contrast, the white-box testing can greatly increase code coverage, can improve the code quality in software design at the beginning.

 

2, the third chapter of "building law" study

  Pair programming is a method of agile software development, two programmers work together on a computer. Usually by one person write the code, another person responsible for the review. And the roles between the two programmers are interchangeable. Pair programming process is a process of mutual supervision, after forcing the programmer must be frequent communication, can effectively upgrade their technological capabilities. In this specification and code into the code review plays an important role, which involves all aspects of program design, the relationship between the modules, design patterns. Lecture talked about the good programmers tend to think for several days as a variable name, which is a very interesting and illustrative examples have.

 

3, test-driven development

  Test-driven development TDD-Test Driven Development is an Agile development model in practice, in short, namely: TDD refers first to write test code before writing the true function implementation code, and then implement the code based on the reconstruction needs. The basic test-driven development process is as follows:

① Quickly add a test
② run all the tests (or sometimes only need to run a part), the new test can not be found
③ make some small changes, as soon as possible to make the test program can be run, for some implausible method can be used in the program
④ run all the tests and all passed
⑤ reconstructed code to eliminate duplicate design, optimize design structure
  Test-driven development is not a testing technique, it is an analytical technology, design technology, but a technology organization in all development activities. With respect to the traditional structured development method, a high quality development process, a development of high efficiency development software scalability advantages. It is currently the more popular development mode.
 
 

Second, hands-on learning

1, the game of life was part of unit testing game_map

  Referring to blog https://blog.csdn.net/mssora/article/details/53380276 , Mu lesson game_map of the unit test code, unit test code has been uploaded code repository https://github.com/NemoNemo03/N -Stock / Tree / Master / LIFE_GAME , tested a total of nine content, feedback were successful, as follows:

  Code and test coverage analysis code, wherein the code game_map coverage was 85%, as follows:

 

 

 

 

 

2, improvements to the word search program

The contents of the learning unit testing, black box testing performed (white box codes is complex, not completed), simply enter some words were tested and found to meet the requirements of output, but the longer the test time, the main because the sentence structure is not clear, the code is too complicated, then re-written the code using the for loop, naming the new code, the structure is relatively clear, there was a marked improvement in speed. Specific code as follows:

 1 import re
 2 import profile
 3 
 4 with open('document.txt', 'r') as f:
 5     string = f.read()
 6 str_list = string.lower()
 7 words = str_list.split('.')
 8 words_count = len(words)
 9 
10 
11 with open('quety.txt', 'r') as f:
12     string = f.read()
13 str_query = string.lower()
14 word_query = re.split('[^a-zA-Z]+', str_query)
15 
16 
17 
18 def words_xoy(words):
19     word_all_list = []
20     for x in range(len(words)):
21         word_list = re.split('[^a-zA-Z]+', words[x])
22         if '' in word_list:
23             word_list.remove('')
24         word_all_list.append(word_list)
25     return word_all_list
26 #print(words_xoy(words))
27 
28 
29 def query(words,word_query):
30     word=word_query
31     for x in range(len(word)):
32         if word_query[x] in re.split('[^a-zA-Z]+', str_list):
33             word_all_list = words_xoy(words)
34             for i in range(len(word_all_list)):
35                 for j in range(len(word_all_list[i])):
36                     if word[x] == word_all_list[i][j]:
37                         print(str(i+1)+'/'+str(j+1), end='\n')
38         else:
39             print('none',end=' ')
40 
41 profile.run("query(words,word_query)")

  Wherein the speed comparison of old and new code as follows:

                           The new code old code

 

Third, the learning record

Learning phase Learning Content Learnings
2019.3.2 14:00-17:00 Software Engineering

Knowledge of unit testing 

2019.3.4 14:00-17:00 "Building of the law" handouts Understanding of the specific process of programming cooperation
2019.3.5 14:00-17:00 python based learning The basic syntax of learning python
2019.3.7 14:00-17:00 python based learning The basic syntax of learning python
2019.3.8 08:00-2100

 

Online information, programming

Familiar with the process of writing a python program

 

 

 

 

 

 

 

 

 

 

 

 

IV Summary

  With in-depth study of software engineering, understand the importance of specific software development process and science of software development. Especially unit testing application, it can help programmers to detect problems in a timely manner to solve the problem, after the software development process have to learn to make good use of unit testing. Development cooperation is an effective way of software development, in the process of joint development should pay attention to the code specifications, and code review, a good working relationship can greatly enhance the quality of programming and programming efficiency. In the course of practice are not familiar with the language of python, programming efficiency is very low, hoping to improve the learning process in the future.

Guess you like

Origin www.cnblogs.com/lxh0303/p/12444753.html