Skip to content

Why We (Me Included) Need to Stick To JavaScript Programming Style Standards

Updated: at 06:34 PM

 

I’ve listened multiple times to Douglas Crockford talk about the importance of following good programming style standards.  I try to normally, but this morning I got a little lazy with the following code:

store.sync({
    success: function() {Ext.Msg.alert("success")},
    failure: function(a,b,c) {…

I wrote this a while back and wanted to keep it short so I did not put the alert message on it’s own line.  Then, today I came along and decided to not have it execute the alert so I simply added a leading “//” giving me

store.sync({
    success: function() {//Ext.Msg.alert("success")},
    failure: function(a,b,c) {..

Well, of course it crashed my production deployment because I was again lazy and did not test.

Had I originally done it correctly as

store.sync({
    success: function() {
        Ext.Msg.alert("success")
    },…

I would have not been bitten today.

Just sayin…