At Browserling, we’re huge fans of single file self-contained applications. Our entire website is a single index.php file and the entire browser application is a single script.js file.
The index.php is a 18,000 line file.
$ wc -l index.php 18060 index.php
And the script.js is a 30,000 file.
$ wc -l script.js 30301 script.js
Having your entire application in a single file has many advantages:
1) Everything is in the current buffer. All functions and variables are just there. They are no where else. Just this file.
2) You do not have to switch context. You always work in the same file.
3) You do not have to search for definitions anywhere else. As you work with the same file for years, you memorize where each definition is by the scrollbar position.
4) There are no dependencies. Nothing breaks on deploy as entire app is a self-contained.
5) The deployment is just a quick ftp upload.
6) It’s neat. Single files are great!
Start writing single file applications as well and see you next time!