Why do I have to program faster and slower?

Source: Internet
Author: User

Before, my colleague found a bug in one of the Lib I wrote earlier and reported the error to me.
Then I went to fix the bug, and finally just modified a line of code to solve the bug, resolved to find out the whole morning so passed.

OK, just fixed a bug in the morning, and changed only one line of code, exactly what happened, where did the time go? Review the whole process, because this lib developed six months ago when I went back to locate the bug took a little time to recall the entire LIB code structure design.
Then I found the class of the problem code, but I did not immediately start to modify the code, but first in the LIB unit test set a new unit test, the unit test built the bug's recurrence scene, and successfully let the unit test run failed, and then I began to modify the code, and found the row of the problem, The unit test set was re-run after modification and the green bar was seen smoothly. As a public lib, after the completion of the modification I also have to update the release version, write the corresponding document, and upload to the Maven warehouse, is completed.
Recall that the discovery time was spent primarily in the test scenario of building a recurring bug, and sometimes it might be more difficult to write code in order to build a test scenario than to develop the functionality itself.

Here's an example of fixing a bug, although it's just a line of code that has so much to do. But even if you want to write unit tests for the main scenario just as you would when developing a new feature, there are a few more issues to consider, such as sometimes being immersed in meditation in programming, but not necessarily in esoteric algorithmic problems, often thinking of a good name (class name, method name, variable name), a good name without a lot of comments, right?

Programming is the recording of human thinking, design, language, logic, and spiritual creation in a way that computers can identify and store. The programmer is doing this job, when you finally sit in front of the computer ready to knock down the code, has reached the final stage, not only to complete the record, but also the same thing with less code to complete the better, this is our continuous refactoring and optimize the meaning of code implementation. Less code allowed me to reload them into my mind in less time after six months, so it's not a bad thing to slow down programming.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Why do I have to program faster and slower?

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.