Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Indented properly with tabs.
Indentation width set to 3.
Whitespaces shown.

Code is lined up properly properl.

Indentation width set to 8.
Code remains lined up properly.


Now consider a situation where another developer is using an editor which is configured to indent using spaces by default.  The developer makes changes to 1 of the lines:

Indented incorrectly with a mix of
tabs and spaces.

Code appears lined up to the
developer who messed up the
indentation.

Code is not lined up for other
developers.

A mix of tabs and spaces is only acceptable in order to indent sections of code which spans multiple lines but is not an entire block between curly braces.  The following example illustrates this:

Image Added

Image Added

Everything in the notify command is indented with a single tab.
The message is broken up into multiple lines for readability.
Each line of the message is indented with spaces to make it line up with the first line.

Code is lined up properly and easy to read.

Image Added

Image Added

The editor's indentation with is changed to 8.
The only shifts are reflected in the tabs.

The code remains lined up properly and easy to read.

Comments

Variable Names

meaningful

...