An implementation of Strategy and Factory Pattern in Javascript to create simple shapes in SVG - fraricce/SGVRender GitHub Wiki
Welcome to the SGVRender wiki!
The purpose of this project is to study a pattern-oriented approach to create a well designed SVG Render Engine. In this implementation, I've used two patterns: Strategy and Factory. The application is designed on top of the VisualItem object, that is the object drawn on the canvas. The VisualItem "class" (we're in Javascript, no class but functions) can be anything you need (a rectangle, a circle, etc.). Rather than "subclassing", I've decided for one class of objects that can have multiple rendering strategies (here where the Strategy Pattern comes). The Factory is used to create instances of VisualItem with the right rendering strategy.
All the core objects and patterns implementation are into the public folder. The rest of the project is a small Node Express JS web application.
If you are new to Express JS and its family, see ExpressJS