RANDOMBYTES.PRO

LIFT

LIFT is an acronym for four guiding principles for Code organization: Locate, Identify, Flat, Try to be DRY. The key is that these principles listed in order of importance.

Locate. This is a big topic by itself. You may know file name but not the full path. Or you may know function name but not the file name. You may use some search dialog which allows to jump through multiple levels of structure or use some file explorer.

Identify. Naming should help identify contents.

Flat. Flatter structures are easier to reason about and change.

Try to be DRY. I like this "try" and the fact that this is the last by importance. Often we try to hard to follow DRY principle, so it's good to have a reminder to not over-DRY.

Fun fact: having something like components/SomeComponent/index.tsx with code in index.tsx itself is a great way to go against first three principles. Please do not repeat it at home (and work!)


Meta

Created: 2023-10-29

References: