摘要
面向对象的设计原则用于指导系统的设计和开发,较好的设计只需很少的改变就可以应对需求的变化。本文从一个常见的错误处理程序出发,在充分分析可能出现的需要改变的基础上,应用开放闭合、单一职责等设计原则和访问者设计模式对现有代码进行重构,使其更富有弹性、更容易维护,并能够适应需求的不断变化。
Object-oriented design principles is often used to guide the system design and development, better design can respond to changes in demand by little change. In this paper, starting with a common error handler, it refactors the existing code guiding by Open-Closed principle, Single-Responsibility principle and visitor design pattern through the full analysis of the possible changes in demand. The refactoring makes the code more flexible, easier to maintain and able to adapt to the changing needs.
出处
《科技广场》
2010年第8期57-60,共4页
Science Mosaic
关键词
程序结构
设计原则
面向对象
设计模式
Program Structure
Design Principle
Object-oriented
Design Pattern