Design Patterns

There are many thing in this. I will put it in some points. Again this is my opinion and what I have seen from my experience:

  1. First of all the most important thing is no matter what you decide in terms of using patterns, code style. It has to be something that you team is doing together. If required document it. So that even if a new developer will join things will still go in same way.
  2. Define a Style guide for your project. Google has one for JavaScript Page on . Addy osmani has one awesome blog on that JavaScript Style Guides And Beautifiers. Read it with team discuss it and come up with something that works best for your team.
  3. There are some Great books from Addy Osmani about Design patterns in JavaScript applications:   Learning JavaScript Design Patterns and  Patterns For Large-Scale JavaScript Application Architecture. They give a great idea.
  4. Best approach to write maintainable code in JavaScript is to write modular code. Again Addy Osmani hits best with his book Writing Modular JavaScript With AMD, CommonJS & ES Harmony (All these books are free online :) )
  5. There is no way you are going to have productivity if people who are working on project don't know much of JavaScript. I would suggest reading couple of books as a team or individuals: Maintainable JavaScript: Nicholas C. Zakas: 9781449327682: BooksTestable JavaScript: Mark Ethan Trostler: 9781449323394: Books and High Performance JavaScript (Build Faster Web Application Interfaces): Nicholas C. Zakas: 9780596802790: Books
  6. Regarding your concern of having so many callbacks. Use Promises. Its super easy to build Promises. They are natively coming to JavaScript in ECMAScript 6.  Here are couple of tutorials that I used:  Promises, Promises: Mastering Async I/O in Javascript with the Prom... and  Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programm...
  7. One thing which is very very important is using some automation tools that can help you in getting immediate feedback in terms of bugs and bad code. I personally Love Grunt The JavaScript Task Runner but use it through Yeoman Modern workflows for modern web apps. Its simply awesome.
  8. Use something like JSHint or JSLint with Grunt to get immediate feedback for your JavaScript code.
  9. I use sublime as editor I have installed jslint plugin in sublime. So that I can lint my files while I am writing code.
  10. One more thing which is very very important is wring tests for your JavaScript. No matter what design pattern you use how good your code is you will have bugs. Writing tests is best way to find bugs.
  11. Another important thing which most of the people don't agree is having same set of environment for each developer. Try to use same tools for your project. We generally keep a iso image for our dev machine somewhere. Whenever somebody new joins project he will install from that iso machine. Which already includes all the required tools. But if you don't wanna do this. Grunt helps you to solve this issue.

Again this is just opinion. Feel free to discuss with your team. Share knowledge. These things take time. You can not read a blog or a book to change projects. It is a process and you have to go through it. You will fail many times and you will have arguments but that is what makes it interesting. I hope I have tried to answer your questions.

Share on : Twitter, Facebook or Google+