Background:
Many programming languages allow extremely long user-defined variable and function names. Frequently, companies will have a specific policy on naming: for example, forbidding abbreviations and requiring descriptive variable names (e.g., “CALCULATE_TOTAL_COMPOUND_INTEREST” would be OK, but “COMPINT” or “CCI” would not).
The Issue:
Normally, this makes sense: if someone has to read a bunch of code written by a coworker, it’s a lot easier to interpret “did_customer_request_an_email == false” versus “c_eml == false”.
However, long variable names can also cause code to become unreadably verbose (Figure 1).

While this code complies with the company’s “descriptive variable names, no abbreviations” naming policy, it’s quite difficult to read!
Proposal:
Code-editing software should needs a single-button toggle that replaces all variables and function names with a short version—preferably, a single distinctive emoji.
As shown in Figure 2, this makes the code much less cluttered. Now we can see what’s going on!

Conclusion:
If a source code file happened to be so long that we entirely run out of emoji, that’s no problem either: there are over 98,000 Chinese characters in Unicode, so we can just use those—we won’t hit problems unless there are (somehow) over 100,000 unique functions/variables in a single file.
PROS: Since this would be a non-destructive toggle, there’s no downside: a programmer could enter “emoji mode” when looking at the structure of some code, but switch to “verbose mode” when detailed information was needed.
CONS: None!
Originally published 2024-07-01.


You must be logged in to post a comment.