Depends on how experienced the coders are.

I started annotating code mainly to remind myself what functions were for. In big coding projects at some point you need notes.Otherwise you have to figure out over and over what your code is actually for. When you work for big companies, it is often mandatory.

If not annotated,the source gets hard (and expensive) to maintain. If some other coder has to maintain your code and has to figure out what all the functions do, that costs days, even in a relative small project. A pro coder easily costs 100 an hour, 800 per day. If they have to spend three days figuring out what the functions do, that is 2400 dollars wasted, basically.

It takes (a little) more time when developing, but it pays off in the long run. Once you get used to doing it, you often use cut-and-paste standard templates and fill in the particular details. Takes 2 minutes per function.

And as said, it is often mandatory for professional coding jobs. If you want to work for big business, it is smart to develop the habit asap.

Solidity coding is still young, I noticed a lot of coders don't annotate, and it comes across as unprofessional. It has to become a standard in a coding culture at some point.

Apr 6, 2022, 2:21 PM
Wow, thank you very much for such an exhaustive answer.
Yea, it all makes sense, I should probably develop the habit to control myself better — once you develop the habit it's probably quite easy.
Another dumb question from me...
Am I correct in my understanding that I should virtually always use the OpenZeppelin SafeMath over the built-in Solidity arithmetic capablities?
Is there any realistic reason why I would want to fallback to the built-in arithmetics at all?
Is there any practical condition, where I would like NOT to control overflows/underflows and allow the panic to happen?
Prior to Solidity 0.8.0, arithmetic operations would always wrap in case of under- or overflow leading to widespread use of libraries that introduce additional checks.

Since Solidity 0.8.0, all arithmetic operations revert on over- and underflow by default, thus making the use of these libraries unnecessary.
https://docs.soliditylang.org/en/v0.8.13/control-structures.html
Found the answer by reading the docs more thoroughly. Answered my own question.

Not relevant anymore :)
Apr 6, 2022, 6:48 PM

© 2024 Draquery.com All rights reserved.