Father of jQuery: insist on writing code every day

Source: Internet
Author: User

Last fall, my branch code project encountered some problems, and the project was not progressing well, and I cannot find a way to complete more code without affecting my work in Khan Academy ).

I mainly run my branch line on weekends, and sometimes at night. This method does not work well for me. I am under too much pressure. I need to work hard on weekends to do as much work as possible. If I don't do it, I will feel frustrated ). Another problem is that I cannot guarantee that every weekend is free, and I don't want to spend all the weekend's time programming to lose all the opportunities for relaxation and entertainment ).

In addition, if encoding is performed every week, the gap is too long. It is too easy to forget what you are doing, or what you still need to do, even if you have notes ). If you miss a weekend, the problem becomes more serious, and the interval suddenly becomes two weeks. Context switching over the past few weeks may be fatal. I have many branch projects that have died due to this kind of attention ).

Last year, Jennifer Dewalt created 180 websites on 180 days to learn programming by herself. Her practice inspired me. I decided to adopt a simple policy: daily encoding.

I decided to set some rules for myself:

  1. Code must be written every day. I can write documents, blogs, or other things, but these cannot be used to write code.

  2. The code must actually work. Adjusting indentation and re-layout is not counted. If possible, refactoring is not counted. These tasks can be performed, but they cannot be the only code of a day .)

  3. All code must be completed before midnight.

  4. The code must be open-source and put on Github.

Some rules are relatively arbitrary. For example, you don't need to write the code before midnight. But I am worried that staying up late will cause the code quality to drop. Similarly, the Code does not need to be open-source or stored on GitHub. In this case, I want to force myself to consider readability and modularization when writing code ).

This policy has been effective so far. I have been working for almost 20 weeks. The reason why I wrote this blog is that it completely changed the way I wrote code, and more importantly, it affected my life and my mind.

This change in habits produces some interesting results:

Minimum feasible encoding.I force myself to spend less than half an hour writing code every day. If it is less than this time, it will be difficult to write valuable code, especially to recall what was written the day before ). On workdays, I sometimes write more than 1.1 times less than an hour.) On weekends, I sometimes write code all day.

Writing code becomes a habit.It is worth mentioning that I do not particularly care about the above Github images. I think this is the most useful thing for this experiment: this is a change you have made for yourself, not to satisfy others' comments on your work. Diet and exercise are also a truth: If you don't care about improving yourself, you will never succeed.

Fight against anxiety.Before I started this experiment, I often felt anxious about not finishing enough work or making enough progress, and the progress was hard to quantify, because my branch projects were not dead-end ). I realized that progress is equally important as actually advancing. This opened my eyes. Once I continue to push forward the project every day, my anxiety begins to dissipate. I am very happy with my work, and I have no longer had that kind of unbearable desire to push forward the project in a sudden storm.

Weekend.In the past, finishing work over the weekend was definitely the key driving force for progress, because it is usually the only opportunity for me to push forward the work of a large number of regional projects .) Now the situation is different-this is a good thing. It is expected that I will only be disappointed to finish all the work for one week on a weekend. I seldom finish my work, so I refused other weekend activities to do more work, such as eating dim sum, visiting museums, visiting parks, and accompanying my partner ). I deeply feel that although branch projects are very important, they should not be the whole of life.

Background processing.One of the interesting side effects of coding the branch project code every day is that your current task is often run in the background of your brain. So when I go for a walk or bath, or do other brainless activities, I am thinking about what code I will do next and find a good solution to the problem. This is not the case when I coded it once a week or two weeks ago. At that time, time was spent thinking about other things, and it was usually anxious to be unable to complete any branch projects.

Context switch.When you pick up the branch project, there will always be context overhead. Unfortunately, it is extremely difficult to rethink the entire week ago. It is very helpful to do this every day, because the interval is greatly shortened, which makes it easy for me to remember what I am doing.

Balance Work.One of the most important aspects of this change is that I have simply learned how to better balance work, life, and branch projects. I know that I have to do branch projects every day, so I need to better manage the time. If I plan to go out at night and can only go home very late, I need to work for the branch project in the morning and before I start working for my main business Khan Academy. Similarly, if I am out, and I have not finished my work, it is very late, then I need to rush home to finish my work as soon as possible to avoid missing a day ). I need to point out that I found myself spending less time on hobbies, such as woodprinting.) but this is a reasonable price and I have to accept it.

External communication.It is good to communicate with the outside world about your new habits. My partner understands that everything has to be done, so there are activities that sometimes need to be adjusted accordingly. In this way, I can easily say, "Yes, we can go out, watch a movie, and so on. But I need to write code later ." My partner will understand me and take this into consideration when arranging activities.

How much code have I written?It is hard to believe that I have written so much code in the past few months. I have created several websites, rewritten some frameworks, and created a large number of node modules. I 've written so much code that sometimes I forget what I did-a few weeks ago, my work was a long memory. I am very happy to write so much code myself.

I think the change in this habit is a huge success. I hope I can keep this habit. At the same time, I try my best to recommend this strategy to other people who want to complete a large number of regional projects. Tell me whether this policy is valid or not for you. I hope to hear something interesting from you.

About the author

John Resig, the father of jQuery, is also the author of Pro Javascript Techniques and Secrets of the JavaScript Ninja. He is currently responsible for the development of Khan Academy.

Original Write Code Every Day

Translation SegmentFault

Related Article

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.