Comments (9)
This sounds like a very useful idea.
I'll consider its implementation.
from angular-aop.
That would be great
from angular-aop.
I implemented it. I'll be happy if you verify it works.
Now the advices for the before, after and around point-cuts should be able to modify the base function arguments and result.
You will be able to modify the function arguments by changing the args array in the advice:
DemoApp.factory('Logger', function () {
return function (args) {
if (args.exception) {
console.log('%cException: ' + args.exception.message + '. ' + args.method + ' called before proper authorization.',
'color: red; text-weight: bold; font-size: 1.2em;');
}
/* Arguments change */
args.args = ['New argument', 'One more new argument'];
/* end of the arguments change */
var throwData = (args.exception) ? ' and threw: ' + args.exception.message : '';
console.log('Method: ' + args.method + ', Pointcut: ' + args.when + ', with arguments: ' +
angular.toJson(args.args) + throwData + ' and resolve data: ' +
angular.toJson(args.resolveArgs) + ', reject data: ' + angular.toJson(args.rejectArgs));
};
});
from angular-aop.
Hey Minko, sorry I haven't got back to you sooner. Thanks for implementing this.
This will be very handy indeed. The thing is I still have reservations about the nesting of aspects when you need to apply multiple before, after, etc aspects to the same function(s). It makes debugging your own code very cumbersome - so much so that I think other developers would hate me for introducing AOP!
I was reading Javascript Allonge (very good functional programming book), and came across the same complaint and a solution for the problem proposed by the author in the following implementation of his AOP javascript library: raganwald - YouAreDaChef
Christian
from angular-aop.
I will include improving this framework in my Christmas TODO list.
If you can provide me some use cases, different from the most common ones - logging, authorization, in which you've applied AOP with AngularJS you'll help me a lot!
from angular-aop.
Hi Minko,
Sounds like you're going to have some fun! For me I think the idea of AOP
is great, I just know it can obscure the debugging experience - something
I've said a few times I know ;-)
Anyway here are a few use cases I've either implemented or thought might be
a good fit for AOP:
- Caching for data services
- Applying exception handling policy at boundary points / between layers
- Retry logic, circuit breakers, etc
- Applying security policies
- Instrumentation to gather performance statistics
Christian
On Sun, Nov 17, 2013 at 10:04 AM, Minko Gechev [email protected]:
I will include improving this framework in my Christmas TODO list.
If you can provide me some use cases, different from the most common ones
- logging, authorization, in which you've applied AOP with AngularJS you'll
be very helpful!—
Reply to this email directly or view it on GitHubhttps://github.com//issues/6#issuecomment-28645761
.
from angular-aop.
Would you mind citing you inside the readme file?
I'm writing a research paper for AOP. I plan to include Angular AOP as JavaScript example so I needed some concrete examples to provide strong arguments for its usage.
Thank you for your response! I haven't considered some of ones you suggested.
from angular-aop.
Of course no problem Minko. Good luck, and looking forward to seeing the
outcome.
C
On Mon, Nov 18, 2013 at 7:37 AM, Minko Gechev [email protected]:
Would you mind citing you inside the readme file?
I'm writing a research paper for AOP. I plan to include Angular AOP as
JavaScript example so I needed some concrete examples to provide strong
arguments for its usage.Thank you for your response! I haven't considered some of ones you
suggested.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/6#issuecomment-28679727
.
from angular-aop.
Closing this on, it looks like #5
from angular-aop.
Related Issues (12)
- Enhancement: add pointcut onNotify HOT 4
- ngResource gets incorrectly wrapped into a function aspect HOT 2
- Typescript: undefined is not a function HOT 18
- AngularAOP for advising controller HOT 2
- IE9 HOT 10
- joinpoint.proceed() HOT 2
- resolveArgs is empty in onResolve and AfterResolve HOT 2
- How can I use the library for AOP on every controller and directive function call? HOT 5
- Name of the original function cannot be determined when function called without a context HOT 6
- Reduce the number of recursively wrapped aspects HOT 3
- Circular dependency when using woven service (or dependent one) in the aspect HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-aop.