coding style - Are there practical or technical advantages to using 2-space vs 4-space indents? -
aside taste, habit , personal preference, there advantages using 2-space vs. 4-space indents while coding?
for instance, in google style guide, recommended utilize 2-space indents css.
are there technical advantages using 1 on other, instance when transferring info between different systems?
are there accepted conventions? (that perchance differ language language)
there no clear "technical" advantages 1 way or other. indeed "technical" issue can think of impact on number of bytes in source file.
if represent indents using space characters (ascii sp), 2 spaces 2 characters fewer 4 spaces.
if allow tab characters used, (on windows) tab indents 4 spaces, tab characters result in fewer characters. flip side tab conventionally indents 8 spaces on many other operating systems, if want source code nice on platforms shouldn't utilize tab indentation.
and besides, mutual practice "minify" css, javascript , web-associated languages create websites "faster". among other things, strip out indentation, rendering minor technical difference moot.
(for human readable version of css, saving in transmission time / storage space trivial worry about. today's systems optimized mass market, storing , moving around gigabyte-sized files (movies) common-place. source code pales insignificance.)
as "practical" advantages, guess may easier view , edit files if don't waste much screen real-estate deep indentation. perspective 2 character indentation improve 4 or 8 character indentation.
however, borders on beingness "personal taste" issue. (except when using justification asking boss yet ultra-wide monitor on desk :-) )
are there accepted conventions?
in general no.
in languages, maybe, can't think of any. in java, mutual convention indentation 4 spaces, others acceptable.
coding-style compatibility
No comments:
Post a Comment