- Use namespaces and break code into modules. Modules, modules, modules. Not functions, functions, functions.
- Use Event driven programming. Web apps will always be event driven. You’re either responding to a user event or a system event. Architect and program your components as such.
- Use a publish/subscribe plugin or something within your framework if it supports it already. Ties nicely into the event driven architecture.
- Last but definitely my favourite. Everything is a module. Use decorators to change behaviour dynamically. You can mix and match different JS objects and functions dynamically on demand. This can be very powerful. It’s like your on demand movie subscription…but much better. Imagine you can mix Dexter with True Blood and in the Mad Men days? Wow.