简体   繁体   中英

Aspect Oriented C (not C++) in Production Code

This is a question further derived from a previous one: https://stackoverflow.com/questions/1834485/aspect-oriented-programming-aop-in-c-not-c-anyone-doing-it

The answers to that question point us to some research practices at queens university here: http://sailhome.cs.queensu.ca/~bram/aspicere/index.html .

Beyond that research effort, does anyone know of real world usage of Aspect Oriented C in production code? If no, where do you think the difficulty is? If yes, what's the hurdle that makes it unpopular yet?

I think the benefit of AOP is obvious. But after AOP-Java becoming popular for a decade, AOP-C is still almost non-existent, there must be some reason. What's your insight on this?

After some thinking I believe the answer is that C lacks the structural constructs where you can hook up your aspect cross-cuts.

To get around of this problem, a project would have to impose strict structural conventions that is not easy to have programmers to agree on. If you do have programmers to agree on to such a convention, the chance is that the project would have chosen a better language.

I think the main reason is that traditional method to implement the AOP in C/C++ needs a complex framework to make things work. Beside, the C++ is strict type language, which makes the implementation even harder than C.

But, It is the old time. new C++ 11~17 provides some really powerful features for you to do all the tricks.

You could check this one: https://github.com/whitebob/qaop A very light-weight, header-only AOP framework, and it is easy to use.

I am the author of this on-going project, so if you have some suggestions or complains, just contact me :p

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM