A few years ago I boosted my editor's font size from the default of 12px up to 18px. This of course cuts down on the number of lines of code that I can see on my screen, which sounds like a bad thing. My eyesight's perfectly fine; I've never worn glasses or contacts. My IDE lives on a standard 15" laptop screen, not a giant 4K monitor. I'm not boosting because of necessity. So why do it?
It helps keep my code simple
No matter how complex the overall project is, I still need to write simple, straightforward functions which just do one thing (aka the Single Responsibility Principle). Even the most complicated order processing handler should be composed of atomic, bite-sized chunks which are combined to form the whole algorithm.
When only a small amount of code is visible on my screen, I have a visceral reason to avoid complicated functions that try to do too much. When a function's implementation starts to grow and I have to scroll to see the whole thing, I automatically feel a subconscious nagging to decompose that function into smaller pieces.
It puts irrelevant details out of sight
When editing a larger file or class, there will be lots of code unrelated to what you're immediately working on. Increasing your font size pushes most of that stuff out of sight, out of mind. You can keep your focus on what matters--the code right in front of you.
If you need to reference code from outside your immediate viewport, you can easily do that using your IDE's object lookup and Intellisense-style documentation without scrolling around.
It puts my code front and center
My screen is packed with menus, status messages, a file list, open tabs, and other visual baggage. All that stuff is important and generally has to stay accessible. But the code is the most important thing that I see, and I want those other visual elements to be secondary on my screen. Increasing your font size gives code visual weight.
And when you need to discuss your code with someone via video chat or in person, your code is easy for someone to see even if your screen is resized smaller or sitting a few feet away.
This doesn't work for everyone perfectly all the time:
- When dealing with legacy or poorly-decomposed code. You can run into some gigantic functions that may not be decomposed well. If it's really bad, I'll drop my editor's font size down a couple notches to help visualize things better.
- Some pieces of code have to be long. Sometimes you've got a function that needs to have a bunch of guard clauses in a row, or a bunch of statements that all have to happen within the same variable scope. I find that this doesn't happen very often, but it does happen. Though if you're seeing like a lot, you might consider refactoring.
- Some languages are just verbose. If you're writing in lower-level languages like C or assembly, your functions tend to be longer because of boilerplate code. And you might not be able to decompose those functions for performance reasons. This downside generally doesn't apply to higher-level languages like JS, Python, PHP, or Go.
This trick has worked pretty well for me for a number of years. I find that I'm more efficient, more focused, and architect my code better with a bigger font size.