摘要
GoF23中的Observer模式定义了一个一对多的依赖关系,当一个对象状态改变时,所有依赖该对象的对象都被通知并且自动执行更新操作。Observer模式的OOP实现方案中,模式的实现代码与模式的参与者代码混合在一起,容易产生代码缠结和代码分散等诸多问题。利用AOP技术能很好的将系统中模式实现的代码封装在一个独立的模块中,从而使得程序的模块化程度和可复用性得到改善。
In GoF23, the Observer pattern is to "define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically". Traditionally OOP implements of the Observer pattern tangle the pattern implements codes with pattern participant codes together. Using AOP, the implementation of the pattern can be wrapped into one individual module. By this way the modularity and reusability of the whole system will be greatly improved.
出处
《微计算机信息》
北大核心
2006年第05X期225-227,219,共4页
Control & Automation
基金
甘肃省自然科学基金资助项目(ZS031-A25-015-G)