yfractal / blog

10 stars 0 forks source link

How to code #16

Open yfractal opened 3 months ago

yfractal commented 3 months ago

I love coding, and even though I have a decade of programming experience, I still think programming is hard. It's not a natural thing for me.

However, there are several methods that can make coding more efficient, such as taking baby steps or reading error messages. Sometimes I forget these and waste a ton of time.

This article is a reminder for me, and I hope it can help you too.

yfractal commented 3 months ago

General Methods

  1. Have a clear goal A clear goal helps you determine what you should do and what you should not do, and it can prevent people from running in circles.
  2. Build a runnable example A runnable example allows you to experiment and explore the code in small steps.
  3. Take baby steps Can you change the example a little bit? What's your expected result? Is your expectation correct? Whenever you don't know what to do, taking baby steps is always the right choice.
  4. Read error output carefully Most software provides human-friendly error output that gives you relevant information. Try to understand it; you can let ChatGPT explain it to you, but make sure you understand it because you are the one learning programming, not the AI.
  5. Have patience People tend to be nervous when things do not meet their expectations. But when people are too nervous, they can't think clearly and may overlook obvious evidence, such as ignoring error output that clearly tells how to fix the issue.
  6. Make a summary Does it make sense to you? Is it clear? Do you need to add some comments, or do you need to do some refactoring? What have you learned? Do you need to take some notes?