Aspect oriented programming

Modularity of software is a great feature, the majority of this module has been about modularity and its advantages. However, there are some features of software that span the entire system. Security is a great example of this.

We would like to have similar security code in all the modules of the application to check that people are, in fact, authorized to perform some action. So if we have a function of the sort:

var GoldTransfer = (function () { function GoldTransfer() { } GoldTransfer.prototype.SendPaymentOfGold = function (amountOfGold, destination) { var user = Security.GetCurrentUser(); if (Security.IsAuthorized(user, "SendPaymentOfGold")) { //send actual payment } else { return { success: 0, message: "Unauthorized" ...

Get JavaScript : Moving to ES2015 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.