Please add comments to example code

Acuario

Member
Licensed User
Longtime User
Starting out with a blank B4XPages project I tried to understand what the subs were doing. It took some forum help to realize they were mostly being called by the core code, the workings of B4X. That may be explained somewhere but not in anything I have read. A simple comment indicating which subs are called by the the core code and not the code you have written would help the newcomer. In fact unless it is really obvious a simple comment saying what any sub does is really helpful.

I know exactly what you mean. I ended up creating a flow chart to explain what was going on and what was calling what and when to try to demystify what was happening. I don't know if it got into the booklets but it's here if it's of interest.
 

Roger Daley

Well-Known Member
Licensed User
Longtime User
We are all very grateful to all those who post examples and small bits of code but please could I ask that you add plenty of comments, far more than you would think were required.

What is completely obvious to you is a complete mystery to others. Also whatever your code is demonstrating please avoid clever and complicated ways of doing stuff unless that is what the actual example is. It just makes it more difficult for beginners (me) to understand.
I agree strongly. Also writing an explanation often enables the writer to better understand their own code.
 
Top