Code optimization and code optimization
In my personal summary, I wrote my blog for the first time. I just want to find a place to record my thoughts and learning experiences.
After more than six months of work, I wrote a complicated game scenario. At that time, I was in a short time. I thought about what functions I could add directly without thinking about. When I finished writing it, I checked that there were 200 or 300 rows of header files in the slot. The naming rules are not detailed for the moment. How can this problem be solved?
The Code repetition is even more messy. Some places have different characters in four or five or eight lines. I can't see it anymore. The code with repeated features is here a copy and paste, where a copy and paste. If else writes 7 or 8 in succession !! I don't know what it means if there are many variables !!
When you want to change the file, you need to change all the items you want to use. Otherwise, you must use Ctrl + Shift + F to replace the current document !!!
This is the first time I feel that the code is really inflated. It's terrible !!!
When you submit code to the header, you don't need to think about it. Please optimize it for me. "I cannot understand your code"
Several XXX1 (), XXX2 (), XXX3 (), and XXX4 () functions like this are terrible now. member variables of the class XXX1, XXX2, XXX3, XXX4, and XXX5 are even more crashing!
The last 1500 lines of code were optimized to 700 lines !!!
Heaven! Earth!
I used to read some articles about code optimization and refactoring.
Think about it now ------ practice is really a good lesson for me !!!
1,
2. Some variables in the header file:
3. if else:
4. functions:
5. There are four similar code segments: