Do people leave their code tabbed?

Soldato
Joined
21 Oct 2002
Posts
18,022
Location
London & Singapore
Conrad11 said:
Hi there,

I just wanted to know if people leave their code indented when they have finished?

Thanks.
:confused: So there are people out there that write a class with perfect indentation, then once they've finished they remove all the indenting and basically say "**** you, I won't be working here when the time comes to maintain it!" :eek:
 
Soldato
Joined
10 Sep 2003
Posts
4,942
Location
Midlands
NathanE said:
:confused: So there are people out there that write a class with perfect indentation, then once they've finished they remove all the indenting and basically say "**** you, I won't be working here when the time comes to maintain it!" :eek:

imagine it's the first day of your new job and your first task is to sit there and indent a whole 10,000 line app :eek:
 
Soldato
OP
Joined
12 Jun 2005
Posts
5,361
I was referring to like HTML, CSS and maybe PHP (the only things i am partially capable in :p).

What I meant was, do you save a live version which is untabbed and keep a test version which is tabbed for when you need to maintain and make changes?
 
Soldato
Joined
21 Oct 2002
Posts
18,022
Location
London & Singapore
Conrad11 said:
I was referring to like HTML, CSS and maybe PHP (the only things i am partially capable in :p).

What I meant was, do you save a live version which is untabbed and keep a test version which is tabbed for when you need to maintain and make changes?
Be easier to install an ISAPI on IIS (or whatever the equivilent name for a plugin is on Apache) to strip whitespace on served pages.
 
Permabanned
Joined
18 Jul 2006
Posts
1,222
Location
Frodsham
Conrad11 said:
I was referring to like HTML, CSS and maybe PHP (the only things i am partially capable in :p).

What I meant was, do you save a live version which is untabbed and keep a test version which is tabbed for when you need to maintain and make changes?

What would be the point the gain in speed would have to be counted on 0.1 ms
 
Soldato
Joined
21 Oct 2002
Posts
18,022
Location
London & Singapore
chesterstu said:
What would be the point the gain in speed would have to be counted on 0.1 ms
Not true really... whitespace can easily account for probably a quarter of served content on a really well indented site. Especially if spaces are used instead of tabs...

Also its not just performance, its bandwidth costs...
 
Soldato
Joined
18 Oct 2002
Posts
5,464
Location
London Town
No, I remove all indenting and extraneous whitespace from HTML/markup prior to it being displayed but retain all linebreaks. It's simple for my workflow because I work with templating systems (Smarty) and the template output just gets run through an output-filter that strips all the whitespace automatically. The compacted output is cached and the job's done without needing to ever worry about maintaining it.

Javascript files are normally compacted to one-liner files, unless they're also generated via a template, in which case they also go though the same process above. Otherwise, yes, two versions are maintained.

I don't touch CSS files, but I never indent CSS anyway.

For extra bonus points javascript and CSS are both sent down the line using gzip compression, which can yield some really impressive results.

For example, take Yahoo!'s YUI javascript library. event.js, the incredibly useful library for event handling is 43KB in its original state :eek:. It would be silly to have that loading for each user - it's not that good! However, stripped down (inc. comments) it drops down to only 8KB. The thoughtful Yahoo devs even supply a version pre-crushed. Then send it gzip compressed and it's just three tiny kilobytes. So, yes, in my mind, it's very worthwhile and potentially very rewarding to spend a little extra time optimising filesize any way you can. That applies to anything that gets sent down the pipes - images, CSS, html...

Any bandwidth saving, however small, is good as long as the processing requirement doesn't outweigh it.

As for PHP/serverside scripts, they stay indented and formatted. There would be no benefit derived from stripping whitespace other than saving diskspace.
 
Last edited:
Back
Top Bottom