O'Reilly logo

Mastering JavaScript Design Patterns - Second Edition by Simon Timms

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Hints and tips

Here are a couple of brief tips to keep in mind about some of the patterns we've seen in this chapter:

  • When implementing the interpreter pattern you may be tempted to use JavaScript proper as your DSL and then use the eval function to execute the code. This is actually a very dangerous idea as eval opens up an entire world of security issues. It is generally considered to be very bad form to use eval in JavaScript.
  • If you find yourself in the position to audit the changes to data in your project, then the memento pattern can easily be modified to suit. Instead of keeping track of just the state changes, you can also track when the change was made and who changed it. Saving these mementos to disk somewhere allows you to go back and ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required