https://mojdigital.blog.gov.uk/2013/11/04/modular-javascript-with-heisenberg/

Modular JavaScript with Heisenberg

Organising JavaScript in a small project is like choosing what to eat in a restaurant - there are lots of options, the only person it's really going to matter to is you, and you can always try something different next time. But when you're working in a team on projects with long lifespans that will need to be maintained by others, consistency is essential.

To this end, when beginning to assemble what will eventually become the MOJ Front-End Toolkit we needed to decide on a pattern for including JS files and modules in our sites, so as a starting point we selected Heisenberg.js. It's not a framework or library in itself, but a pattern/methodology for organising your files and we're liking it so far. It provides a defined structure for each module and a standardised way of including modules in our projects. We're not using the whole Heisenberg project, just the module structure, and to further strengthen the idea of consistency we're also using a slightly amended coding style from Idiomatic.js.

If you'd like to know more, the addendum to this post breaks down the JS with an actual example.

Leave a comment