Don’t make me scroll

Donald Raab
1 min readNov 27, 2023

--

I want to read your code… not travel through it.

Photo by Taylor Flowe on Unsplash

I want code for a single Java method to fit on one screen. I do not want to scroll vertically or horizontally when I am looking at a single method. Making me scroll is an opportunity for me to lose focus and context and have to waste time scrolling back and forth. I use big fonts on my laptop. I can switch to smaller fonts but it’s harder on my eyes.

My metric for a good Java method is less than ten Java statements, and less than thirty lines of text with method signature and curly braces included. Code should not have to scroll horizontally to achieve this. Horizontal scrolling is much worse than vertical scrolling. Nested generics in Java can be challenging. Maybe add missing types to simplify generics. Requiring scrolling in both directions will slow comprehension down.

Thank you for reading this brief message, and for not making me scroll.

I am the creator of and committer for the Eclipse Collections OSS project, which is managed at the Eclipse Foundation. Eclipse Collections is open for contributions.

--

--

Donald Raab

Java Champion. Creator of the Eclipse Collections OSS Java library (https://github.com/eclipse/eclipse-collections). Inspired by Smalltalk. Opinions are my own.