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

Docs: 80% of examples, 5% of tutorials, 15% of other docs. #3084

Open
moul opened this issue Nov 7, 2024 · 6 comments
Open

Docs: 80% of examples, 5% of tutorials, 15% of other docs. #3084

moul opened this issue Nov 7, 2024 · 6 comments
Assignees
Labels
📖 documentation Improvements or additions to documentation bounty help wanted Want to contribute? We recommend these issues.

Comments

@moul
Copy link
Member

moul commented Nov 7, 2024

As the title suggests, I propose changing our current focus on documentation. These percentages are arbitrary, and we don't need to target them precisely. However, they reflect my thoughts on "quantity" and the "time we spend."

Let's hold off on writing documentation until we have strong examples. Instead, we should focus on creating impactful examples that feature simple, concise, and well-documented source code. We need to choose variable names carefully to ensure that each example is understandable and useful on its own. Examples should serve as the main documentation, while the docs should act as a curated index of examples. We shouldn't have "grc20 tutorials"; instead, we should offer "getting started tutorials." It's unwise to encourage newcomers to write a grc20 token without a clear utility for it. If people want a token, they can create one using grc20factory. Writing a new contract for grc20 should be driven by plans for additional code that will utilize it. Please remove the "grc20 tutorial" entirely. Instead, create a curated list of "grc20 examples" in the docs/ folder.

This doesn't mean we shouldn't refactor the docs/ folder (#2953); we should do it, and we should do it right now. I just want to emphasize that we shouldn't consider docs/ as the primary place for code to exist. We should focus our "documenter brain" on writing good examples, then good comments in the code implementation, and creating clear unit tests, and providing good func ExampleXXX() to suggest usage. We should be able to provide a link to a contract folder as documentation without any additional information.

We should have only a minimal number of tutorials to help users get started with the tools, such as writing hello world and forum apps (possibly incorporating a grc20 token). After that, we should focus on creating well-titled, targeted examples and develop the habit of producing dedicated examples when we have new ideas or need to express concepts typically included in docs/.

Once we have the examples, we can begin drafting documentation in the docs/ folder that references and links to them.

Effective Gno should be a collection of the most famous and unusual habits on Gno, linking to examples whenever possible.

There is a bounty for those who produce high-quality examples with excellent coding standards. We can provide example folders that are sufficient for understanding. The KPI to measure is their "transformation" efficiency, which reflects how well people grasp the concepts thanks to the examples and how easy it was for them to do so.

I'm also looking for people who want to become full-time grantees to exclusively write simple dApps and packages with this "useful-as-documentation" spirit.

I believe it's better to have very small examples rather than one large one. However, it also makes sense to demonstrate some combinations. Ultimately, we should collectively maintain a meta-realm that incorporates several, if not all, well-known patterns together, like a r/demo/the-big-example. I think I started something like this, but I'm not sure if it was pushed or if it's still a draft PR.

@gfant
Copy link
Contributor

gfant commented Nov 8, 2024

Hi Moul, I would like to work on the idea of simple dApps. I have been working on the Shiken project, but seems like it's not a priority anymore and I would like to do something in GNO that provides value. What type of dApps are you thinking about? Are you thinking about also adding a tutorial on "how to do [dApp]" while doing the dApp to provide more documentation?

@leohhhn
Copy link
Contributor

leohhhn commented Nov 8, 2024

@gfant

The idea is to create example packages and realms that can be used by learners instead of "written" documentation; the example packages and realms should be well-written & well-tested, and they should showcase the capabilities of Gno. These packages/apps should be easy/relatively easy to understand by people reading them.

Here's a random example that comes to mind - how can closures be used in Gno? There currently exists very few examples of this.
I also think that many people (especially developers from other web3 ecosystem, ie people coming from Solidity) don't have much idea what closures are and how they can be used.

@moul
Copy link
Member Author

moul commented Nov 8, 2024

It can be feature-driven, where the dApp is titled based on its features. As suggested by @leohhhn, we could create a r/docs/closure that includes simple, well-documented code. This would demonstrate not only how to write the code but also how to use it. If possible, it could be interactive, incorporating a Render function and some potential gnokey interactions.

Alternatively, it can be more product-expectation-driven, such as "r/demo/minidex", "r/demo/subscription", "r/demo/memberarea", "r/demo/nft-swap", etc.

@gfant
Copy link
Contributor

gfant commented Nov 9, 2024

So, for example, if I want to show the usage of an avl.Tree in gno, I could write a realm for a waitlist realm/package with a register function, a check if registered, a remove, etc that could be used in other realms and would show all the things an avl.Tree can do?

I would like to know which are the things that are more relevant to start with. Currently the /docs folder contains many things that aren't related to writing examples with realms, as how @moul stated in his first comment.

@moul
Copy link
Member Author

moul commented Nov 19, 2024

#3160

leohhhn pushed a commit that referenced this issue Nov 20, 2024
Introducing the `r/docs` namespace, where the homepage currently lists
subrealms manually. In the future, we may implement a registry, but for
now, we’re keeping the source code as lean as possible. The namespace
includes several interactive examples to guide users through key
concepts.

The `r/docs/hello` example provides a simple Render function and invites
users to click on "view source" to understand the basics of
customization. The `r/docs/avl_pager` example demonstrates path-based
interactions, allowing users to explore an avl tree structure with
pagination links to navigate between items. Users are encouraged to
click on these links for inspiration before manually adjusting
parameters in the URL. The added `r/docs/add` example introduces
interactivity through transactions, allowing users to adjust a number by
submitting transactions, and see the updated result with each
interaction.

These examples are designed to engage users with Render-based UI
interactions, path handling, and transaction-based updates. Once we have
more content in r/docs, this section could serve as the main
documentation link in the navbar, providing a comprehensive, hands-on
introduction to Gno.

Addresses #3084 
Addresses
gnolang/docs-v2#27 (comment)
Addresses #2953

---------

Signed-off-by: moul <[email protected]>
leohhhn added a commit that referenced this issue Nov 21, 2024
<!-- please provide a detailed description of the changes made in this
pull request. -->

## Description

Related to #3084

Adds a realm that teaches the user about the source code viewer in
`gnoweb`.

It also adds a `r/` root README.

<details><summary>Contributors' checklist...</summary>

- [x] Added new tests, or not needed, or not feasible
- [x] Provided an example (e.g. screenshot) to aid review or the PR is
self-explanatory
- [x] Updated the official documentation or not needed
- [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message
was included in the description
- [x] Added references to related issues and PRs
- [x] Provided any useful hints for running manual tests
</details>

---------

Co-authored-by: Morgan <[email protected]>
@moul
Copy link
Member Author

moul commented Dec 6, 2024

Meta issue with suggestions: #3292

r3v4s pushed a commit to gnoswap-labs/gno that referenced this issue Dec 10, 2024
Introducing the `r/docs` namespace, where the homepage currently lists
subrealms manually. In the future, we may implement a registry, but for
now, we’re keeping the source code as lean as possible. The namespace
includes several interactive examples to guide users through key
concepts.

The `r/docs/hello` example provides a simple Render function and invites
users to click on "view source" to understand the basics of
customization. The `r/docs/avl_pager` example demonstrates path-based
interactions, allowing users to explore an avl tree structure with
pagination links to navigate between items. Users are encouraged to
click on these links for inspiration before manually adjusting
parameters in the URL. The added `r/docs/add` example introduces
interactivity through transactions, allowing users to adjust a number by
submitting transactions, and see the updated result with each
interaction.

These examples are designed to engage users with Render-based UI
interactions, path handling, and transaction-based updates. Once we have
more content in r/docs, this section could serve as the main
documentation link in the navbar, providing a comprehensive, hands-on
introduction to Gno.

Addresses gnolang#3084 
Addresses
https://github.com/gnolang/docs-v2/pull/27#discussion_r1848481556
Addresses gnolang#2953

---------

Signed-off-by: moul <[email protected]>
r3v4s pushed a commit to gnoswap-labs/gno that referenced this issue Dec 10, 2024
<!-- please provide a detailed description of the changes made in this
pull request. -->

## Description

Related to gnolang#3084

Adds a realm that teaches the user about the source code viewer in
`gnoweb`.

It also adds a `r/` root README.

<details><summary>Contributors' checklist...</summary>

- [x] Added new tests, or not needed, or not feasible
- [x] Provided an example (e.g. screenshot) to aid review or the PR is
self-explanatory
- [x] Updated the official documentation or not needed
- [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message
was included in the description
- [x] Added references to related issues and PRs
- [x] Provided any useful hints for running manual tests
</details>

---------

Co-authored-by: Morgan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📖 documentation Improvements or additions to documentation bounty help wanted Want to contribute? We recommend these issues.
Projects
Status: 📥 Inbox
Status: Triage
Development

No branches or pull requests

3 participants