Hacker News new | ask | show | jobs
by warwick 6151 days ago
Using a statically typed language might also help, as the compiler can catch a lot of really stupid errors.
2 comments

exactly. when i read the question i thought: i bet you are using some dynamic scripting language.

use a language a programming style that lets you catch errors early. it's amazing how much time i've wasted testing for errors after small changes in ruby programs. errors that a decent language & compiler wouldn't have allowed or detected much earlier. some languages just weren't designed with this in mind. i no longer program in ruby.

related: once upon a time, i had the idea that i should be able to write a program and have it compiler & work at the first & final attempt. code was in c. of course that failed miserably. especially with the lack of c coding experience. the lesson: don't try to be silly/"smart", use the tools to your advantage. (if your tools don't have advantages, don't use them).

for those of us using dynamic languages like ruby, make a habit of hitting Ctrl+Shift+V (Validate Syntax in TextMate) or your editor's equivalent. That will catch the dumbest of all errors (missing parens, block terminators, string terminators, etc). alternatively you can add a validate_syntax step to your deployment strategy and just run something like >> ruby -c whatever.rb on files that are part of the most recent commit.