From the perspective of development, we should organize variables and functions according to certain naming and formats. Next, we will write code. in the industry, many developers advocate test-driven development, next, let's talk about unit testing. TDD is short for Test-DrivenDevelopment. it is a core practice and technology in agile development and a design methodology. The principle of TDD is to write unit test case code before developing function code. 1. Three Laws of TDD: before writing unit tests that cannot pass, you cannot write Production Code... from the perspective of development, we should organize variables and functions according to certain naming and formats. Next, we will write code. in the industry, many developers advocate test-driven development, next, let's talk about unit testing. TDD is short for Test-Driven Development. it is a core practice and technology in agile Development and a design methodology. The principle of TDD is to write unit test case code before developing function code. 1. Three Laws of TDD: Production code cannot be written before unit tests that fail to pass. Law 2 can only write unit tests that are just unable to pass, and can neither compile nor pass. Law 3 can only write production code that is sufficient to pass the current failed test. Write the test code together with the production code. the test is only a few seconds earlier than the production code. 2. keep the test code as clean as the production code, and keep it clean. Testing brings all the benefits. The neat unit test code brings many benefits to your code. The more dirty the test is, the more dirty the code will eventually become. If a test is lost, the code begins to rot. 3. a clean and tidy test is very important.
1. share today: clean code-Unit testing
Overview: Directory overview variable function objects and data structures test concurrent error handling format comment overview Robert TC. Martin in code...
4. Read the Clean Code
Introduction: I recently carefully read CleanCode when I was busy with public transportation. I once again admire Uncle Bob's humorous essays, his own point of view and understanding. What impressed me most is Uncle Bob's solution to data structures and objects.
[Related Q & A recommendations ]:
The above is a detailed introduction to the clean code. For more information, see other related articles in the first PHP community!