Be a lazy programmer

Source: Internet
Author: User

This article is written to all the cute programmers. (I) You are a group of cute thinkers who build the world with both hands.

From today on, I want to be a lazy programmer.

First drop the mouse

Today, I will drop the mouse.

The mouse is the root cause of the mouse hand. countless programmers are troubled by the mouse hand, which seems to have become a patent for programmers. We developed a "bad habit" one by one. For example, we abuse the right mouse button to refresh and like to mark the section being read with mouse labels when reading the document. These unconventional uses cause serious diseases to our hands. I don't know, so we can continue to see if we can touch our wife's face when our teeth are lost.

Therefore, I want to reject the temptation of the mouse from the following aspects: (although sometimes it is really convenient)

1. I want to start using Emacs or Vim

Emacs and Vim are the coders! If I spend a little time learning it, I will benefit my life even if I am not a programmer. Because it is also a tool for editing ordinary people.

I used to be an Emacs user and later transferred to vim. To put it bluntly, playing with Emacs or Vim is a process of enjoyment, because you can inadvertently discover one interesting usage after another.

If you are still obsessed with notepad ++ editors, look at this Wiki: Comparison of text editors. Why don't you choose it?

2. I want to use a keyboard to browse the webpage.

After learning Emacs or vim, I began to want to use this efficient usage on Web pages. After all, this will take most of my time.

For Vim, you can choose vimperator (Firefox) or vimium (chrome)

For Emacs, you can choose firemacs (Firefox) or edit with Emacs (chrome)

3. I want to use the keyboard for the operating system

I want to use more convenient tools to help me manage the system:

I want to use autohotkey to repeat the work with one click.

I want to use totoal commander to make system file management easy and efficient.

I want to learn more shortcut keys, including common win + R commands and Outlook shortcut keys, so that these operations that can only be slowly moved to quick keyboard operations.

Second, less keyboard or even less screen viewing

The mouse is used less, but the keyboard is used more. This is not enough.

1. I will spend more time reading paper books than PDF books.

Reading paper books is based on two points:

First, we may have Twitter, Sina Weibo, QQ, and reading in front of the computer may make us feel distracted.

Second, reading paper books will be more concentrated, and the combination of touch and vision will make us more memorable.

2. I will spend more time communicating and thinking.

I will spare more time for thinking, not getting bored with my computer. I will spend more time thinking about life, design, and even what I'm thinking about.

Third, write less code

1. Build your own code library

All the code I have written must be saved, thought twice, modified, and made common code as much as possible.

When encountering all the code that I have not written, I need to capture the most independent code segment, algorithm segment, think twice, modify it, and turn it into a common code.

I want to save all the code I have thought about and put it in my code library. If you encounter a problem, check whether my code library is in it? If you have any, you can use it directly or modify it and use it again. If you have not, you can write it again. Of course, these newly implemented codes will enter my code library again. Since then, many similar problems have become more difficult for me because I am familiar with my code, just as I am familiar with my own body.

Because I admit:

1. My memory is limited. It cannot always remember all the details.

2. Recreating a wheel is a terrible thing, unless I can make it better than others.

2. Let the code be generated by yourself

The simplest code generation is non-logical generation. For example, Li xianjing once gave an example:

A problem occurred a few days ago. to define a set of macros, the format is as follows:

Keymap (gdk_op_left, gdk_f12, diks_f12)

Keymap (gdk_op_right, gdk_f13, diks_f13 ),

...

There are more than 30 rows. The op_left In the first column is a custom button, which is the result of our discussion. Put it in a table and manually convert the table into the above macros, it's not hard to take much time, but such monotonous things are prone to errors, especially for me who are so careless. So I decided to use awk to do the following:

Awk 'in in {I = 4} {print "keymap (gdk _" $1 ", gdk_f" I ", diks_f" I ")"; I ++} 'keys.txt

This is the code generator! Just one line of code. It produces over 30 lines of code. In fact, I often use such a code generator, which saves me a lot of time and reduces the possibility of errors. Therefore, you can use a script to compile a language such as C/C ++.

Complex code generation is logical generation. For such an article, refer to: Introduction to code generation

Fourth, do not debug the program

I want to write a program with a rigorous attitude. I want to pursue the ultimate in coding just like the ultimate in art. Although we know that there are too many programmers in the world, they are far better than us. But this does not prevent us from surpassing them.

I want to be familiar with my code like I am familiar with my own body, and be familiar with every misunderstanding and every loophole in my thinking. I want to write elegant and elegant code, instead of relying on debugging tools to find out the problem.

I want to make good use of my eyes to accept every piece of code, and I want to make good use of my brain to simulate every piece of code. My thinking will debug a statement for me, whether it is a null pointer or memory leakage. My eyes will find every syntactic error for me, whether careless or careless. (For more information, see Li xianjing's blog: programmer's growth plan, thinking like a machine, 1, 2, 3)

After writing a piece of code, I won't be eager to run it. Looking at its effect, I will spend 10 minutes checking my code until I confirm, or "think" is Bug 0.

From today on, as a lazy programmer, although I know this road is hard to go, it does not hinder my enthusiasm. Because I know that one day, I will become more lazy than those who can only look up at me now.

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.