+ 2
Is it normal to forget how your own code works?
I found mysfelf always forgot how my own code works afterwards : [
6 ответов
+ 3
What @Kirk Schafer is saying is best practice in coding. Your code should read like an article. Commenting all of your code is not a good way to go because it's nearly impossible to make sure those comments are appropriately updated when changes are made to the code. This creates a big problem for you and anyone that has to lay their eyes on the code later on. This can easily be an igniting factor for code rot, because as the comments are not being updated, developers will have to spend more time deciphering the code and if they don't have that time they will write sloppy code that will lead to bugs, all the while staring at comments that further confuse their understanding. This is not to say that comments don't have their place. They certainly do. Just be very mindful of where and how they're written. If you find that you may be writing too many comments, you should probably go back, review the code and figure out ways to make the code more descriptive.
With all of that said, it's easy to forget what your code does if you haven't looked at it in a while and if you're not taking the appropriate amount of time to work out smart solutions. If you're just slinging code that "works" and not devoting a practiced thought process to designing good code, it's easier to forget how it works.
Write clean, descriptive, well thought out solutions and you'll find it's easier to remember and know what your code is doing.
An industry standard resource for learning more about writing good code is Clean Code: A Handbook of Agile Software Craftsmanship by Robert Martin. Many companies consider this book required reading for new hires. I recommend it highly.
Clean Code: A Handbook of Agile Software Craftsmanship https://www.amazon.com/dp/0132350882/ref=cm_sw_r_cp_apa_dpFXzb233M1ZE
+ 5
That is why you should comment everything. See my code, if you want to see what I mean.
+ 4
Yes, comments. There's also a theory that code should self-document (variable names identify their purpose, etc)
+ 2
Don't try to memorize the code.
Just do coding practise everyday, you will hardly can forget your own code works.
+ 1
That's fine, but you should constantly practice questions and also revise your old codes. And you should also put more efforts to succeed, as success comes from hard word and determination.
+ 1
yes it's so normal to forgot how your code works. ever make comments on your code