Skip to content

Commit 6b410b5

Browse files
authored
Merge branch 'master' into constructors
2 parents 47b6a76 + 80780c5 commit 6b410b5

File tree

9 files changed

+387
-0
lines changed

9 files changed

+387
-0
lines changed

sources/knowledge_areas.dat

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ EH Error Handling
5555
? ? ? ? errno
5656
? ? ? ? Error Codes
5757
eh y y y Exception Handling
58+
PD Program Design
59+
cont y y y Containers
60+
DE Debugging Errors
61+
compiletimeerr y y y Compile-Time Errors
62+
runtimeerr y y y Run-time Errors
5863
SL Standard Library
5964
? ? ? ? Input/Output (I/O)
6065
? ? ? ? Containers, Iterators, and Algorithms
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## Debugging Errors: Build errors
2+
3+
_Skeleton descriptions are typeset in italic text,_
4+
_so please don't remove these descriptions when editing the topic._
5+
6+
This topic is currently under construction and will soon be filled with information :)
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
## Debugging Errors: Compile-time errors {#compiletimeerr}
2+
3+
_Skeleton descriptions are typeset in italic text,_
4+
_so please don't remove these descriptions when editing the topic._
5+
6+
### Overview
7+
8+
_Provides a short natural language abstract of the module’s contents._
9+
_Specifies the different levels of teaching._
10+
11+
------------------------------------------------------------------------
12+
Level Objective
13+
----------------- ------------------------------------------------------
14+
Foundational Understanding elementary error messages
15+
16+
Main Dealing with most error messages
17+
18+
Advanced ---
19+
20+
------------------------------------------------------------------------
21+
22+
### Motivation
23+
24+
_Why is this important?_
25+
_Why do we want to learn/teach this topic?_
26+
27+
Compiler error messages can be hard to read and even compiler specific.
28+
However, they contain valuable information for determining the cause of the compile-time errors.
29+
Oftentimes the error messages are very verbose to give you the most precise information about the error context, so learning how to extract the valuable information from the error message is an important skill that one should acquire.
30+
31+
### Topic introduction
32+
33+
_Very brief introduction to the topic._
34+
35+
C++ compilers try to statically determine errors at compile time to shift detection of problems that would occur later on (e.g., at link time or run time) to earlier point in time, where they can be addressed in an earlier stage of the development process.
36+
The error message that the compiler generates directly relates to the C++ language definition and precisely lays out why the code is not valid and where it does not comply with the language rules.
37+
38+
### Foundational: Understanding elementary error messages {#compiletimeerr-found}
39+
40+
#### Background/Required Knowledge
41+
42+
A student:
43+
44+
* definitions [[C++ Object Model: Definitions - Foundational]][1]
45+
46+
#### Student outcomes
47+
48+
_A list of things "a student should be able to" after the curriculum._
49+
_The next word should be an action word and testable in an exam._
50+
_Max 5 items._
51+
52+
A student should be able to:
53+
54+
1. distill the core of an elementary error message.
55+
2. act on elementary error messages.
56+
3. differentiate between different error kinds (e.g., type errors, syntax errors, ...).
57+
4. give examples for different kinds of errors.
58+
59+
60+
#### Caveats
61+
62+
_This section mentions subtle points to understand, like anything resulting in
63+
implementation-defined, unspecified, or undefined behavior._
64+
65+
* names mentioned in error message are presented in full detail and may not look exactly like specified by the programmer (e.g., `std::string` -> `std::basic_string<char>`)
66+
67+
#### Points to cover
68+
69+
_This section lists important details for each point._
70+
71+
* methodology of reading error messages
72+
* start with the first error
73+
* read top down
74+
* parse error message / pattern matching to error kinds
75+
* linker errors [[Debugging Errors: Build errors - Foundational]][2]
76+
77+
78+
### Main: Dealing with most error messages {#compiletimeerr-main}
79+
80+
#### Background/Required Knowledge
81+
82+
* compile-time programming [Soft dependency]
83+
84+
#### Student outcomes
85+
86+
A student should be able to:
87+
88+
1. locate the principle template involved in a template error message.
89+
2. determine why a specific overload is chosen, from the compiler’s error message.
90+
3. apply common debugging techniques in a constexpr context.
91+
92+
#### Caveats
93+
94+
* argument dependent lookup
95+
* there is currently no good debugger support for constexpr context
96+
97+
#### Points to cover
98+
99+
* templates related error messages
100+
* overload resolution related errors
101+
* reasoning about errors during constexpr execution (consteval)
102+
* reverting to non-constexpr run-time debugging
103+
* employing static_assert
104+
105+
### Advanced
106+
107+
_These are important topics that are not expected to be covered but provide
108+
guidance where one can continue to investigate this topic in more depth._
109+
110+
* Full error analysis, there are error messages that are out of the scope for students.
111+
* Complicated SFINAE constructs
112+
113+
[1]: ../object-model/definitions.md
114+
[2]: ../debugging-errors/build-errors.md
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
## Debugging errors: Run-time errors {#runtimeerr}
2+
3+
_Skeleton descriptions are typeset in italic text,_
4+
_so please don't remove these descriptions when editing the topic._
5+
6+
### Overview
7+
8+
_Provides a short natural language abstract of the module’s contents._
9+
_Specifies the different levels of teaching._
10+
11+
------------------------------------------------------------------------
12+
Level Objective
13+
----------------- ------------------------------------------------------
14+
Foundational Identifying the run-time error cause
15+
16+
Main Introspection methodologies to trackdown run-time errors
17+
18+
Advanced ---
19+
20+
------------------------------------------------------------------------
21+
22+
### Motivation
23+
24+
_Why is this important?_
25+
_Why do we want to learn/teach this topic?_
26+
27+
Code correctness is important, as erroneous programs can lead to real-world catastrophes, take for example, medical equipment failures that lead to people being exposed to too much radiation.
28+
Techniques, such as, testing or fuzzing, help developers to identify erroneous states of the program.
29+
However, when these techniques discover a run-time error, it’s up to the programmer to reason about and find the root cause of such run-time errors, so they need a well established process to debug run-time errors.
30+
31+
### Topic introduction
32+
33+
_Very brief introduction to the topic._
34+
35+
There exists a wide variety of methodologies, techniques, and tools to debug run-time errors.
36+
In this topic, we give an overview of these and highlight how they can be applied to track down run-time errors in C++ programs.
37+
38+
### Foundational: Identifying the run-time error cause {#runtimeerr-found}
39+
40+
#### Background/Required Knowledge
41+
42+
A student:
43+
44+
* should be able to produce a basic running program.
45+
46+
#### Student outcomes
47+
48+
_A list of things "a student should be able to" after the curriculum._
49+
_The next word should be an action word and testable in an exam._
50+
_Max 5 items._
51+
52+
A student should be able to:
53+
54+
1. verify the output of the program and identify incorrect outcomes.
55+
2. phrase hypothesis what could cause the run-time error.
56+
3. observe and extract program state at specific points of the program, to verify hypotheses.
57+
4. make their program as observable as possible.
58+
59+
#### Caveats
60+
61+
_This section mentions subtle points to understand, like anything resulting in
62+
implementation-defined, unspecified, or undefined behavior._
63+
64+
* run-time debugging can be domain specific
65+
* not everything about the program state can be easily observed, students should be aware of that and learn basic techniques to make programs more observable
66+
* students should be aware that the compilation mode (optimized vs debug) affects the debugging experience and also the program state itself
67+
68+
69+
#### Points to cover
70+
71+
_This section lists important details for each point._
72+
73+
* the basics of using a debugger
74+
* compiling with debug information
75+
* observability techniques, such as, logging output or even `printf` statements
76+
77+
### Main: Introspection methodologies to trackdown run-time errors {#runtimeerr-main}
78+
79+
#### Background/Required Knowledge
80+
81+
* All of the above.
82+
83+
#### Student outcomes
84+
85+
A student should be able to:
86+
87+
1. use a debugger to inspect and manipulate program state
88+
2. extract crash information using proper libraries
89+
3. can create a minimal reproducible example
90+
91+
#### Caveats
92+
93+
* Different forms of multiprocessing programs can have varying impact on debuggability, such as:
94+
* parallel stl algorithms
95+
* multi threading
96+
* coroutines
97+
* vector parallelism
98+
99+
100+
#### Points to cover
101+
102+
* How to use debuggers and the multitude of features they offer to manipulate and observe program state (e.g., break points, trap points, stack traces, manipulating program state).
103+
* Use (non) standard library support for crash information extraction, e.g., logging libraries, libraries to capture crash reports, and sanitizer libraries (asan/ubsan/tsan).
104+
* Creating minimal reproducible example and regressions tests from the extracted crash information.
105+
106+
107+
### Advanced {#runtimeerr-advanced}
108+
109+
_These are important topics that are not expected to be covered but provide
110+
guidance where one can continue to investigate this topic in more depth._
111+
112+
* ABI incompatibilities can have impact debugging experience where even observability tools, such as, debuggers, cannot correctly show the state of the program.
113+
* Debugging in embedded environments.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## Program Design: Algorithms
2+
3+
_Skeleton descriptions are typeset in italic text,_
4+
_so please don't remove these descriptions when editing the topic._
5+
6+
This topic is currently under construction and will soon be filled with information :)
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
## Program Design: Containers {#cont}
2+
3+
_Skeleton descriptions are typeset in italic text,_
4+
_so please don't remove these descriptions when editing the topic._
5+
6+
### Overview
7+
8+
_Provides a short natural language abstract of the module’s contents._
9+
_Specifies the different levels of teaching._
10+
11+
------------------------------------------------------------------------
12+
Level Objective
13+
----------------- ------------------------------------------------------
14+
Foundational Using standard containers
15+
16+
Main Extending standard containers and day-to-day usages
17+
18+
Advanced ---
19+
20+
------------------------------------------------------------------------
21+
22+
### Motivation
23+
24+
_Why is this important?_
25+
_Why do we want to learn/teach this topic?_
26+
27+
Storing data is an essential part of computations.
28+
We use abstractions to make it easier to reason about and work with the data.
29+
This leads to grouping related data variables together in data structures to give the grouping a name and to be able to make multiple instances of that data structure.
30+
Data structures are therefore foundational building blocks for program design and are present in almost every program.
31+
32+
Data structures come in many different forms, but there are special data structures that group objects of related types together.
33+
In C++ these collections of data are called containers.
34+
The C++ standard library provides a wide range of such common containers.
35+
To make algorithms more universally applicable to containers, the standard library defines a common interface.
36+
This way, containers build a bridge between algorithms and how data is organized.
37+
38+
39+
### Topic introduction
40+
41+
_Very brief introduction to the topic._
42+
43+
### Foundational: Using standard containers {#cont-found}
44+
45+
#### Background/Required Knowledge
46+
47+
A student:
48+
49+
* "for loops"
50+
* "defining variables"
51+
* "main function"
52+
53+
#### Student outcomes
54+
55+
_A list of things "a student should be able to" after the curriculum._
56+
_The next word should be an action word and testable in an exam._
57+
_Max 5 items._
58+
59+
A student should be able to:
60+
61+
1. setup and add objects to a container
62+
2. work with objects that are stored in a container
63+
64+
#### Caveats
65+
66+
_This section mentions subtle points to understand, like anything resulting in
67+
implementation-defined, unspecified, or undefined behavior._
68+
69+
* On a foundational level, avoid using iterators when teaching containers to prevent problems, such as iterator invalidation or dangling iterators.
70+
* Avoid going deep into the template notation
71+
* Teach people to not use `vector<bool>`
72+
73+
#### Points to cover
74+
75+
_This section lists important details for each point._
76+
77+
* Creating containers, adding objects, iterating over them using range based or index based for loops.
78+
* `vector`, `string`, `unordered_map`, `unordered_set`
79+
* Notation for having container of different value types with angle brackets
80+
81+
82+
### Main: Extending standard containers and day-to-day usages {#cont-main}
83+
84+
#### Background/Required Knowledge
85+
86+
* Basic understanding of standard algorithms [[Program Design: Algorithms - Foundational]][1]
87+
* Basic understanding of classes and class templates [[User-defined Types: Class Templates - Foundational]][2]
88+
89+
#### Student outcomes
90+
91+
A student should be able to:
92+
93+
1. make effective use of the standard containers.
94+
2. make use of iterators to iterate over a sequence and call algorithms.
95+
3. make a proper choice what container to use based on its characteristics.
96+
4. write a container class template for a specific need (based on a standard container).
97+
5. make use of common container idioms.
98+
99+
#### Caveats
100+
101+
* Iterator invalidation
102+
* When extending standard containers, prefer delegation over inheritance
103+
104+
#### Points to cover
105+
106+
* Alternative ways of iterating over a container using iterators
107+
* Adapting or extending standard containers (e.g., writing wrapper types with additional semantics)
108+
* Discuss the different characteristics and trade-offs of standard containers
109+
* Common idioms (e.g., find-erase)
110+
* Usage of end-of-sequence iterators [[Program Design: Iterators - Foundational]][3]
111+
* [Optional] Using containers together with ranges [[Program Design: Ranges - Foundational]][4]
112+
113+
114+
### Advanced
115+
116+
_These are important topics that are not expected to be covered but provide
117+
guidance where one can continue to investigate this topic in more depth._
118+
119+
* creating your own STL compatible containers from the ground up
120+
* using containers with non-default allocators
121+
122+
[1]: ../program-design/algorithms.md
123+
[2]: ../user-defined-types/class-templates.md
124+
[3]: ../program-design/iterators.md
125+
[4]: ../program-design/ranges.md
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## Program Design: Iterators
2+
3+
_Skeleton descriptions are typeset in italic text,_
4+
_so please don't remove these descriptions when editing the topic._
5+
6+
This topic is currently under construction and will soon be filled with information :)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## Program Design: Ranges
2+
3+
_Skeleton descriptions are typeset in italic text,_
4+
_so please don't remove these descriptions when editing the topic._
5+
6+
This topic is currently under construction and will soon be filled with information :)

0 commit comments

Comments
 (0)