Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Since I've always been a logical person I mostly would like to hear <em>why</em> you need dynamic allocation, not how it works and how the syntax is in a particular language. Start with static allocation, move on to cases when you hit the limitations of it, introduce dynamic allocations. Try to explain the different runtime scopes (compile time, runtime and the border cases). Explain which allocation techniques to use when. For heap allocation you could use shared memory situations and show that it is necessary to have a referencing mechanism, and introduce pointers through that. Show that you cannot determine the lifetime of the memory area easily with shared owner semantics and show different solutions (reference counting, manual deallocation etc) and describe why you need a tradeoff and not just one solution. Use other examples than only memory allocation (e.g RAII) to show that the techniques you show are not limited to memory but to any type of resources.</p> <p>I think that the key is to build the knowledge from the ground up, and not treat people like idiots (Blinky), but to keep in mind that many people have limited experience in the field, and need concrete examples to grasp why all the features are in place. There are many factors in play, and clearly defining the constraints so the students understand the problem formulation is probably the most important aspect of teaching this type of things.</p> <p>An example is worth a thousand words, and giving students concrete examples where the things they know so far doesn't cut it enables them to reason about the problem and eventually take the next step.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload