|
|
|
|
|
by TheJoeMan
616 days ago
|
|
This is good advice! I would like to propose a corollary: If your main API function has multiple parameters, in the documentation example you need to use all of them, and absolutely do not shadow the parameter names!
“foo foo = foo” might make your demo look slick, but the developer learns nothing. This is a lost opportunity to explain the parameters with the variable name instead of a comment. I’ll give an example: RevenueCat’s demo for using SyncPurchases [1] returns a tuple of (value, error), and they throw away the error, not even showing the 1 line of how you have to typecast it. This results in much digging needed. [1] https://www.revenuecat.com/docs/getting-started/quickstart#4... |
|
I hate those. I always make an effort to avoid using the same name for different things, e.g. MyParamName=MyValue indicates clearly that the two concepts are different and can be independently customized.