Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation comments to methods showing which units are returned #105

Open
Sword-Smith opened this issue May 24, 2019 · 1 comment

Comments

@Sword-Smith
Copy link
Collaborator

Sword-Smith commented May 24, 2019

When using for example the method ICoinService.GetBalance(), it would be nice to be able to read from the function description (formally: "documentation comments") which units a function returns. Is it satoshi or bitcoins? I believe it is bitcoins, like the RPC, but that ought to be appear from the documentation, in my opinion.

Feel free to assign this issue to me if you think it is a good idea.

@Sword-Smith Sword-Smith changed the title Add documentation comments to methods containing showing which units are returned Add documentation comments to methods showing which units are returned May 24, 2019
@moodmosaic
Copy link
Contributor

That's usually a good idea. So in your example, instead of a decimal we could return a user-defined type, e.g. btc or Bitcoin and then you'd have the information you want embedded in the types themselves instead of docs.

My concern with docs and comments is that they can easily become stale, outdated, etc.

Type-driven development is more common in languages like Haskell, F#, OCaml, etc. I'm not sure it's that's common in languages like Java or C#, see Primitive Obsession.

Happy to discuss further on this, but keep in mind that it'll be a massive effort to go through each and every interface member and add types/comments to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants