Avatar

Spaces keep indents and alignments universal (Destiny)

by dogcow @, Hiding from Bob, in the vent core., Tuesday, December 13, 2016, 15:12 (3144 days ago) @ kidtsunami

-->|if (output != null)
-->|{
-->|-->|output.append("account_id").append('\t')xxxxxxx// comment about account_id
-->|-->|xxxxxx.append("submission_id").append('\t')xxxx// comment about submission_id
-->|-->|xxxxxx.append("payment_method").append('\t');xx// comment about payment_method
-->|}


You never have to worry about downloading a file and opening it up in an editor and having it looks like awful nonsense. Considering that almost any text editor or IDE one would use for coding allows you to set Tab Space by filetype, workspace, user, or application wide, it can be super consistent.


Though honestly, it's whatever your team decides, I'm a Clean Coder and that's the law I live by.

The wonderful thing about using tabs for indenting and spaces for aligning (or making code pretty) is that it doesn't matter what editor you open it up in, it will look pretty and match your preferred indent size (as long as you are using a fixed width font, variable width font users are just wrong, and they deserve to look at ugly, slightly misaligned code all day long).

My example opened in an editor that has tabs set to 6-spaces wide:
---->|if (output != null)
---->|{
---->|---->|output.append("account_id").append('\t')xxxxxxx// comment about account_id
---->|---->|xxxxxx.append("submission_id").append('\t')xxxx// comment about submission_id
---->|---->|xxxxxx.append("payment_method").append('\t');xx// comment about payment_method
---->|}

But yes, above all stick to your team's coding standards, please!


Edit: are you a python guy? I suspect you may be...


Complete thread:

 RSS Feed of thread