Examples that can do harm in learning programming

Examples form an integral part of learning to program. In this paper we argue that the role of examples should go beyond merely illustrating concepts or principles and should "sell" concepts to new programmers. We identify four common pitfalls to avoid when designing examples for teaching programming. We show how examples that are too abstract or too complex can be harmful in explaining new concepts to students. We also show how some examples used to illustrate new concepts can undermine previously taught concepts by not applying these concepts consistently. Finally, we show how some examples can do harm by undermining the very concept they are introducing. The aim of this paper is to encourage educators to think critically about examples before using them.