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

Rough ideas for pract. lessons #3

Open
code-hunger opened this issue Oct 16, 2019 · 2 comments
Open

Rough ideas for pract. lessons #3

code-hunger opened this issue Oct 16, 2019 · 2 comments

Comments

@code-hunger
Copy link
Member

  • show some tricks for quicker compile-run cycles in the CLI (use '&&' for joining commands and "↑" for accessing the previous command)
  • let the students describe boolean conditions via propositional logic on the whiteboard before they make a C++ implementation
  • let them describe formally their tasks (when the problem is in the form "how many numbers satisfy X" or "print the numbers which satisfy Y") using set-notation and predicate calculus
  • let them find formulas for directly computing easier counting tasks (e.g. numbers divisible by N and M, less than 10³); probably on the whiteboard in parallel with the code-writing student.
  • describe some tasks using only set notation and predicate calculus, no words, and let the students infer the meaning
@code-hunger
Copy link
Member Author

  • prepare students for a few things needed later in the course when teaching arrays
    • explain what is a constant, the difference between compile-time and runtime constants (const vs constexpr), how these can be used for safer code, what is sizeof.

@code-hunger code-hunger changed the title Rough ideas for pract. Oct. 21 Rough ideas for pract. lessons Oct 28, 2019
@code-hunger
Copy link
Member Author

code-hunger commented Oct 28, 2019

  • I lied about the impossibility for T var[n] (where n is non-constexpr) due to unextendability of the array. It is possible, and is available in C99, though its usage is discoraged.
    The problem's actually that the type system becomes kind of unstable (@todo think of a better word) at compile-time (E.g. sizeof will become non-constexpr).
  • explain why you can't do stuff like array.size() or why there can't be such a thing as length(array), neither theoretically nor in practice (when working with arrays directly initialized in memory, be it the stack or the heap).
  • explain how arrays in C/C++ are "pure", in the sense that we directly operate on the underlying data; talk about the complete lack of abstraction, that we're concrete as hell, what power this gives us and what errors are terribly easy to make and how to avoid them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant