作者投稿和查稿 主编审稿 专家审稿 编委审稿 远程编辑

计算机工程 ›› 2008, Vol. 34 ›› Issue (17): 71-73. doi: 10.3969/j.issn.1000-3428.2008.17.026

• 软件技术与数据库 • 上一篇    下一篇

在AOP中使用标注改进日志功能的实现

郑汉雄,郑汉英,周晓聪   

  1. (中山大学计算机科学系,广州 510006)
  • 收稿日期:1900-01-01 修回日期:1900-01-01 出版日期:2008-09-05 发布日期:2008-09-05

Implementation of Improving Logging Function in AOP by Annotation

ZHENG Han-xiong, ZHENG Han-ying, ZHOU Xiao-cong   

  1. (Dept. of Computer Science, Sun Yat-sen University, Guangzhou 510006)
  • Received:1900-01-01 Revised:1900-01-01 Online:2008-09-05 Published:2008-09-05

摘要: 面向方面编程(AOP)可避免横切关注点对核心代码的不良影响,但AOP中的方法签名匹配模式难以精确表达系统中的横切点,使得在大中型系统中直接使用连接点匹配方式捕获某些横切点,同样会降低系统的可读性和模块化。该文以日志功能为例,研究如何使用标注来辅助AspectJ改进与日志功能相关的横切点定义,从而改善代码的可阅读性,提高程序的可维护性,并实现日志内容的可配置性。

关键词: 面向方面编程, 标注, 横切关注点, 日志

Abstract: Aspect Oriented Programming(AOP) can be used to avoid the disadvantage to the core code caused by cross-cutting concerns. However, because the method-signature pattern of the AOP can not express the cross-cutting concerns of the system exactly, matching some cross-cutting concerns by capturing the join point directly decreases the readability and modularity of system. A method for improving the definition of cross-cutting concerns of logging is studied in this paper. Such method improves the readability and the maintainability of the program, as well as implementing the flexibility of logging content.

Key words: Aspect Oriented Programming(AOP), annotation, cross-cutting concerns, logging

中图分类号: