本文介绍了面向方面的编程示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能发布一个日志记录的面向方面编程(AOP)的例子?

Can anyone post an example of Aspect-oriented programming (AOP) that is not logging?

我查看了几个资源,但所有示例都是简单的日志记录.它有什么用?

I've looked at several resources but all the examples are trivial logging. What is it useful for?

推荐答案

直接从这个面向切面编程:模块化的激进研究,Youtube 视频 正在向显示器绘画.在示例中,您有一个绘图程序,它由点、形状等组成,当这些对象发生更改时,您需要告诉显示进行自我更新.如果不从一个方面处理它,你最终会重复自己很多.

One of the examples which was loaned straight from this Aspect Oriented Programming: Radical Research in Modularity, Youtube video was painting to a display. In the example you have a drawing program, which consists of points, shapes, etc and when changes to those objects occur you need to tell the display to update itself. Without handling it in an aspect you end up repeating yourself quite a bit.

据我所知,AOP 的创建是为了不为横切关注点而重复自己,而横切关注点可能与业务逻辑没有任何关系.通过方面,您可以将这些关注点模块化为方面.其中一个示例是日志记录,但您可能最终会重复许多不同的事情.它一直在发展,不再是面向方面的编程,而是面向方面的建模.

AOP, as I've understood it, was created for not repeating yourself for cross cutting concerns which might not have anything to do with business logic. With aspects you can modularize these concerns to aspects. One of the examples was logging but there are bunch of different things you might end up repeating. It has been evolving since and it's not any more about aspect-oriented programming but there's also aspect-oriented modelling.

关于面向方面编程的更多信息可以从以下来源找到:

More information about aspect oriented programming can be found from these sources:

07-08 04:41