PLS DONOT LEAVE SHIT FOR NEXT CODING!
I found many bugs by code review in the process of testing server projects (coding by Go/Php/Java).
Here I only show the typical bugs by python demo.
Bad:
1 | # badcode demo |
Fix:
1 | # how to fix |
It`s easy to find the redundant query in the demo code, real project is more complex than demo. But complex is not the reason to coding easy and casual.
Bad:
1 | # badcode demo |
Fix:
1 | # how to fix |
I found at least 3 times in projects. Pls use i/o with care.
Bad:
1 | # badcode demo |
Bad:
1 | # badcode demo |
The bug is real happend in project. And in most cases, developers make this bug is adding functions in service which was coded by another.
Data Not Consistent: The data in DB and Redis is not consistent;
Miss error from downstream service;
Keep useless code making service more and more mussy;