10 practical tips for programmers programming

 

Below are some simple tips and strategies I've learned on the job myself that I hope will be useful to you.

1. Rubber duck debugging method

I don’t know if you have such an experience. When you are describing the problem to others, you suddenly have an idea and come up with a solution? There is a scientific basis for this occurrence. Talking loudly allows our brains to reorganize problems. In this case, your chat partner is the "rubber duck". Everyone on the team should be proactive and willing to be each other's "rubber ducks." Sometimes, if you're lucky, your "rubber duck" might not be able to give effective advice.

2. Quick information feedback

Get feedback as soon as you write code. When you're like us at HubSpot and you're getting a lot of pull requests, make a small change, then open a PR right away to discuss the design and code. Talk to your "rubber duck" and ask them for advice. Know that iterating a prototype can be far more cost effective than correcting a finished product.

Some team structures may not initially require writing code. Because of the physical model, whiteboard design, etc., these costs are lower than the cost of deleting thousands of lines of code at once.

3. Do it end-to-end first

When we're solving problems and completing features, it's easy to get down to the nitty gritty. Here's a great way to get us to end-to-end as quickly as possible.

For example, let's say I need to set up a function on a web page that does some complex operation after the user clicks and stores the result in the server. Some children's shoes may think about it and study this operation method first. My approach is to first set up event handlers for user actions, simulate calculations with some fixed values, and then call the API to request data from the server. This way, we can test the system end-to-end without having to think about every specific detail first. At the same time, this fast feedback loop helps us iterate and write code faster. The design that comes out may not be perfect at first, but by seeing with our own eyes how the various components are combined, we will have a clearer understanding of the entire system and make the optimal design.

At HubSpot, we push features out before the product is finished, so we can do internal testing in time. This is a further development of this end-to-end concept.

4. Leave the computer at the right time

Sometimes when debugging, console.logging is everywhere, and the best way is to test the code. There are also times when you are racking your brains and trying to solve some complex designs and problems and can't do it, then you'd better leave for a while. Although this may sound a little weird, sometimes I do think about the crux of the problem in the toilet. My love, who is also a software engineer, once told me that when she falls asleep, she often has all kinds of whimsical ideas (sometimes she closes her eyes, and sometimes she dreams of all kinds of ideas). Take a nap, go for a walk, go to the toilet...you can, in short, leave the computer at the right time.

5. Automation

Effective developers automate many tedious processes. However, many people have long believed that automation can only save time, which is a very common misunderstanding. In fact, not only that, the biggest advantage of automation is that it allows your thoughts to gallop unhindered and move forward bravely in the direction of completing your goals.

For example, let's say I need to run a fairly complex SQL query frequently, and the process is really long, and I have to retype it every time. Of course I wouldn't do this stupidly, I would use a program like Alfred to save to the clipboard, or figure out a way to save some steps myself. For me, automation is a more positive work attitude.

6. Do-it-yourself, "food and clothing"

When we design new code, we all want to write perfect code and discover every abstraction. But as we work on designing new code, abstractions become distracting, no matter how obvious and easy to design. My approach is, instead of thinking about abstract concepts right away, simply copy some code mechanically as a prototype. This allows me to get started with new projects quickly, better than if I were just talking about it on paper, and the abstract divergence that I can do after that is much broader. Don't just copy, but clean up the code, or they'll quickly turn into a mess.

7. Exercise is important

Writing code doesn't actually burn a lot of calories, so we have to force ourselves to move. You can stretch from time to time and walk around regularly. At HubSpot, we have a club where I go to the gym three days a week before lunch. Also, my habit is to do a few push-ups every hour or so to stretch the muscles and stay active.

I used to have shoulder pain and back pain from sitting for a long time, but since the advent of the standing table, these are all history. If you also have troubles in this area, you may wish to try this method, which works quickly and has good results. HubSpot provides us with electric desks that can be converted between standing and sitting. Of course, a table like $1,000 might be a luxury if you keep it at home, so I bought a second-hand one online for $40.

8. Read the previous article

Reading other people's documentation, technical articles, and code often drives me nuts. In order not to scratch your ears, scratch your cheeks and beat your chest and feet in anger, you may wish to read the previous article first, in order to get more details. Concepts in programs are difficult to express in a linear fashion. Reading the previous article will give us a better idea of ​​what the article is and what the code is saying.

9. Take meticulous notes

Some less organized developers might scoff at this trick. Any idea how I do it? I keep a detailed record of what I did each day, the problems I encountered, and how I solved them. Then, when I encounter a similar problem again, I will no longer be able to "hold the palm of my hand and look at my tears, and I will be speechless". These notes have become an invaluable asset to me because I can apply my previous experience and wisdom to solve current problems. And if I encounter a 1-on-1 performance appraisal, I can quickly think of my contribution to the company and my achievements.

10. Make a plan for the next day

Either before I get home from get off work or before I go to bed at night, I keep a to-do list in my notebook for the next day. That way, when the day came, I had a clear purpose, knew what I was going to do, focused, focused, and moved toward the goal. You know, this method allows me to complete tasks faster and with higher quality so that I have more time to rest.

Translation link: http://www.codeceo.com/article/10-coding-skills.html
English original text: 10 Practical Tips for Software Engineers
Translation author: Code Farm Network – Xiaofeng

Wechat QR code

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327019325&siteId=291194637