Skip to content

Commit 8ea0ebb

Browse files
committed
Extend 'naming' and 'rationale'
1 parent 3953bdb commit 8ea0ebb

File tree

1 file changed

+68
-35
lines changed

1 file changed

+68
-35
lines changed

slides/function_signature_design/function_signature_design.md

Lines changed: 68 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -43,52 +43,58 @@ This presentation focuses on the tools and the thought process.
4343

4444
## Context
4545

46-
* Why do we have functions
47-
* Structured Programming
48-
* => a tool for the user
49-
* 'Structure' = divide and conquer
50-
* -> how fine? how coarse?
51-
* how evenly?
52-
<img src="http://www.rosslawinc.com/wp-content/uploads/2014/02/14B11-Stairs-1.jpg" style="width:200px"/>
46+
Q: Why do we have functions ?
5347

54-
--
48+
A: Structured Programming, divide and conquer
5549

56-
### Notation
50+
--
5751

58-
(TODO: find better name for 'our_function')
52+
### Why Functions
5953

60-
* No more ~~foo~~ and ~~bar~~
61-
* `ret_t our_function(arg_t)`
62-
* ```
63-
void client_code() {
64-
...
65-
auto x = our_function(a);
66-
...
67-
}```
54+
* As a reusable tool for the user
55+
* 'Structure' = divide and conquer
56+
* -> how fine? how coarse?
57+
* how evenly?
58+
<img src="http://www.rosslawinc.com/wp-content/uploads/2014/02/14B11-Stairs-1.jpg" style="width:200px"/>
6859

6960
--
7061

7162
## Rationale
7263

73-
* why bother?
74-
* readability/learnability/usability
75-
* who's the audience?
64+
why bother with the signature design?
65+
66+
* Goals
67+
* Audience
68+
* Constraints
69+
* Tools
7670

7771
--
7872

7973
### Goals of the Function Signature
8074

81-
* what is the essence of the function
82-
* easy to use
83-
* hard to get wrong
84-
* indicate some non-functional aspects:
85-
* sync/async
86-
* side effects
87-
* error handling indications
75+
Communication:
76+
77+
* Functional aspects
78+
* Non-functional aspects
8879

8980
--
9081

91-
### Communication Context
82+
#### Communication: Functional Aspects
83+
84+
* easy to use
85+
* hard to get wrong
86+
87+
--
88+
89+
#### Communication: Non-functional Aspects
90+
91+
* sync/async
92+
* side effects
93+
* error handling indications
94+
95+
--
96+
97+
#### Communication Context
9298

9399
Goals are served differently in different contexts
94100

@@ -111,15 +117,35 @@ Goals are served differently in different contexts
111117

112118
--
113119

114-
### Goal
120+
### Constraints
121+
122+
* Language
123+
* English?
124+
* C compatibility?
125+
* Time
126+
* design for change!
127+
* Knowledge
128+
* Of the audience
129+
* Of the maintaining devs
130+
131+
--
132+
133+
### Tools
134+
135+
To achieve this, we can use a number of tools
136+
137+
Tool = generic term here
138+
139+
--
140+
141+
### Rationale: Conclusion
115142

116-
Make the essence of the function
143+
Goal = make the essence of the function
117144

118145
* as clear as possible
119146
* to all parties
120147
* in all situations
121-
122-
With the tools we have at our disposal
148+
* with the tools we have at our disposal
123149

124150
---
125151

@@ -492,13 +518,20 @@ if(w) { w->defaultValue("xxx"); }
492518
* more examples?
493519
* even level of abstraction
494520

521+
--
522+
523+
Hints:
524+
525+
* use a synonym dictionary e.g. [m-w](https://www.merriam-webster.com/thesaurus/clear).
526+
* mind irregular verbs (to read/read/read: very ambiguous)
527+
* ask a native English speaker
495528

496529
--
497530

498531
### Context avoids Repetition
499532

500-
* `math::sin` vs. `confession::sin`
501-
* `myMachine.startMachine()`???
533+
* `myMachine.start()` starts what?
534+
* C, Pascal, ...: `machine_start(machine)` for lack of namespaces/classes
502535

503536
--
504537

0 commit comments

Comments
 (0)