Way to be pro

This is gonna be a live update post. All the experience I acquired in order to become a *professional* programmer are listed here. This will be a reminder for me, and hope it is somewhat useful to you 😀



1. Be aware of coding convention used in the file

What’s the difference between the following two chunks of code?

if (block_buf > REQUESTS_BLOCK_BUF_MAX){

my_requests_block_buf = REQUESTS_BLOCK_BUF_MAX;

} else {

my_requests_block_buf = block_buf;


if (block_buf > REQUESTS_BLOCK_BUF_MAX)


my_requests_block_buf = REQUESTS_BLOCK_BUF_MAX;




my_requests_block_buf = block_buf;


I guess you would say they are literally the same. In fact, that was what I thought initially, and I chose to write the code like the first one. However, in the code review, this chunk of code is commented by reviewer “Note the coding convention in the file.” Then I realized with more than 3,000 lines of code, all the condition structure is following the second one I listed above. So, consistency in style is really the key in professional programming.

2. Don’t add redundant debug statement

Following the code chunk I added above, it is probably natural to add a printout statement to see if my_requests_block_buf is actually set to the right value. So, I added:


However, this statement may not be OK in the professional setting. There is a clear cutline between what can include in development phase and what should include in actual product. The debug statement is OK for development phase: developer need to immediately make sure everything work correctly so far before moving on to next part, and this is exactly the incremental development philosophy. But, once developer are pretty sure the value he get is correct, he need to delete the debug statement. With excessive debug statements, the performance of product hurts. 

3. Treat comment as serious as code

I developed a bad habit to joke around in the comment during the college, and I somewhat carry it out to the real job. This is one of the comments I wrote in my recent work:

// cheat on initialize_server() function

If this comment appears in a hobby project or the project that shared with limited people, it will be fine. However, it might not be appropriate when comes to real business. And, this comment is essentially useless: why named “OLD”? What do you mean by “cheating”? My fellow developers will have no clue what I am trying to convey here.







Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s