Skip to content

Commit eabaa85

Browse files
committed
Update README.md
1 parent eac5176 commit eabaa85

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ Note that inheritance is (by itself) usually not a good reason to use classes, b
1818

1919
Rationale: Value types are simpler, easier to reason about, and behave as expected with the let keyword.
2020

21+
####When specifying a type, always associate the colon with the identifier
22+
23+
24+
class SmallBatchSustainableFairtrade: Coffee { ... }
25+
26+
let timeToCoffee: NSTimeInterval = 2
27+
28+
func makeCoffee(type: CoffeeType) -> Coffee { ... }
2129

2230

2331
###Constants and Variables
@@ -111,9 +119,12 @@ func variablesToFunctions() { ... }
111119

112120
### Keep methods small
113121

114-
It is usually a good ideea to split large functions into smaller ones. Prefer small concise functions over smaller ones.
122+
It is usually a good ideea to split large functions into smaller ones. Prefer small concise functions over smaller ones.
123+
115124
Whenever you have a large function it can usually be split up into two more atomic functions.
116125

126+
A good rule of thumb is that any function which exceeds 15 lines of code is doing at least 2 different things. Exceptions to this rule are factory methods / methods which perform a big switch / methods which do one then more than 15 times.
127+
117128

118129
### Number of parameters
119130
Avoid creating methods with too many parameters. The ARM v6/v7/64 architectures allow for 3,5 and 7 parameters to be passed to a function via registers(fast storage), and following parameters are sent through RAM(slow storage). So remember, if you go beyond 3 parameters, you are not only making your method slower by using slower memory, you're also making it harder to read.

0 commit comments

Comments
 (0)