Programming
-
It is okay to do competitive programming as long as it motivates you.
-
Programming is like writing. Programming is a creative activity.
-
Do your own project. Write your technical blog. Program for a project that you will maintain for years, just like maintaining a 10-year-long blog.
-
Usually, you do not need to pursue what’s hot in technology now, as many trends will fade after a few years.
-
Pursue your curiosity and program for your own sake.
-
Try to create programs for yourself. They are not work assignments.
-
If you feel unhappy often when programming, then you are doing it the wrong way.
-
iOS, Android, Backend, Frontend, AI are all good. One can at least try to make a small project using them or learn about them for a few months.
-
Debugging is about being suspicious. Do not trust every line of your code; you can think of a better way to do it.
-
In programming, even a character or a line of log is important. They tell you something.
-
Using programming makes products for others to use. It is interesting to have users.
-
You do not need to be harsh. A few hundred users really loving your product is better than tens of thousands of users who just kindly like your product.
-
Remember why you got into programming and never forget it.
-
Apply knowledge in programming to every aspect of life. They are the same. Doing things in batches or one by one. How to separate jobs into units. The underlying tech behind every app. The nuanced details behind network requests.
-
The abstraction and logical thinking. The detail-oriented thinking. The thinking out of every solution.
-
Truth is truth. Usually, the computer won’t be wrong. The electric circuit won’t be wrong. The compiler won’t be wrong. Don’t feel upset when there is a bug.
-
Pursue elegant and simple solutions. Simplicity is the ultimate sophistication. You need to think hard to leave what’s essential and remove what’s extra.
-
For programming languages, the languages that get the work done are okay. I personally recommend Java and Python.
-
Follow Yin Wang at https://www.yinwang.org. He is one of the few geniuses in programming, though he says geniuses never exist.
-
The knowledge and principles of programming can be easily applied to language learning, hardware repairing, life hacking, and scientific researching.
-
For most programming tasks, you don’t need fancy math besides high school math.
-
Reflect on your old code after years or maintain a code project for a long time. It will teach you a lot.
-
If you lose your passion for programming, just do other things for some time.
-
The timing of testing is important. Just do it naturally. You often don’t need to write tests for your project. Try not to write tests, write unit tests, write integration tests, write API tests. Compare them wisely.
-
Try AI code editors. Use ChatGPT or other chatbots often. As AI tools are easy to use now, you can focus on more creative or important parts.
-
When debugging, check if you’re using the latest version of libraries. If a library is unmaintained, look for actively maintained clones or forks.
-
When improving something like network speed or program running time, there must be a quantitative metric. Otherwise, you won’t know exactly if there was a trivial improvement or degradation.
-
For personal projects, it’s okay not to write test code, but it’s better to do local testing after changing a significant amount of code. Consider the affected code, how long it will run in the cloud pipeline, and how frequently it might lead to errors, and then write test code accordingly. Use methods that allow for easy testing without negatively impacting user experience.
-
Write simple and elegant code. Minimize duplication, although sometimes duplication leads to a simpler solution. Minimize special cases. Make it easy to test. Refactor to use common functions or processes, use recursion or loops, and look for patterns.
-
Handle errors properly. Think about the root cause, the responsibility, and whether we can change it or if it is an external error. Consider the rescue method, the impact scope, where to handle it, whether we should categorize errors, how likely it is to happen, and the worst-case scenarios.
-
The difference between using replace or using startWith followed by slice is that the former disregards the string’s position. Apply similar thinking to every detail of programming.
-
Minimize the possible values for one item; use just one value for one case. Do not use null if we already have false. If we have a translated true or false flag, we need to ensure that every time we have a translated flag, we do not treat the non-existence of a translated flag as false.
-
Use GitHub or Sourcetree to review changed code blocks frequently. They are more convenient for reading code.
-
In programming, there are often no trivial things. Every character, the order of list items, every string, every number, and every variable name matter. Every execution order and every log matter.
-
Do the things that excite you the most. There’s no need to worry about not following the mainstream.