From f39cf7be41a4c781fdcc71b5bc86b16764241d4f Mon Sep 17 00:00:00 2001 From: Svetlin Nakov Date: Wed, 25 Oct 2017 10:33:26 +0300 Subject: Improved the "Naming" section Improved the "Naming" section. Added naming examples. Improved consistency. --- docs/style-guide.rst | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/docs/style-guide.rst b/docs/style-guide.rst index 0742d2e9..ee2be23e 100644 --- a/docs/style-guide.rst +++ b/docs/style-guide.rst @@ -696,49 +696,51 @@ indistinguishable from the numerals one and zero. Contract and Library Names ========================== -Contracts and libraries should be named using the CapWords style. +Contracts and libraries should be named using the CapWords style. Examples: ``SimpleToken``, ``SmartBank``, ``CertificateHashRepository``, ``Player``. -Events -====== +Event Names +=========== -Events should be named using the CapWords style. +Events should be named using the CapWords style. Examples: ``Deposit``, ``Transfer``, ``Approval``, ``BeforeTransfer``, ``AfterTransfer``. Function Names ============== -Functions should use mixedCase. +Functions should use mixedCase. Examples: ``getBalance``, ``transfer``, ``verifyOwner``, ``addMember``, ``changeOwner``. -Function Arguments -================== +Function Arguments Names +======================== + +Function arguments should use mixedCase. Examples: ``initialSupply``, ``account``, ``recipientAddress``, ``senderAddress``, ``newOwner``. When writing library functions that operate on a custom struct, the struct should be the first argument and should always be named ``self``. -Local and State Variables -========================= +Local and State Variables Names +=============================== -Use mixedCase. +Use mixedCase. Examples: ``totalSupply``, ``remainingSupply``, ``balancesOf``, ``creatorAddress``, ``isPreSale``, ``tokenExchangeRate``. Constants ========= Constants should be named with all capital letters with underscores separating -words. (for example:``MAX_BLOCKS``) +words. Examples: ``MAX_BLOCKS``, `TOKEN_NAME`, ``TOKEN_TICKER``, ``CONTRACT_VERSION``. -Modifiers -========= +Modifier Names +============== -Use mixedCase. +Use mixedCase. Examples: ``onlyBy``, ``onlyAfter``, ``onlyDuringThePreSale``. -Avoiding Collisions -=================== +Avoiding Naming Collisions +========================== * ``single_trailing_underscore_`` -- cgit From 58778be567620a550210150f8616440b9a5dbd55 Mon Sep 17 00:00:00 2001 From: Svetlin Nakov Date: Wed, 25 Oct 2017 22:58:18 +0300 Subject: Fixed typos --- docs/style-guide.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/style-guide.rst b/docs/style-guide.rst index ee2be23e..66fae0c4 100644 --- a/docs/style-guide.rst +++ b/docs/style-guide.rst @@ -711,8 +711,8 @@ Function Names Functions should use mixedCase. Examples: ``getBalance``, ``transfer``, ``verifyOwner``, ``addMember``, ``changeOwner``. -Function Arguments Names -======================== +Function Argument Names +======================= Function arguments should use mixedCase. Examples: ``initialSupply``, ``account``, ``recipientAddress``, ``senderAddress``, ``newOwner``. @@ -720,8 +720,8 @@ When writing library functions that operate on a custom struct, the struct should be the first argument and should always be named ``self``. -Local and State Variables Names -=============================== +Local and State Variable Names +============================== Use mixedCase. Examples: ``totalSupply``, ``remainingSupply``, ``balancesOf``, ``creatorAddress``, ``isPreSale``, ``tokenExchangeRate``. -- cgit