Jump to content

Indented Code Is Hard to Read

Random Terrain


I must be the only person on the planet that has a hard time reading indented code. If you put "indented code is not easier to read" into Google, there isn't even one result. For me it's like trying to read a whole page of centered text.




Or trying to read code that is following the jagged lines of a polygraph.




I get lost jerking my eyes back and forth all over the page trying to read indented code. The following excerpt from the page below explains what I'm talking about:




Left aligned text is easier to read than centered text for paragraphs. This is because when you center your text, the starting place of each line changes. This forces your users to work harder to find where each line begins to continue reading. Without a straight left edge, there is no consistent place where users can move their eyes to when they complete each line.


Whether it's code or paragraphs, I can read faster and it doesn't hurt my eyes as much if it's in a straight line down the left side and not spread out all over the place in a jagged fashion.




Random Terrain

  • Thanks 1


Recommended Comments

Awesome perspective RT great article! :)  


We've gone overboard with multiple markup colors and massive indentation - I don't like either of these. The squiggly red underlines are even worse and frequently there by mistake in some editors.


The most offending aspect of indentation in large Microsoft SQL Server projects with many programmers is that indentation can't be relied on because SQL Management Studio tool doesn't automatically indent anything and manual indenting tends to go out of alignment over time. There are programmers who spend a great deal of time reviewing and redoing the indentation to understand the programs when this happens.


Any fans of indentation can PM me for a stored procedure program I wrote for Microsoft SQL Server that adds indentation to any stored procedure.


I use it on my own (left aligned) stored procedure programs when other developers request indentation, and use it to fix other developers indentation on large procs where it invariably goes off.


You would like this RT - I have another program I use that just removes SQL proc indentation completely so I can see the program easier, then I can run it through the indenter when I'm done so indenting programmers can follow the indentation. I feel the same way about markup colors, the IDE for SuperCharger Disk BASIC is refreshingly monochrome for that reason and has no indentation except that a space can be used instead of a line number or label. 


BASIC is great for breaking indentation, next x,y or next x:next y are often rewritten on separate lines by indenting fanatics.  


  • Like 1
Link to comment

I don't indent my code at all, so I can scroll left and right less often.  However, I do use the colors to help me read the code a bit better.

  • Like 1
Link to comment
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...