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 "why Cadence" section to Cadence docs #2039

Merged
merged 2 commits into from
Oct 24, 2022
Merged

Conversation

j1010001
Copy link
Member

@j1010001 j1010001 commented Oct 6, 2022

Description

Adding section to the docs on why should devs use Cadence. The 4th top-level tile is added in #2040.


  • Targeted PR against master branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work
  • Code follows the standards mentioned here
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

added line breaks to the first paragraph
@j1010001 j1010001 added the Documentation Improvements or additions to documentation label Oct 6, 2022
@j1010001
Copy link
Member Author

j1010001 commented Oct 6, 2022

blocking #2040

@@ -0,0 +1,16 @@
## Why should you use Cadence for building smart contracts ?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Why should you use Cadence for building smart contracts ?
---
title: Why Use Cadence?
---
## Why should you use Cadence for building smart contracts ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to use the more descriptive title, the reasons are revolving around the benefits specifically for smart-contract development.

@j1010001 j1010001 changed the title Create why-cadence.md Add "why Cadence" section to Cadence docs Oct 6, 2022
@codecov
Copy link

codecov bot commented Oct 6, 2022

Codecov Report

Merging #2039 (0430f28) into master (0c5d3e5) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #2039   +/-   ##
=======================================
  Coverage   77.61%   77.61%           
=======================================
  Files         303      303           
  Lines       63164    63164           
=======================================
  Hits        49024    49024           
  Misses      12394    12394           
  Partials     1746     1746           
Flag Coverage Δ
unittests 77.61% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@github-actions
Copy link

github-actions bot commented Oct 6, 2022

Cadence Benchstat comparison

This branch with compared with the base branch onflow:master commit 0c5d3e5
The command for i in {1..N}; do go test ./... -run=XXX -bench=. -benchmem -shuffle=on; done was used.
Bench tests were run a total of 7 times on each branch.

Collapsed results for better readability

old.txtnew.txt
time/opdelta
CheckContractInterfaceFungibleTokenConformance-2120µs ± 1%120µs ± 0%~(p=0.485 n=6+6)
ContractInterfaceFungibleToken-241.7µs ± 1%43.2µs ± 9%~(p=0.234 n=6+7)
InterpretRecursionFib-22.37ms ± 2%2.38ms ± 1%~(p=0.945 n=6+7)
NewInterpreter/new_interpreter-21.22µs ± 1%1.23µs ± 1%~(p=0.603 n=6+7)
NewInterpreter/new_sub-interpreter-2695ns ± 7%679ns ± 1%~(p=0.778 n=7+7)
ParseArray-28.27ms ± 1%8.30ms ± 1%~(p=0.310 n=6+6)
ParseDeploy/byte_array-212.5ms ± 1%12.9ms ± 5%~(p=0.097 n=7+7)
ParseDeploy/decode_hex-21.22ms ± 1%1.22ms ± 1%~(p=0.620 n=7+7)
ParseFungibleToken/With_memory_metering-2193µs ± 3%193µs ± 2%~(p=0.805 n=7+7)
ParseFungibleToken/Without_memory_metering-2153µs ± 1%153µs ± 0%~(p=0.234 n=7+6)
ParseInfix-27.23µs ± 0%7.27µs ± 1%~(p=0.068 n=7+6)
QualifiedIdentifierCreation/One_level-22.35ns ± 0%2.35ns ± 0%−0.10%(p=0.045 n=7+6)
QualifiedIdentifierCreation/Three_levels-2138ns ± 0%138ns ± 0%~(p=0.143 n=7+6)
RuntimeFungibleTokenTransfer-2579µs ±23%579µs ±27%~(p=0.456 n=7+7)
RuntimeResourceDictionaryValues-25.27ms ± 2%5.31ms ± 2%~(p=0.318 n=7+7)
RuntimeScriptNoop-217.6µs ±33%19.2µs ±28%~(p=0.128 n=7+7)
ValueIsSubtypeOfSemaType-291.6ns ± 1%91.9ns ± 1%~(p=0.445 n=7+6)
 
alloc/opdelta
CheckContractInterfaceFungibleTokenConformance-251.0kB ± 0%51.0kB ± 0%+0.00%(p=0.033 n=6+7)
ContractInterfaceFungibleToken-224.2kB ± 0%24.2kB ± 0%~(all equal)
InterpretRecursionFib-21.00MB ± 0%1.00MB ± 0%~(p=1.000 n=7+7)
NewInterpreter/new_interpreter-2848B ± 0%848B ± 0%~(all equal)
NewInterpreter/new_sub-interpreter-2264B ± 0%264B ± 0%~(all equal)
ParseArray-22.75MB ± 3%2.68MB ± 2%−2.42%(p=0.038 n=7+7)
ParseDeploy/byte_array-24.16MB ± 3%4.24MB ± 3%~(p=0.334 n=7+7)
ParseDeploy/decode_hex-2214kB ± 0%214kB ± 0%~(p=0.727 n=7+7)
ParseFungibleToken/With_memory_metering-229.4kB ± 0%29.4kB ± 0%~(p=0.234 n=7+7)
ParseFungibleToken/Without_memory_metering-229.4kB ± 0%29.4kB ± 0%~(p=1.000 n=5+5)
ParseInfix-21.93kB ± 0%1.93kB ± 0%~(p=0.683 n=7+7)
QualifiedIdentifierCreation/One_level-20.00B 0.00B ~(all equal)
QualifiedIdentifierCreation/Three_levels-264.0B ± 0%64.0B ± 0%~(all equal)
RuntimeFungibleTokenTransfer-2102kB ± 1%103kB ± 1%~(p=0.836 n=6+7)
RuntimeResourceDictionaryValues-22.27MB ± 0%2.27MB ± 0%~(p=1.000 n=7+7)
RuntimeScriptNoop-28.94kB ± 2%8.82kB ± 1%−1.35%(p=0.038 n=7+7)
ValueIsSubtypeOfSemaType-248.0B ± 0%48.0B ± 0%~(all equal)
 
allocs/opdelta
CheckContractInterfaceFungibleTokenConformance-2915 ± 0%915 ± 0%~(all equal)
ContractInterfaceFungibleToken-2436 ± 0%436 ± 0%~(all equal)
InterpretRecursionFib-218.9k ± 0%18.9k ± 0%~(all equal)
NewInterpreter/new_interpreter-214.0 ± 0%14.0 ± 0%~(all equal)
NewInterpreter/new_sub-interpreter-25.00 ± 0%5.00 ± 0%~(all equal)
ParseArray-269.6k ± 0%69.6k ± 0%~(p=1.000 n=7+7)
ParseDeploy/byte_array-2104k ± 0%104k ± 0%~(p=1.000 n=7+7)
ParseDeploy/decode_hex-275.0 ± 0%75.0 ± 0%~(all equal)
ParseFungibleToken/With_memory_metering-21.00k ± 0%1.00k ± 0%~(all equal)
ParseFungibleToken/Without_memory_metering-21.00k ± 0%1.00k ± 0%~(all equal)
ParseInfix-260.0 ± 0%60.0 ± 0%~(all equal)
QualifiedIdentifierCreation/One_level-20.00 0.00 ~(all equal)
QualifiedIdentifierCreation/Three_levels-22.00 ± 0%2.00 ± 0%~(all equal)
RuntimeFungibleTokenTransfer-22.06k ± 0%2.06k ± 0%~(all equal)
RuntimeResourceDictionaryValues-236.9k ± 0%36.9k ± 0%~(p=1.000 n=7+7)
RuntimeScriptNoop-2145 ± 0%145 ± 0%~(all equal)
ValueIsSubtypeOfSemaType-21.00 ± 0%1.00 ± 0%~(all equal)
 


### 2) Composability

Cadence enables composability. Resources (which are arbitrary user-defined data types) are stored directly in users’ accounts, and can flow freely between contracts: They can be passed as arguments to functions, returned from functions, or even combined in arbitrary data structures. This makes implementing business logic easier, more natural and promotes reuse of existing logic.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Cadence enables composability. Resources (which are arbitrary user-defined data types) are stored directly in users’ accounts, and can flow freely between contracts: They can be passed as arguments to functions, returned from functions, or even combined in arbitrary data structures. This makes implementing business logic easier, more natural and promotes reuse of existing logic.
Cadence enables composability. Resources (which are arbitrary user-defined data types) are stored directly in users’ accounts, and can flow freely between contracts: they can be passed as arguments to functions, returned from functions, or even stored in arbitrary data structures. This makes implementing business logic easier, and promotes reuse of existing logic.


### 3) **Simplicity**

Cadence’s syntax is inspired by popular modern general-purpose programming languages like **[Swift](https://developer.apple.com/swift/)**, **[Kotlin](https://kotlinlang.org/)**, and **[Rust](https://www.rust-lang.org/),** so developers will find the syntax and the semantics familiar.
Copy link
Contributor

@dreamsmasher dreamsmasher Oct 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Cadence’s syntax is inspired by popular modern general-purpose programming languages like **[Swift](https://developer.apple.com/swift/)**, **[Kotlin](https://kotlinlang.org/)**, and **[Rust](https://www.rust-lang.org/),** so developers will find the syntax and the semantics familiar.
Cadence’s feature set and language design are inspired by popular modern general-purpose programming languages like **[Swift](https://developer.apple.com/swift/)**, **[Kotlin](https://kotlinlang.org/)**, and **[Rust](https://www.rust-lang.org/),** so developers will find the syntax and semantics familiar.

@10thfloor 10thfloor merged commit 033d7a1 into master Oct 24, 2022
@turbolent turbolent deleted the jan-docs-why-cadence branch January 3, 2023 23:12
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants