onflow / cadence-style-guide

The Flow Team guide on how to write better Cadence code
https://onflow.org
The Unlicense
7 stars 1 forks source link

Create Cadence Style Guide #2

Open alilloig opened 2 years ago

alilloig commented 2 years ago

Context

Developers need better guidelines for how to write clean cadence code.

Definition of Done

Create a guide in the cadence section of the docs site that give recommendations for Cadence style

PR Review

Who is your Code Partner - @joshuahannan Who can provide external eyes - @satyamakgec

alilloig commented 2 years ago

@bluesign commented 6 days ago • I think few important coding style questions are:

When to use panic? When to return optional? How to label functions? Where to use _ ? When to use Struct vs Resource ? Where to use access(contract) vs pub ? How to link Resources correctly ? e.g. via multiple interface restrictions vs via multiple paths. I think when repo is live, we should make each item as PR, then discuss on each PR if needed. If we don't have opinion how it should be (more debatable), maybe we can start from an issue.