5 ms·
Readability is a very worthy objective. And alignment has been used since before Gutenberg in text layout. Almost all code uses vertical alignment to some degre
by drderidder 12y ago
Readability is a very worthy objective. And alignment has been used since before Gutenberg in text layout. Almost all code uses vertical alignment to some degree, whether its indentation, aligning braces or what have you. Aligning variable assignments in a grid is a natural extension particularly where those variables are interdependent (ie. changing one value is likely to require altering another in tandem) or where the variables are part of a formula where quick scanning of the values aids comprehension.
So it has its uses. Personally, I use it where it makes sense, organizing blocks of related variables together, and changing the alignment occasionally as needed to accommodate longer variable names. It's not OCD at all, and I for one find that developers who care about how their code looks end up producing better, more successful projects. Well laid out and highly readable code is, to me at least, one of the hallmarks of a truly skilled programmer.
- robotkilla 12y agoBooks don't have syntax highlighting. Why does adding a bunch of whitespace to a line make it faster to read than syntax highlighting?
- drderidder 12y agoBecause syntax highlighting serves a completely separate purpose. Books that contain collections of related data points frequently do use a tabular presentation. Syntax highlighting provides visual cues for the role that a particular keyword plays in the language syntax.
- robotkilla 12y agoThat was my point – syntax highlighting is suited for code. whitespace for readability is more suited for books.
- nsfyn55 12y ago>Readability is a very worthy objective. Agreed, but its not the only objective. There is a balance to be struck. Speaking from the perspective of an individual that delivers software as part of a team: producing readable/understandable code == GOOD letting your aesthetic preference be disruptive == BAD As an anecdote I have worked on teams where a certain individual's need for symmetry in the code base has significantly reduced the efficacy of source control and caused issues particularly with automated build/deployment. When I criticize "readability" its not because I don't believe its important, but rather because its too often used to justify one individual's preference without regard to objective counter criteria and too often embodies "The perfect being the enemy of the good"