The traditional reliability design methods are imperfect, because the designed systems aim at less faults but once a fault happens they may hardfail. To solve this problem, we propose the concepts of self-maintenance machine (SMM) that can maintain its functions flexibly even though faults happen. In order to achieve capabilities of diagnosing and repair planning, a model based approach that employs qualitative physics is proposed. Regarding repair executing capability, control type repair strategy is proposed. A prototype of the self-maintenance machine is developed and it succeeded to maintain its functions as far as its structure does not change. This prototype, however, revealed the following problems that may arise when applied to a commercial product as embedded software. The problems include; (1)performance of the reasoning system, (2)the system size, (3)effects of environmental changes, and (4)roughness of qualitative repair operations. In order to solve these problems, we propose a new reasoning method based on virtual cases and fuzzy qualitative values. This is a methodology of knowledge compilation that gives better reasoning performance and can deal with real world applications like the self-maintenance machine. By using this method, we finally developed a commercial photocopier that has selfmaintenability and is more robust against faults. The commercial version has been supplied worldwide as a product of Mira Industrial Co., Ltd., since April, 1994.