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

Similarly, various C programs are a single file.

$ wc -l monitor.c
47695 monitor.c

And shell scripts are a single file.

$ wc -l proc.sh
9337 proc.sh

The rule is very simple. If it can be a single file, then it must be a single file.

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 don't have to switch context. You always work in the same file.

3) You don't 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 a quick ftp upload. You ship instantly. There are no tests, no pre-deploy, post-deploy, nothing. Uploaded means shipped. It can't get faster than this.

6) It's neat. Single files are great!

Start writing single file applications as well and see you next time!