Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
umnikos9658yYes, there is a way:
1. Name your variables and functions in a way that explains what they do.
2. Abstract things by plitting your code into a a LOT of functions (you want around 5-15 lines of code per function) (you can call a previous functions in your new functions)
3. Add comments where you've done something that isn't quite obvious when you see it at first sight. -
CWins48088yUnderstanding code is harder than writing it. If you write as clever as you can, you will be too stupid to understand it later.
Code expresses what it does and how. Comments express what it is supposed to do and why.
When i comment, i think about how i would explain that part to someone else who does not know what i know, which is probably future-me. -
mundo0349118yOnly I you are at the same state of mind every time you see the code.
Or if your comment skills are top.
Is it possible to write code that my future self can understand?
undefined