Hi, want to get your opinion about documentation b...
# dokka
a
Hi, want to get your opinion about documentation best practices with multiplatform code. Do you document both expect/actual classes? If yes, do you document functions in expect/actual as well? Also, are there any common styling/best practices you are aware of? Note. By documenting, I mean kdoc.
z
I'm not sure how dokka handles it but I would put docs relevant to callers/consumers from all targets on the expect, otherwise you'd have to copy it to each actual.
a
Well, thats not just dokka specific question. It is more like a general best practice/convention. But since dokka support multiplatform doKKumentation and is an official JetBrains product, I thought it will be a good place to ask. Regarding your comment: When commenting only
expect
portion of the code, would dokka generate this comment for ALL actuals?
z
That's what I'm not sure about. I would hope so.
And in the ide when you view the docs for a call in a specific target source set (F1 or ctrl+j) I believe the docs from the expect will show up.
a
Sorry. My bad. Did not see that you mention that you are not sure how that is handled with dokka. Based on how
kotlinx.coroutines
documentation is structured - it looks like they have both expect and actual documented with platform specific comments. Also, comparing the output of dokkaHtml task with and without comments in actual , it looks like it is worth to comment all targets, as well as common. https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/index.html