Today I tried a way to write Solidity contracts, how exactly to do it?
- Divide the task into small segments.
- Describe what each segment does in words.
- Then ask AI, and with one sentence from AI's answer, write a function.
- Test immediately with code, and the test code can also be generated.
- After testing, one function is completed, with minimal errors.
- Then move on to the next segment.
The benefits of doing this are:
- Clear thinking.
- It is unlikely to make mistakes in small segments, and they can always be used.
- Fewer errors in each small segment, resulting in fewer errors overall.
- Progress may not seem fast, but it actually is.
- Each time is focused, solving problems each time, gradually deepening understanding.
I will continue to use this method. It has been a while since I looked at some contract code and I found that the threshold for smart contracts has increased again. It is becoming more and more difficult, mainly because:
- I am not yet familiar enough with Solidity, and there are some special uses that I am not familiar with.
- Contracts have high quality requirements.
- There are more and more calls between contracts, and each contract has many methods. It takes time to understand different contracts.
- The business of contracts itself is complex and not easy to understand.
- Development is fast, but not in China. The threshold may gradually increase.
The ultimate idea is that everything needs continuous tracking. If you don't continue, it will become increasingly difficult to catch up.