• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How is identation implemented in a programming language?

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am a little confused regarding three facts ,firstly I went through the below article ,there it is mentioned that identation is implemented using tabs and when I read another articles there it is mentioned that both the tabs and spaces are used for identation so actually how is identation implemented.

http://mrbool.com/importance-of-code-indentation/29079

Secondly which one should be preffered,in one article it is mentioned that it is advantageous that tab have their own spaces according to their environment while others considered it to be a disadvantage ,so which one is more suitable tabs or spaces.

Thirdly ,does the size of the code file increase if more tabs or spaces are used in the c code.I checked it out ,found no change but I read it in one article.
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The Java programming language (and the C programming language) does not care how you indent the source code. Indentation is merely to make your source code more readable. You can using indentation. You can avoid using indentation. Or you can even use poor indentation, to the point of making your code unreadable to your colleagues (which of course, can give you a reputation of being bad at coding).

Regardless of how the source code is indented, the resultant class files for Java (and object and executable files for C) should be the same.

Henry
 
Sheriff
Posts: 17644
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are, however, languages where proper indentation is important and affects how the program is interpreted by the computer. Python, for example uses indentation to group statements together in control structures. Then there are the older fixed-column languages like COBOL, FORTRAN, and RPG where you do have to follow rules about how to align and indent things.

Java, as Henry noted, does not have any rules on indentation but many organizations encourage programmers to follow certain conventions to make the code easier to read.
 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tabs vs. spaces will probably never be settled, as you can see here.
 
Rancher
Posts: 1044
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
indent style @ Jargon File
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic