1002: Keep Files Smaller Than You

Share on:

Think about it when you are writing your code. You do not want to deal with building-sized Filesaurus. The creature with laser-eyes, poisonous breath, invisibility, and teleportation.

How To Avoid It

No file is large from the beginning. All files are created empty. However, over their existence, they slowly grow. If they are becoming too large, you should split them into multiple smaller files. If you want to split it, you have to figure out several new file names. It could be challenging to come up with names that would describe the content of newly created files. It is sometimes also the reason why splitting is postponed.

Note

Do not try to cheat by setting your font size to 1. It will use the font size that any of your colleagues can read.

You may be thinking, it is better to be chased by a single skyscraper-sized creature than hundreds of small ones, so I should put all the code into a single file. It doesn't work like this. Some people believe, that only a handful of creatures from the size range between 99th to 98th percentile will awake, to make it fair for older developers.

1001: Keep Methods Smaller Than Your HeadFollow Naming Convention: 1003