Invisible Characters
July, 21st 2010For the love of everything good in the world, please, please, please turn on invisible characters in your editor of choice. They all support it now and there’s really no reason not to. I can’t tell you how frustrating it is to open a file that looks like this:
function add_class(class)
{
if (class.seats-class.enrolled > 0)
{
class.add(this);
class.send_notification(this.email);
}
}
when it should look like this:
function add_class(class)
{
if (class.seats-class.enrolled > 0)
{
class.add(this);
class.send_notification(this.email);
}
}
So, what happened there? Well, I got code from a developer who uses 2 spaces per tab. On their computer everything looked fine because two spaces and tabs were interchangeable. However, on my 4 spaces per tab computer it all went to hell. So, please turn on invisible characters and take as much care writing them as you do the visible characters.
Update: I don’t really care if you use spaces or tabs, it’s really up to you, but don’t use both. Most of the time the only way to know for sure which you’re using (or inheriting) is to turn on invisible characters.



Comments
I whole-heartedly agree. I was initially opposed to this, but after about half a day (that’s it! half a day!), I was already used to it. I’ve changed the color of my invisible colors in my code editors to be, well, mostly invisible - just a shade lighter than the dark background of my editor background (which is a dark grey).
Having invisible characters always turned on has helped me instantly determine why some code doesn’t look like it should. It also pleases the OCD part of me, which gets a chubby for properly indented code.
Posted at 12:26 PM on July 21, 2010
Ray, OCD definitely influenced a good bit of this post.
Besides that though invisible characters can be a godsend when you’re trying to debug a PHP headers issue.
Posted at 12:28 PM on July 21, 2010
INDENTING IS FOR THE WEAK
Posted at 12:29 PM on July 21, 2010
Good tip.
It should especially help Django/Python developers like me that were too dumb to turn on invisible characters and ended up debugging white space errors blindly…
Posted at 12:32 PM on July 21, 2010
Post a Comment