AOP is a programming paradign - a "high level concept". Decorators (talking about the things that start with @, NOT about the design pattern) are a JavaScript feature and yes, with decorators you can implement lots of ideas coming from AOP. Decorators are still experimental for JavaScript while as what I explained in the video is "pure" and supported JavaScript / functional programming. Anyways, I pretty much fell in love with decorators since they are very easy to read, so today I'd probably code the same examples using decorators instead :)
Concepts coming from AOP help to separate concerns (as do concepts of OOP or functional programming). So separation of concern is the higher goal you want to achieve, and the concepts taken from AOP help us to reach that goal
decorators are used in resolving cross-cutting concerns which becomes a bit problematic to be used with regular inheritance ........so basically decorators address the cross-cutting concerns and hence different from wrappers
I think you're referring to the decorator design pattern. This is a concept coming from OOP that helps dealing with adding functionality to existing classes without touching the class itself (extend instead of change). In contrast, the main goal of AOP is to write code where business logic functions/classes contain only business logic and no logic regarding cross-cutting-concerns like logging, authentication, caching, and so on.
Currying is something totally different, involving splitting a function of N arguments into a composition of N functions each of which is assigned a separate argument from the original function.
I've been using stuff like this even without knowing it was called AOP. Great explanation. Thanks!
Great examples, great explanation, great video. 10/10.
is AOP something related to use of decorators ( @ ) ?
AOP is a programming paradign - a "high level concept". Decorators (talking about the things that start with @, NOT about the design pattern) are a JavaScript feature and yes, with decorators you can implement lots of ideas coming from AOP. Decorators are still experimental for JavaScript while as what I explained in the video is "pure" and supported JavaScript / functional programming.
Anyways, I pretty much fell in love with decorators since they are very easy to read, so today I'd probably code the same examples using decorators instead :)
how exactly the last part is working. like the Last part where you are adding aspects
So is separation of concerns a way of using AOP?
Concepts coming from AOP help to separate concerns (as do concepts of OOP or functional programming). So separation of concern is the higher goal you want to achieve, and the concepts taken from AOP help us to reach that goal
Can't see the difference between decorator/wrapper pattern and AOP
decorators are used in resolving cross-cutting concerns which becomes a bit problematic to be used with regular inheritance ........so basically decorators address the cross-cutting concerns and hence different from wrappers
I think you're referring to the decorator design pattern. This is a concept coming from OOP that helps dealing with adding functionality to existing classes without touching the class itself (extend instead of change). In contrast, the main goal of AOP is to write code where business logic functions/classes contain only business logic and no logic regarding cross-cutting-concerns like logging, authentication, caching, and so on.
in terms of FP concepts it's called "currying" in it's simplest implementation
Currying is something totally different, involving splitting a function of N arguments into a composition of N functions each of which is assigned a separate argument from the original function.
This is an excellent video. I'm wondering why you are not making more and longer?
Thanks! Anything you'd like me to elaborate in particular? Or just generally more AOP stuff?
Gotta love closures!
thanks