Loose coupling. Your web front-end has that, right? Your JavaScript is using pubsub, event emitters, and message buses! Guess again, you can do better. Aspect Oriented Programming (AOP) is a technique for augmenting the behavior of objects, methods, and functions non-invasively.
AOP adds new behaviors and modifies existing behaviors “from the outside”. Using AOP, it’s possible to create connections between components without either having any knowledge of the other and without any extra library dependencies in your code.
While you may be familiar with AOP in Spring, you may not yet have applied it in JavaScript. In this talk, we’ll do just that. We’ll introduce simple techniques for applying AOP in pure JavaScript using no additional libraries, and then look at meld.js, the AOP library that powers Cujo.js. We’ll work from simple examples of making connections between components to more sophisticated examples that integrate pubsub, message buses, etc. in a truly loosely coupled way.