To help programmer gaining sound concepts of a programming language and boost their problem solving ability, this study constructs a programming environment, which, based on the self-explanation strategy, gives proper feedbacks for the programmers of C++language. The embedded self-explanation strategy guides the environment which, when programmers gets compilation errors, gives extended examples for the programmers and ask them for self-explanations on the inference of the error after they study the examples. An algorithm developed in this study compares the self-explanation sentence from a programmer with base strings, established and organized into an ontology by programing experts, and finds possible errors on the explanation, which lead to his/her possible misconceptions. Based on the results, the environment manages to feedback proper learning material and extended examples for programmers to correct their possible misconceptions. This study builds an ontology of C++ concepts class hierarchy with class properties and instances being possible misconceptions and the learning material feedbacks. The possible misconceptions are collected from actual programming practices in several pilot experiments joined by programmers of college students. The final experiment involves 13 college students who use the system for actual programming. The environment records students programming activities, analyzes their self-explanations on errors, and gives proper feedbacks, which, after verified by programming experts, reaches an average accuracy of 84.7%. The distinctive feature of this study is the open question style self-explanation sentence requirement, a rare research of its kind. All the schemes and algorithms developed in this study can be used as a methodology for establishing system with self-explanation learning strategy in other fields.