面向方面的编程技术 [英] Aspect Oriented Programming techniques

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

问题描述

我写过一篇关于如何在
vanilla C ++中进行面向方面编程的文章(即没有语言扩展或其他工具,如

AspectC ++)。该文章可在
http://www.heron上找到-language.com/aspect-cpp.html 。我会很感激文章中的一些

反馈,而且我想知道我是否重复了之前的工作。


提前致谢!


-

Christopher Diggins

另一位语言设计师
http://www.heron-language.com

[见< a rel =nofollowhref =http://www.gotw.ca/resources/clcm.htmtarget =_ blank> http://www.gotw.ca/resources/clcm.htm 有关的信息]

[comp.lang.c ++。moderated。第一次海报:做到这一点! ]

I have written an article on how to do Aspect Oriented Programming in
vanilla C++ (i.e. without language extensions or other tools such as
AspectC++). The article is available at
http://www.heron-language.com/aspect-cpp.html. I would appreciate some
feedback on the article, and also I would like to know whether I am
repeating some prior work.

Thanks in advance!

--
Christopher Diggins
yet another language designer
http://www.heron-language.com
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

推荐答案

2004年2月8日19:48:44 -0500,christopher diggins

< cd ******@users.sourceforge.net>在comp.lang.c ++中写道:
On 8 Feb 2004 19:48:44 -0500, "christopher diggins"
<cd******@users.sourceforge.net> wrote in comp.lang.c++:
我写了一篇关于如何在vanilla C ++中进行面向方面编程的文章(即没有语言扩展或其他工具,如
AspectC ++)。该文章可在
http://www.heron上找到-language.com/aspect-cpp.html 。我很感激对文章的一些反馈意见,我也想知道我是否重复了之前的工作。

提前致谢!


我不能说文章本身的质量,也不知道是否b / b
重复之前的工作,因为我还没有研究过面向方面

之前的编程,但是代码示例有问题。


页面上的示例程序对于大多数C ++来说都是无用的>
编译器现有。

//这是一个小应用程序来说明面向方面的编程技术
//仅使用C ++(即没有语言扩展或特殊的预处理器


好​​的,但是如何合理化:

#include" stdafx.h"


.. ......和:

int _tmain(int argc,_TCHAR * argv [])
I have written an article on how to do Aspect Oriented Programming in
vanilla C++ (i.e. without language extensions or other tools such as
AspectC++). The article is available at
http://www.heron-language.com/aspect-cpp.html. I would appreciate some
feedback on the article, and also I would like to know whether I am
repeating some prior work.

Thanks in advance!
I can''t speak to the quality of the article itself, nor whether it
repeats prior work, as I haven''t researched Aspect Oriented
Programming before, but I have an issue with the code sample.

The sample program on the page is quite useless for most of the C++
compilers in existence.
// This is a small application to illustrate aspect oriented programming techniques
// using only C++ (i.e. no language extensions or special pre-processors
Ok, but how does that rationalize with:
#include "stdafx.h"
.....and:
int _tmain(int argc, _TCHAR* argv[])




.....两行都没有上面是标准的C ++,并且在大多数编译器上都没有编译
。或者vanilla C ++是什么意思

其他什么东西?


如果你想说明AOP是针对标准C ++的,那么是不是只有一些新的Microsoft / Windows特定扩展,我建议你生成一个实际上是vanilla C ++的例子。而不只是

特定于Visual C ++。


-

Jack Klein

主页:< a rel =nofollowhref =http://JK-Technology.Comtarget =_ blank> http://JK-Technology.Com


comp.lang.c http: //www.eskimo.com/~scs/C-faq/top.html

comp.lang.c ++ http://www.parashift.com/c++-faq-lite/

alt.comp。 lang.learn.c-c ++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html


[见 http://www.gotw.ca/resources/clcm.htm 有关的信息]

[comp.lang.c ++。moderated。第一次海报:做到这一点! ]



.....neither of the lines above is standard C++, and neither will
compile on most compilers out there. Or does "vanilla C++" mean
something else?

If you want to make the point that AOP is for standard C++, and is not
just some new Microsoft/Windows specific extension, I would suggest
you produce an example that actually is "vanilla C++" and not just
Visual C++ specific.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]


christopher diggins写道:
christopher diggins wrote:
我写了一篇关于如何在香草中进行面向方面编程的文章C ++(即没有语言扩展或其他工具,如AspectC ++)。该文章可在
http://www.heron上找到-language.com/aspect-cpp.html 。我很感激对这篇文章的一些反馈,我也想知道我是否重复了以前的工作。
I have written an article on how to do Aspect Oriented Programming in
vanilla C++ (i.e. without language extensions or other tools such as
AspectC++). The article is available at
http://www.heron-language.com/aspect-cpp.html. I would appreciate some
feedback on the article, and also I would like to know whether I am
repeating some prior work.




之前我阅读,我会问一个让我在阅读时努力工作的问题:


如果我们可以在vanilla C ++中实现Aspectism,那不是暗示

Aspectism是一种模式,而不是范式或定位?


-

Phlip
http://www.xpsd.org/cgi-bin/wiki?Tes...UserInterfaces

[见 http:// www。 gotw.ca/resources/clcm.htm 了解有关的信息]

[comp.lang.c ++。moderated。第一次海报:做到这一点! ]



Before I read, I''l ask a question that commits me to work hard when reading:

If we can implement Aspectism in vanilla C++, doesn''t that suggest that
Aspectism is a Pattern, not a Paradigm or an Orientation?

--
Phlip
http://www.xpsd.org/cgi-bin/wiki?Tes...UserInterfaces
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]





christopher diggins写道:
Hi,

christopher diggins wrote:
我写了一个关于如何在vanilla C ++中进行面向方面编程的文章(即没有语言扩展或其他工具,如AspectC ++)。该文章可在
http://www.heron上找到-language.com/aspect-cpp.html 。我将不胜感激对文章的一些反馈
I have written an article on how to do Aspect Oriented Programming in
vanilla C++ (i.e. without language extensions or other tools such as
AspectC++). The article is available at
http://www.heron-language.com/aspect-cpp.html. I would appreciate some
feedback on the article



您在本文中指出该技术仅使用标准C ++。

To完全支持这一说法,最好从#include

" stdafx.h",TCHAR和其他微软相关的东西辞职。 ;)


无论如何 - 文章让我思考了一下,问自己以下

问题:


如果我将这种技术称为编译时装饰模式,那么它是否真的错了?

如果不是(即如果有一些优点,说明这只是* * *

装饰器模式在预处理器的帮助下静态实现),

那么:有什么理由将它命名为面向方面的编程?


另请注意,您的技术使用了更多的包装功能。比起交错

(这就是为什么我倾向于把它称为装饰师,而不是AOP)来编写

完整的组件。


我在这个装饰器与AOP的对比中可能错了。


我认为AOP需要一些新的开发方法,包括

完全

本身的新语言功能,或者可能是单独的语言。使用宏来组合包装函数调用可能很好

用于向代码添加检测(日志记录等),但对于true

AOP仍然不足。


这些只是我的想法,我将非常乐意学习

其他人的意见。


感谢您与社区分享此文本,


-

Maciej Sobczak: http://www.msobczak.com/

编程: http://www.msobczak.com/prog/

[见 http://www.gotw.ca/resources/clcm.htm 了解有关的信息/>
[comp.lang.c ++。moderated。第一次海报:做到这一点! ]



You state in this article that the technique uses only Standard C++.
To fully support this claim, it would be good to resign from #include
"stdafx.h", TCHAR and other Microsoft-related stuff. ;)

Anyway - the article got me thinking a bit and ask myself the following
question:

If I call this technique a "compile-time Decorator pattern", would it be
really wrong?
If not (ie. if there is some merit in stating that this is *just* a
Decorator pattern implemented staticly with the help of preprocessor),
then: what is reason to name it Aspect-Oriented Programming?

Note also that your technique uses more "wrapping" than "interleaving"
(that''s why I tend to call it Decorator, not AOP) when composing
complete components.

I may be wrong in this Decorator vs. AOP comparison.

I think that AOP calls for some new approach to development, including
completely new language features, or maybe a separate language in
itself. Using macros to compose wrapped function calls is probably good
for adding instrumentation to code (logging, etc.), but as for "true"
AOP it is still insufficient.

These are just my thoughts and I will be more than happy to learn
others'' opinions.

Thank you for sharing this text with the community,

--
Maciej Sobczak : http://www.msobczak.com/
Programming : http://www.msobczak.com/prog/
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]


这篇关于面向方面的编程技术的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆