A Good Editor is Very Important

I was working on a large PHP class today, and I noticed that over 60% of my typo errors were occurring in very similar pieces of code. For the most part, the most error prone lines looked a little bit like this:

if(!empty($some_array["some_key"]) {

Do you see the error in this line? I dropped the closing paren for the if statement. I did that allot. In fact, I did this on almost every single statement of this kind. What does this tell me?

Watch your parentheses!

Yeah, right. Easy for you to say, Mr. Voice in my Head. I know I should watch for them. Hell, I’m trying as hard as I can not to make this kinds of errors. But apparently this is not enough. When I’m busy thinking about the logic of my code, I just drop them without realizing it.

Use a paren-match highlighting then!

Two steps ahead of you dude. I do not touch an editor that doesn’t have this feature. Problem is, that when I code fast, I don’t bother to check if the correct bracket is highlighted on the other side of the expression. It helps me find these errors, but it doesn’t stop me from making them.

No, what I really need is an auto-paren feature that will insert a matching closing bracket for me. This is the only way I can maximize my coding time without getting bogged down by silly typos.

This is why using a decent editor or and IDE is extremely important. If you do not have this type of feature, your productivity will suffer. Same goes for all kinds of auto-completion features.

[tags]php, ide, editors, programming, text editing, parentheses[/tags]

This entry was posted in Uncategorized. Bookmark the permalink.



Leave a Reply

Your email address will not be published. Required fields are marked *