In recent years, the programming learning has been widely applied to support thetraining of the problem solving skill in universities and senior high schools. With our observations, there is a learning gap from a novice who can recognize the program statement to a well-trained programmer who can write a correct program to solve a given problem. The experience of problem solving is important for learners to understand the different expression of the program syntax. To aid the novice learner learn the programming, our idea is to use the mastery learning theory with “learning by example” strategy. The programs of classical problems are collected and novice learners are asked to trace the problem solving process of the programs. To collect the learning feedbacks from learners, the buggy patterns relating to different programming capabilities are embedded in the original sample programs to facilitate the error detection assessment. If the detection of the embedded bugs can not correctly done by novice learners, these symptoms are recorded as portfolio for further misconception analysis. Finally, the experimental result shows the findings of the proposed methodology.